Ejemplo n.º 1
0
 //ispykinect: this processes commands from the plugin
 void CameraWindow_AlertHandler(object sender, AlertEventArgs eventArgs)
 {
     if (Camera.Plugin != null)
     {
         var a = (String)Camera.Plugin.GetType().GetMethod("ProcessAlert").Invoke(Camera.Plugin, new object[] { eventArgs.Description });
         ProcessAlertFromPlugin(a, eventArgs.Description);
     }
 }
Ejemplo n.º 2
0
        //ispykinect: this processes commands from the plugin
        void CameraWindow_AlertHandler(object sender, AlertEventArgs eventArgs)
        {
            if (Camera.Plugin != null)
            {
                var a = (String)Camera.Plugin.GetType().GetMethod("ProcessAlert").Invoke(Camera.Plugin, new object[] { eventArgs.Description });
                if (!String.IsNullOrEmpty(a))
                {
                    string[] actions = a.ToLower().Split(',');
                    foreach (var action in actions)
                    {
                        if (!String.IsNullOrEmpty(action))
                        {
                            switch (action)
                            {
                                case "alarm":
                                    CameraAlarm(eventArgs.Description, EventArgs.Empty);
                                    break;
                                case "flash":
                                    FlashCounter = Helper.Now.AddSeconds(10);
                                    break;
                                case "record":
                                    RecordSwitch(true);
                                    break;
                                case "stoprecord":
                                    RecordSwitch(false);
                                    break;
                                default:
                                    if (action.StartsWith("border:") && action.Length > 7)
                                    {
                                        string col = action.Substring(7);
                                        try
                                        {
                                            _customColor = Color.FromArgb(Convert.ToInt32(col));
                                            Custom = true;
                                        }
                                        catch (Exception e)
                                        {
                                            if (ErrorHandler != null)
                                                ErrorHandler(e.Message);
                                        }

                                    }
                                    break;
                            }

                        }
                    }
                }
            }
        }