Esempio n. 1
0
        public ClientNetworkAdaptor()
        {
            // Network listener settings
            netListener = new ClientNetworkListener();
            netListener.OnUpdateFromServer += new ClientNetworkListener.OnUpdate(netListener_OnUpdateFromServer); // Register to the update event of netListener

            // Web Service settings
            InstanceContext context = new InstanceContext(netListener);     // Sending IntanceContex to Server that it will be able to make callbacks
            //  webService = new ForumServiceClient(context); //TODO uncomment
               // webService = new ForumServiceClient();
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ClientNetworkAdaptor(bool GetCallBack)
        {
            // Network listener settings
            netListener = new ClientNetworkListener();
            netListener.OnUpdateFromServer += new ClientNetworkListener.OnUpdate(netListener_OnUpdateFromServer); // Register to the update event of netListener

            // Web Service settings
            InstanceContext context = new InstanceContext(netListener);     // Sending IntanceContex to Server that it will be able to make callbacks
            //webService = new ForumServiceClient(context); //TODO uncomment
            ChannelFactory<IForumService> cf = new ChannelFactory<IForumService>(new WebHttpBinding(), "http://localhost:52644/NetworkLayer/ServerNetworkAdaptor.svc");
            cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
            webService = cf.CreateChannel();
            //if (GetCallBack)
            //{
            //    /webService.SubscribeToForum();  // Subscribing to Forum in order to get callbacks TODO uncomment
            //}
        }