using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace ServiceWeb
{
    public partial class SimpleService : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager scriptManager = ScriptManager.GetCurrent(this);

            //this is required because all proxy scripts have register the same client data
            //but have different internal namespaces. This can be seen at the end of the
            //proxy where the data types are registered.
            switch(serviceSelect.Text)
            {
                case "WCF Service":
                    //Registering Service also creates the proxy
                    scriptManager.Services.Add(new ServiceReference("~/AjaxWCFServices/SimpleService.svc"));
                    break;
                case "Internal WCF Service":
                    scriptManager.Scripts.Add(new ScriptReference("ServiceCommunication.SimpleService.SimpleWCFServiceProxy.js", "ServiceCommunication"));
                    break;
            }
        }
    }
}
