Ejemplo n.º 1
0
 public void Subscribe(SubClientData data)
 {
     //Obtaining the callback channel and add subscriber to dictionary
     ServiceCallback = OperationContext.Current.GetCallbackChannel <INotifySubClient>();
     subscribers.Add(ServiceCallback, data);
     Console.WriteLine("Subscribed");
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            InstanceContext context = new InstanceContext(new CallbackMethod());
            SubClientProxy  proxy   = new SubClientProxy(context, typeof(ISubscribeUnsubscribe).ToString());
            SubClientData   data    = new SubClientData();

            //Reading monitor client id from app config file
            data.ClientId = ConfigurationManager.AppSettings["Id"];

            //Waiting for monitor client to enter desired ids
            Console.WriteLine("Please enter id-s you want to subscribe (separeted by ,):");
            string input = Console.ReadLine();

            string[] ids = input.Split(',');
            data.Ids = ids.OfType <string>().ToList();

            //Subsrcibe for entered ids
            proxy.Subscribe(data);

            Console.ReadKey(true);

            proxy.Unsubscribe();

            Console.ReadKey(true);
        }
Ejemplo n.º 3
0
 public void Subscribe(SubClientData data)
 {
     try
     {
         factory.Subscribe(data);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }