Example #1
0
 public string Subscribe()
 {
     try
     {
         icbs = OperationContext.Current.GetCallbackChannel <ICallBackService>();
         subscribers.Add(icbs);
         Console.WriteLine(icbs.ToString());
         return("Successfully subscribed for weather updates!");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(e.Message);
     }
 }
Example #2
0
 public string Unsubscribe()
 {
     try
     {
         icbs = OperationContext.Current.GetCallbackChannel <ICallBackService>();
         lock (subscribers)
         {
             subscribers.Remove(icbs);
         }
         return("Successfully unsubscribed!");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return("Something went wrong! Try after some time.");
     }
 }
Example #3
0
 public CallBackController(ICallBackService service) => this.service = service;