Example #1
0
 public IAsyncResult BeginSubscribe(AsyncCallback cb, object state)
 {
     callback = OperationContext.Current.GetCallbackChannel <IPollingSessionCallback>();
     ((IChannel)callback).Closed += SampleService_Closed;
     priceChangeHandler           = new PriceChangeEventHandler(PriceChangeHandler);
     PriceChangeEvent            += priceChangeHandler;
     return(new CompletedAsyncResult());
 }
Example #2
0
 public void Subscribe()
 {
     callback = OperationContext.Current.GetCallbackChannel <IPollingSessionCallback>();
     ((IChannel)callback).Closed  += SampleService_Closed;
     ((IChannel)callback).Faulted += SampleService_Faulted;
     priceChangeHandler            = new PriceChangeEventHandler(PriceChangeHandler);
     PriceChangeEvent             += priceChangeHandler;
     //Console.WriteLine("Subscribe. Client count: " + cc.ToString());
 }
Example #3
0
        public Task SubscribeAsync()
        {
            Task task = new Task(() =>
            {
                callback = OperationContext.Current.GetCallbackChannel <IPollingSessionCallback>();
                ((IChannel)callback).Closed += SampleService_Closed;
                priceChangeHandler           = new PriceChangeEventHandler(PriceChangeHandler);
                PriceChangeEvent            += priceChangeHandler;
            });

            task.RunSynchronously();
            return(task);
        }
Example #4
0
        //Clients call this service operation to subscribe.
        //A price change event handler is registered for this client instance.

        //public void Subscribe()
        public bool Subscribe(string userName, string password)
        {
            if (userName == "umerazizmalik" && password == "abdulaziz")
            {
                callback           = OperationContext.Current.GetCallbackChannel <ISampleClientContract>();
                priceChangeHandler = new PriceChangeEventHandler(PriceChangeHandler);
                PriceChangeEvent  += priceChangeHandler;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        //Clients call this service operation to subscribe.
        //A price change event handler is registered for this client instance.

        public void Subscribe()
        {
            callback = OperationContext.Current.GetCallbackChannel<ISampleClientContract>();
            priceChangeHandler = new PriceChangeEventHandler(PriceChangeHandler);
            PriceChangeEvent += priceChangeHandler;
        }
Example #6
0
        //Clients call this service operation to subscribe.
        //A price change event handler is registered for this client instance.

        public void Subscribe()
        {
            callback           = OperationContext.Current.GetCallbackChannel <ISampleClientContract>();
            priceChangeHandler = new PriceChangeEventHandler(PriceChangeHandler);
            PriceChangeEvent  += priceChangeHandler;
        }