Esempio n. 1
0
 void client_ServiceRemoved(object sender, ServiceEventArgs e)
 {
     dispatcher.InvokeAsync(() =>
     {
         var light = Lights.SingleOrDefault(i => i.Service == e.Service.GetService());
         if (light != null)
             Lights.Remove(light);
     });
 }
Esempio n. 2
0
        void client_ServiceAdded(object sender, ServiceEventArgs e)
        {
            dispatcher.InvokeAsync(() =>
            {
                if (e.Service.Type == ServerTestApp.Light.ServiceType)
                {
                    var light = Lights.SingleOrDefault(i => i.Service == e.Service.GetService());
                    if (light != null)
                        Lights.Remove(light);

                    // subscribe to state change
                    e.Service.GetService().GetController().StateVariables["State"].ValueChanged += light_State_ValueChanged;

                    Lights.Add(new Light(e.Service.GetService()));
                }
            });
        }
Esempio n. 3
0
 protected virtual void OnServiceRemoved(ServiceEventArgs e)
 {
     OnEvent(ServiceRemoved, e);
 }
 static void HandleServiceAdded(object sender, ServiceEventArgs e)
 {
     Console.WriteLine (e.Service);
 }