示例#1
0
 internal static void LogDebug(
     string domain,
     string source,
     string description,
     string property,
     string value)
 {
     var debugEvent = new MigEvent(domain, source, description, property, value);
     MigService.Log.Debug(debugEvent);
 }
示例#2
0
 internal static void LogError(
     string domain,
     string source,
     string description,
     string property,
     string value)
 {
     var errorEvent = new MigEvent(domain, source, description, property, value);
     LogError(errorEvent);
 }
示例#3
0
 internal void RaiseEvent(MigEvent evt)
 {
     migService.RaiseEvent(evt);
 }
示例#4
0
 internal void RaiseEvent(object sender, MigEvent evt)
 {
     migService.RaiseEvent(sender, evt);
 }
示例#5
0
        public void SignalPropertyChange(object sender, Module module, MigEvent eventData)
        {
            // ROUTE THE EVENT TO AUTOMATION PROGRAMS, BEFORE COMMITTING THE CHANGE
            var tempParam = new ModuleParameter() {
                Name = eventData.Property,
                Value = eventData.Value.ToString()
            };
            var routedEvent = new RoutedEvent() {
                Sender = sender,
                Module = module,
                Parameter = tempParam
            };

            // Route event to Programs->ModuleIsChangingHandler
            RoutePropertyBeforeChangeEvent(routedEvent);

            // If the value has been manipulated by an automation program
            // so the event has to be updated as well
            if (tempParam.Value != eventData.Value.ToString())
            {
                MigService.Log.Debug("Parameter value manipulated by automation program (Name={0}, OldValue={1}, NewValue={2})", tempParam.Name, eventData.Value.ToString(), tempParam.Value);
                // Update the event value to the new value
                eventData.Value = tempParam.Value;
            }

            // Route event to Programs->ModuleIsChangingHandler
            ThreadPool.QueueUserWorkItem(new WaitCallback(RoutePropertyChangedEvent), routedEvent);
        }
示例#6
0
 private static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e) 
 {
     var logEntry = new MigEvent(
         Domains.HomeAutomation_HomeGenie,
         "Trapper",
         "Unhandled Exception",
         "Error.Exception",
         e.ExceptionObject.ToString()
     );
     try
     {
         // try broadcast first (we don't want homegenie object to be passed, so use the domain string)
         _homegenie.RaiseEvent(Domains.HomeGenie_System, logEntry);
     }
     catch 
     {
         HomeGenieService.LogError(logEntry);
     }
 }
示例#7
0
 private static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e)
 {
     var logEntry = new MigEvent(
         Domains.HomeAutomation_HomeGenie,
         "Trapper",
         "Unhandled Exception",
         "Error.Exception",
         e.ExceptionObject.ToString()
     );
     try
     {
         // try broadcast first
         _homegenie.RaiseEvent(logEntry);
     }
     catch
     {
         HomeGenieService.LogError(logEntry);
     }
 }
示例#8
0
 /// <summary>
 /// Raises the event.
 /// </summary>
 /// <param name="evt">Evt.</param>
 public void RaiseEvent(object sender, MigEvent evt)
 {
     OnInterfacePropertyChanged(sender, new InterfacePropertyChangedEventArgs(evt));
 }
示例#9
0
        public void SignalPropertyChange(object sender, Module module, MigEvent eventData)
        {
            ModuleParameter parameter = null;
            try
            {
                // Lookup for the existing module parameter
                parameter = Utility.ModuleParameterGet(module, eventData.Property);
                if (parameter == null)
                {
                    parameter = new ModuleParameter() {
                        Name = eventData.Property,
                        Value = eventData.Value.ToString()
                    };
                    module.Properties.Add(parameter);
                }
                else
                {
                    parameter.Value = eventData.Value.ToString();
                }
            }
            catch (Exception ex)
            {
                HomeGenieService.LogError(ex);
            }

            var routedEvent = new RoutedEvent() {
                Sender = sender,
                Module = module,
                Parameter = parameter
            };

            // Route event to Programs->ModuleIsChangingHandler
            if (RoutePropertyBeforeChangeEvent(routedEvent))
            {
                // Route event to Programs->ModuleChangedHandler
                ThreadPool.QueueUserWorkItem(new WaitCallback(RoutePropertyChangedEvent), routedEvent);
            }
        }
示例#10
0
        public void SignalPropertyChange(object sender, Module module, MigEvent eventData)
        {
            ModuleParameter parameter = Utility.ModuleParameterGet(module, eventData.Property);

            var routedEvent = new RoutedEvent() {
                Sender = sender,
                Module = module,
                Parameter = parameter
            };

            // Route event to Programs->ModuleIsChangingHandler
            if (RoutePropertyBeforeChangeEvent(routedEvent))
            {
                // Route event to Programs->ModuleChangedHandler
                ThreadPool.QueueUserWorkItem(new WaitCallback(RoutePropertyChangedEvent), routedEvent);
            }
        }
示例#11
0
 public InterfacePropertyChangedEventArgs(string domain, string source, string description, string propertyPath, object propertyValue)
 {
     EventData = new MigEvent(domain, source, description, propertyPath, propertyValue);
 }
示例#12
0
 public InterfacePropertyChangedEventArgs(MigEvent eventData)
 {
     EventData = eventData;
 }
示例#13
0
 /// <summary>
 /// Raises the event.
 /// </summary>
 /// <param name="evt">Evt.</param>
 public void RaiseEvent(object sender, MigEvent evt)
 {
     OnInterfacePropertyChanged(sender, new InterfacePropertyChangedEventArgs(evt));
 }
示例#14
0
 public InterfacePropertyChangedEventArgs(string domain, string source, string description, string propertyPath, object propertyValue)
 {
     EventData = new MigEvent(domain, source, description, propertyPath, propertyValue);
 }
示例#15
0
 public InterfacePropertyChangedEventArgs(MigEvent eventData)
 {
     EventData = eventData;
 }