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()); }
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()); }
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); }
//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); } }
//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; }
//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; }