Exemple #1
0
 protected virtual void OnInterfacePropertyChanged(object sender, InterfacePropertyChangedEventArgs args)
 {
     Log.Info(args.EventData);
     if (InterfacePropertyChanged != null)
     {
         InterfacePropertyChanged(sender, args);
     }
     // Route event to MIG.Gateways as well
     foreach (var gateway in Gateways)
     {
         gateway.OnInterfacePropertyChanged(sender, args);
     }
 }
Exemple #2
0
        private void migService_InterfacePropertyChanged(object sender, InterfacePropertyChangedEventArgs args)
        {
            // look for module associated to this event
            Module module = Modules.Find(o => o.Domain == args.EventData.Domain && o.Address == args.EventData.Source);
            if (module != null && args.EventData.Property != "")
            {
                // clear RoutingNode property since the event was locally generated
                //if (module.RoutingNode != "")
                //{
                //    module.RoutingNode = "";
                //}
                // we found associated module in HomeGenie.Modules

                // Update/Add the module parameter as needed
                ModuleParameter parameter = null;
                try
                {
                    // Lookup for the existing module parameter
                    parameter = Utility.ModuleParameterGet(module, args.EventData.Property);
                    if (parameter == null)
                    {
                        parameter = new ModuleParameter() {
                            Name = args.EventData.Property,
                            Value = args.EventData.Value.ToString()
                        };
                        module.Properties.Add(parameter);
                        //parameter = Utility.ModuleParameterGet(module, args.EventData.Property);
                    }
                    else
                    {
                        parameter.Value = args.EventData.Value.ToString();
                    }
                }
                catch (Exception ex)
                {
                    LogError(ex);
                }
                // Prevent event pump from blocking on other worker tasks
                if (masterControlProgram != null)
                Utility.RunAsyncTask(() =>
                {
                    masterControlProgram.SignalPropertyChange(sender, module, args.EventData);
                });
            }
            else
            {
                if (args.EventData.Domain == Domains.MigService_Interfaces)
                {
                    modules_RefreshInterface(migService.GetInterface(args.EventData.Source));
                }
                /*
                LogBroadcastEvent(
                    args.EventData.Domain,
                    args.EventData.Source,
                    args.EventData.Description,
                    args.EventData.Property,
                    args.EventData.Value != null ? args.EventData.Value.ToString() : ""
                );
                */
            }
        }
 private void MigService_InterfacePropertyChanged(object sender, InterfacePropertyChangedEventArgs args)
 {
     // event propagation
     // TODO: should preserve the original "sender" ?
     OnInterfacePropertyChanged(sender, args);
 }
Exemple #4
0
 private void MigService_InterfacePropertyChanged(object sender, InterfacePropertyChangedEventArgs args)
 {
     // event propagation
     // TODO: should preserve the original "sender" ?
     OnInterfacePropertyChanged(sender, args);
 }
 protected virtual void OnInterfacePropertyChanged(object sender, InterfacePropertyChangedEventArgs args)
 {
     Log.Info(args.EventData);
     if (InterfacePropertyChanged != null)
     {
         InterfacePropertyChanged(sender, args);
     }
     // Route event to MIG.Gateways as well
     foreach (var gateway in Gateways)
         gateway.OnInterfacePropertyChanged(sender, args);
 }