Ejemplo n.º 1
0
        public void ProcessTopic(object obj)
        {
            SetAllProperties(obj);

            NotificationEntry notif = new NotificationEntry(topicMessage.notificationId, topicMessage.objectName, topicMessage.fieldType, topicMessage.fieldName, topicMessage.fieldValue, topicMessage.fieldOperator, topicMessage.sender);

            NotificationRegistry.addToList(notif);
        }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        // To put only in start bloc
        client.MqttMsgPublishReceived += client_MqttMsgPublishReceived;


        client.Connect(clientId);
        client.Subscribe(new string[] { MqttSetting.MAIN_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.MONO_FREE_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.MULTIPLE_FREE_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.POSITION_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.COLOR_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.GET_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.SET_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.MOVE_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.PROPERTY_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.CREATE_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.DESTROY_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
        client.Subscribe(new string[] { MqttSetting.NOTIFICATION_TOPIC }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });

        NotificationRegistry.getCallingMethod();
    }
Ejemplo n.º 3
0
    public void LoadEverything()
    {
        MainWindow.Instance = this;

        if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Windows)
        {
            SetupSingleInstanceEvent();
        }

        Build();

        String brandingPath = global::System.IO.Path.Combine(global::System.AppDomain.CurrentDomain.BaseDirectory, "branding.png");

        if (File.Exists(brandingPath))
        {
            this.imageBranding.File = brandingPath;

            this.SetSizeRequest(500, this.imageBranding.Pixbuf.Height + 500);
        }

        if (ApplicationSettings.ApplicationTitle != "")
        {
            this.Title = String.Format(ApplicationSettings.ApplicationTitle, ApplicationDataModel.ApplicationVersion);
        }
        else
        {
            this.Title = "BlinkStick " + ApplicationDataModel.ApplicationVersion;
        }

        log.Info("Loading data");
        DataModel.Load();

        log.Debug("Registering/Unregistering startup");
        RegisterStartup(ApplicationSettings.StartWithWindows);

        log.Debug("Loading main form icon");
        this.Icon = new global::Gdk.Pixbuf(global::System.IO.Path.Combine(global::System.AppDomain.CurrentDomain.BaseDirectory, "icon.png"));

        DeviceMonitor = new UsbMonitor();
        DeviceMonitor.UsbDevicesChanged += (object sender, EventArgs e) => {
            Gtk.Application.Invoke(delegate {
                RefreshDevices();
            });
        };
        DeviceMonitor.Start();

        log.Debug("Building popup menu");
        //Build Popup Menu for TrayIcon
        popupMenu = new Menu();

        //Settings menu item
        ImageMenuItem menuItemSettings = new ImageMenuItem("Settings");

        menuItemSettings.Image      = new Gtk.Image("icons-dark-cog-small", IconSize.Menu);
        menuItemSettings.Activated += ToggleMainWindow;
        popupMenu.Append(menuItemSettings);

        popupMenu.Append(new SeparatorMenuItem());

        //Quit menu item
        ImageMenuItem menuItemQuit = new ImageMenuItem("Quit");

        menuItemQuit.Image      = new Gtk.Image("icon-dark-sign-out-small", IconSize.Menu);
        menuItemQuit.Activated += OnQuitActionActivated;
        popupMenu.Append(menuItemQuit);

        log.Debug("Showing popup menu");
        popupMenu.ShowAll();
        //TODO: Remove ifdef and use platform detection
        #if LINUX
        indicator        = new ApplicationIndicator("blinkstick", "icon", Category.ApplicationStatus, ExecutableFolder);
        indicator.Menu   = popupMenu;
        indicator.Status = AppIndicator.Status.Active;
        #else
        log.Debug("Setting up tray icon");
        if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Windows)
        {
            trayIcon = new StatusIcon(new Pixbuf(System.IO.Path.Combine(ExecutableFolder, "icon.ico")));
        }
        else if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Mac)
        {
            trayIcon = new StatusIcon(new Pixbuf(System.IO.Path.Combine(ExecutableFolder, "icon-osx.ico")));
        }
        trayIcon.Tooltip = this.Title;
        trayIcon.Visible = true;

        // Show/Hide the window (even from the Panel/Taskbar) when the TrayIcon has been clicked.
        if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Windows)
        {
            trayIcon.Activate += ToggleMainWindow;
        }

        trayIcon.PopupMenu += delegate {
            if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Mac)
            {
                this.Show();
            }
            else
            {
                popupMenu.ShowAll();
                popupMenu.Popup();
            }
        };
        #endif
        if (HidSharp.PlatformDetector.RunningPlatform() == HidSharp.PlatformDetector.Platform.Mac)
        {
            //enable the global key handler for keyboard shortcuts
            MacMenu.GlobalKeyHandlerEnabled = true;

            //Tell the IGE library to use your GTK menu as the Mac main menu
            //MacMenu.MenuBar = menubar2;

            //tell IGE which menu item should be used for the app menu's quit item
            MacMenu.QuitMenuItem = menuItemQuit;

            //add a new group to the app menu, and add some items to it
            var           appGroup      = MacMenu.AddAppMenuGroup();
            ImageMenuItem menuItemAbout = new ImageMenuItem("About");
            menuItemAbout.Activated += (sender, e) => {
                this.Show();
                VisiblePage = this.Pages[this.Pages.Count - 1];
            };

            appGroup.AddMenuItem(menuItemAbout, "About BlinkStick Client...");

            ImageMenuItem menuItemPreferences = new ImageMenuItem("Preferences");
            menuItemPreferences.Activated += (sender, e) => {
                this.Show();
                VisiblePage = this.Pages[this.Pages.Count - 2];
            };
            appGroup.AddMenuItem(menuItemPreferences, "Preferences...");

            ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
            {
                OnQuitActionActivated(null, null);
                e.Handled = true;
            };

            ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e) {
                this.Deiconify();
                this.Visible = true;
                e.Handled    = true;
            };

            //optional, only need this if your Info.plist registers to handle urls
            ApplicationEvents.OpenUrls += delegate(object sender, ApplicationUrlEventArgs e) {
                if (e.Urls != null || e.Urls.Count > 0)
                {
                    //OpenUrls (e.Urls);
                }
                e.Handled = true;
            };
        }

        NotificationRegistry.Register("Utilities",
                                      "Simple test notification",
                                      typeof(NotificationTest),
                                      typeof(TestEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-test.png"));

        NotificationRegistry.Register("Utilities",
                                      "Play pattern after BlinkStick Client application starts",
                                      typeof(NotificationStart),
                                      typeof(TestEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-test.png"));

        NotificationRegistry.Register("Utilities",
                                      "Play pattern before BlinkStick Client application exits",
                                      typeof(NotificationExit),
                                      typeof(TestEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-test.png"));

        NotificationRegistry.Register("Background",
                                      "Creates an ambilight effect",
                                      typeof(NotificationAmbilight),
                                      null,
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-ambilight.png"));

        NotificationRegistry.Register("Background",
                                      "Runs a Boblight service prefonfigured for BlinkStick " +
                                      "which allows applications supporting Boblight protocol " +
                                      "to control the device and create ambilight effects",
                                      typeof(NotificationBoblight), null);

        NotificationRegistry.Register("Email",
                                      "Checks your GMail account and notifies when new mail arrives",
                                      typeof(NotificationGmail),
                                      typeof(GmailEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-gmail.png"));

        NotificationRegistry.Register("Email",
                                      "Checks your IMAP email account and notifies when new mail arrives",
                                      typeof(NotificationImap),
                                      typeof(EmailEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-mail.png"));

        NotificationRegistry.Register("Email",
                                      "Checks your POP3 email account and notifies when new mail arrives",
                                      typeof(NotificationPop3),
                                      typeof(EmailEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-mail.png"));

        NotificationRegistry.Register("Background",
                                      "Randomly changes BlinkStick color to create color mood",
                                      typeof(NotificationMood),
                                      typeof(MoodlightEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-moodlight.png"));

        NotificationRegistry.Register("Background",
                                      "Sets color for currently activated application",
                                      typeof(NotificationApplication),
                                      typeof(ApplicationEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-application.png"));

        NotificationRegistry.Register("Hardware",
                                      "Displays a notification when CPU usage is above limit",
                                      typeof(NotificationCpu),
                                      typeof(CpuEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-cpu.png"));

        NotificationRegistry.Register("Hardware",
                                      "Displays a notification when RAM usage is above limit",
                                      typeof(NotificationRam),
                                      typeof(CpuEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-ram.png"));

        NotificationRegistry.Register("Hardware",
                                      "Displays a notification when battery charge drops below certain limit",
                                      typeof(NotificationBattery),
                                      typeof(CpuEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-battery.png"));

        NotificationRegistry.Register("Hardware",
                                      "Displays a notification when available disk space drops below certain limit",
                                      typeof(NotificationDiskSpace),
                                      typeof(DiskSpaceEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-hdd.png"));

        NotificationRegistry.Register("Hardware",
                                      "Activate pattern when keyboard key combination is pressed",
                                      typeof(NotificationKeyboard),
                                      typeof(KeyboardEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-key.png"));

        NotificationRegistry.Register("Services",
                                      "Creates a remote control server accessible via HTTP.",
                                      typeof(NotificationRemoteControl),
                                      typeof(RemoteControlEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-remote-control.png"));

        NotificationRegistry.Register("Services",
                                      "Creates an MQTT server which allows remote control of connected BlinkStick devices via MQTT protocol.",
                                      typeof(NotificationMqtt),
                                      null);

        NotificationRegistry.Register("Services",
                                      "Connects to www.blinkstick.com and allows remote control of a BlinkStick device",
                                      typeof(NotificationBlinkStickDotCom),
                                      typeof(BlinkStickDotComEditorWidget),
                                      Gdk.Pixbuf.LoadFromResource("BlinkStickClient.Resources.notifications.notification-blinkstickdotcom.png"));

        NotificationRegistry.Register("Services",
                                      "Connects to IFTTT and allows remote control of a BlinkStick device",
                                      typeof(NotificationIfttt),
                                      null);

        if (ApplicationSettings.SingleBlinkStickMode)
        {
            overviewWidget = new OverviewSingleWidget();
            hbox1.PackEnd(overviewWidget, true, true, 0);
            Pages.Add(overviewWidget);
            VisiblePage = overviewWidget;
        }
        else
        {
            overviewWidget = new OverviewWidget();
            hbox1.PackEnd(overviewWidget, true, true, 0);
            Pages.Add(overviewWidget);
            VisiblePage = overviewWidget;
        }

        notificationsWidget                     = new NotificationsWidget();
        notificationsWidget.ParentForm          = this;
        notificationsWidget.DataModel           = DataModel;
        notificationsWidget.ApplicationSettings = this.ApplicationSettings;
        notificationsWidget.Initialize();
        hbox1.PackEnd(notificationsWidget, true, true, 0);
        Pages.Add(notificationsWidget);

        PatternEditorWidget patternEditorWidget = new PatternEditorWidget();
        patternEditorWidget.DataModel = this.DataModel;
        hbox1.PackEnd(patternEditorWidget, true, true, 0);
        Pages.Add(patternEditorWidget);

        eventsWidget           = new EventsWidget();
        eventsWidget.DataModel = this.DataModel;
        hbox1.PackEnd(eventsWidget, true, true, 0);
        Pages.Add(eventsWidget);

        SettingsWidget settingsWidget = new SettingsWidget();
        settingsWidget.LoadSettings(ApplicationSettings);
        hbox1.PackEnd(settingsWidget, true, true, 0);
        Pages.Add(settingsWidget);

        HelpWidget helpWidget = new HelpWidget();
        hbox1.PackEnd(helpWidget, true, true, 0);
        Pages.Add(helpWidget);

        if (overviewWidget is OverviewWidget)
        {
            ((OverviewWidget)overviewWidget).DataModel = this.DataModel;
        }
        else
        {
            ((OverviewSingleWidget)overviewWidget).DataModel           = this.DataModel;
            ((OverviewSingleWidget)overviewWidget).ApplicationSettings = this.ApplicationSettings;
            ((OverviewSingleWidget)overviewWidget).UpdateUI();
        }
        notificationsWidget.DataModel           = this.DataModel;
        notificationsWidget.ApplicationSettings = this.ApplicationSettings;

        RefreshDevices();

        notificationService           = new NotificationService();
        notificationService.DataModel = this.DataModel;
        notificationService.Start();

        log.Debug("Initialization done");
    }
 public NotificationRegistryTests()
 {
     _services = new ContainerBuilder();
     _registry = new NotificationRegistry <TestNotification>(_services);
 }
        public void Initialize()
        {
            log.Debug("Setting up treeview");

            Gtk.TreeViewColumn enabledColumn = new Gtk.TreeViewColumn();
            enabledColumn.Title = "";

            Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
            nameColumn.Title = "Name";

            Gtk.TreeViewColumn blinkStickColumn = new Gtk.TreeViewColumn();
            blinkStickColumn.Title = "BlinkStick";

            Gtk.TreeViewColumn patternColumn = new Gtk.TreeViewColumn();
            patternColumn.Title = "Pattern";

            Gtk.CellRendererPixbuf enabledCell    = new Gtk.CellRendererPixbuf();
            Gtk.CellRendererText   nameCell       = new Gtk.CellRendererText();
            Gtk.CellRendererText   typeCell       = new Gtk.CellRendererText();
            Gtk.CellRendererText   blinkStickCell = new Gtk.CellRendererText();
            Gtk.CellRendererText   patternCell    = new Gtk.CellRendererText();

            CellRendererPixbuf iconCell = new CellRendererPixbuf();

            nameColumn.PackStart(iconCell, false);
            nameColumn.AddAttribute(iconCell, "pixbuf", 4);

            enabledColumn.PackEnd(enabledCell, false);
            blinkStickColumn.PackEnd(blinkStickCell, false);
            nameColumn.PackEnd(nameCell, true);
            patternColumn.PackEnd(patternCell, false);

            enabledColumn.SetCellDataFunc(enabledCell, new Gtk.TreeCellDataFunc(RenderEnabledCell));
            nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderNameCell));
            blinkStickColumn.SetCellDataFunc(blinkStickCell, new Gtk.TreeCellDataFunc(RenderBlinkStickCell));
            patternColumn.SetCellDataFunc(patternCell, new Gtk.TreeCellDataFunc(RenderPatternCell));

            treeviewEvents.AppendColumn(enabledColumn);

            treeviewEvents.AppendColumn(nameColumn);
            treeviewEvents.Columns[1].Expand = true;
            treeviewEvents.AppendColumn(patternColumn);

            if (this.ApplicationSettings.SingleBlinkStickMode)
            {
                DeleteColumnIndex = 5;
            }
            else
            {
                treeviewEvents.AppendColumn(blinkStickColumn);
                DeleteColumnIndex = 6;
            }

            treeviewEvents.AppendColumn("", new Gtk.CellRendererPixbuf(), "stock_id", 1);
            treeviewEvents.AppendColumn("", new Gtk.CellRendererPixbuf(), "stock_id", 2);
            treeviewEvents.AppendColumn("", new Gtk.CellRendererPixbuf(), "stock_id", 3);
            NotificationListStore.SetSortFunc(0, delegate(TreeModel model, TreeIter a, TreeIter b)
            {
                CustomNotification n1 = (CustomNotification)model.GetValue(a, 0);
                CustomNotification n2 = (CustomNotification)model.GetValue(b, 0);
                if (n1 == null || n2 == null)
                {
                    return(0);
                }
                return(String.Compare(n1.Name, n2.Name));
            });

            NotificationListStore.SetSortColumnId(1, SortType.Ascending);
            treeviewEvents.Model = NotificationListStore;

            log.Debug("Adding notifications to the tree");
            foreach (CustomNotification e in DataModel.Notifications)
            {
                NotificationListStore.AppendValues(e, "icon-dark-pencil-square-o", "icon-dark-clone", "icon-dark-trash", NotificationRegistry.FindIcon(e.GetType()));
            }
        }
        protected void OnButtonAddNotificationClicked(object sender, EventArgs e)
        {
            int response;

            Type notificationType = typeof(CustomNotification);

            using (SelectNotificationDialog dialog = new SelectNotificationDialog())
            {
                dialog.DataModel = this.DataModel;
                response         = dialog.Run();
                if (response == (int)ResponseType.Ok)
                {
                    notificationType = dialog.SelectedType.NotificationType;
                }
                dialog.Destroy();
            }

            if (response == (int)ResponseType.Ok)
            {
                CustomNotification notification = (CustomNotification)Activator.CreateInstance(notificationType);
                notification.Name = DataModel.GetNotificationName(notification.GetTypeName());

                if (EditNotification(notification, "New Notification"))
                {
                    NotificationListStore.AppendValues(notification, "icon-dark-pencil-square-o", "icon-dark-clone", "icon-dark-trash", NotificationRegistry.FindIcon(notification.GetType()));
                    DataModel.Notifications.Add(notification);
                    DataModel.Save();

                    SelectNotificationInTree(notification);
                }
            }
        }
        protected void OnTreeviewEventsCursorChanged(object sender, EventArgs e)
        {
            if (ignoreNexClick)
            {
                ignoreNexClick = false;
                return;
            }

            TreeModel model;
            TreeIter  iter;

            TreeSelection selection = (sender as TreeView).Selection;

            if (selection.GetSelected(out model, out iter))
            {
                SelectedNotification = (CustomNotification)model.GetValue(iter, 0);

                TreePath       path;
                TreeViewColumn column;
                (sender as TreeView).GetCursor(out path, out column);

                if (column == (sender as TreeView).Columns[DeleteColumnIndex]) //Delete clicked
                {
                    if (MainWindow.ConfirmDelete())
                    {
                        ignoreNexClick = true;
                        DataModel.Notifications.Remove(SelectedNotification);
                        NotificationListStore.Remove(ref iter);
                        DataModel.Save();
                    }
                }
                else if (column == (sender as TreeView).Columns[DeleteColumnIndex - 1]) //Copy clicked
                {
                    if (SelectedNotification.IsUnique())
                    {
                        MessageBox.Show(ParentForm, String.Format("Only one {0} notification can be used", SelectedNotification.GetTypeName()), MessageType.Error);
                        return;
                    }

                    CustomNotification notification = SelectedNotification.Copy();
                    notification.Name = DataModel.GetNotificationName(SelectedNotification.Name, 2);

                    if (EditNotification(notification, "Copy Notification"))
                    {
                        NotificationListStore.AppendValues(notification, "icon-dark-pencil-square-o", "icon-dark-clone", "icon-dark-trash", NotificationRegistry.FindIcon(notification.GetType()));
                        DataModel.Notifications.Add(notification);
                        ignoreNexClick = true;
                        SelectNotificationInTree(notification);
                    }
                }
                else if (column == (sender as TreeView).Columns[DeleteColumnIndex - 2]) //Edit clicked
                {
                    EditNotification();
                }
                else if (column == (sender as TreeView).Columns[0]) //Enabled-Disabled clicked
                {
                    SelectedNotification.Enabled = !SelectedNotification.Enabled;
                    DataModel.Save();
                    DataModel.Notifications.NotifyUpdate(SelectedNotification);
                }
            }
        }
        private void ObjectToControls()
        {
            IgnoreComponentChange = true;

            checkbuttonEnabled.Active = Notification.Enabled;
            entryName.Text            = Notification.Name;

            if (Notification is PatternNotification && (Notification as PatternNotification).PatterConfigurable)
            {
                LoadPatterns((Notification as PatternNotification).Pattern);
            }
            else
            {
                table2.Remove(labelPattern);
                table2.Remove(comboboxPattern);
                table2.Remove(buttonEditPatterns);

                if (Notification is DeviceNotification)
                {
                    table2.NRows -= 1;
                }
            }

            if (Notification is DeviceNotification)
            {
                if (((DeviceNotification)Notification).BlinkStickSerial == "" || ((DeviceNotification)Notification).BlinkStickSerial == null)
                {
                    if (this.DataModel.Devices.Count == 1)
                    {
                        deviceComboboxWidget.SelectBySerial(this.DataModel.Devices[0].Serial);
                    }
                }
                else
                {
                    deviceComboboxWidget.SelectBySerial(((DeviceNotification)Notification).BlinkStickSerial);
                }

                spinbuttonLedsFrom.Value = ((DeviceNotification)Notification).LedFirstIndex;
                spinbuttonLedsTo.Value   = ((DeviceNotification)Notification).LedLastIndex;
                comboboxChannel.Active   = ((DeviceNotification)Notification).LedChannel;
            }
            else
            {
                table2.Remove(labelBlinkStick);
                table2.Remove(deviceComboboxWidget);
                table2.Remove(labelLeds);
                table2.Remove(hboxLedConfiguration);
                table2.Remove(labelChannel);
                table2.Remove(hboxChannel);
                table2.NRows -= 4;
            }

            HSeparator hseparator;

            Type editorType = NotificationRegistry.FindEditorType(Notification.GetType());

            object editorWidgetObject = null;

            if (editorType != null)
            {
                editorWidgetObject = Activator.CreateInstance(editorType);
            }

            if (editorWidgetObject != null && editorWidgetObject is Widget)
            {
                Widget editorWidget = (Widget)editorWidgetObject;

                hseparator = new HSeparator();
                vbox3.PackEnd(hseparator);
                hseparator.ShowAll();

                if (editorWidget is IEditorInterface)
                {
                    editorInterface = (editorWidget as IEditorInterface);
                    editorInterface.SetNotification(Notification);
                }

                vbox3.PackEnd(editorWidget, true, true, 0);

                editorWidget.SizeAllocated += (o, args) => {
                    int x, y, w, h, myw, myh;
                    ParentForm.GetPosition(out x, out y);
                    ParentForm.GetSize(out w, out h);

                    GetSize(out myw, out myh);

                    this.GdkWindow.Move(x + (w - myw) / 2, y + (h - myh) / 2);
                };

                editorWidget.ShowAll();
            }

            OnDeviceComboboxWidgetDeviceChanged(null, null);

            hseparator = new HSeparator();
            vbox3.PackEnd(hseparator);
            hseparator.ShowAll();

            deviceComboboxWidget.Sensitive = this.ApplicationSettings.AllowModeChange;

            IgnoreComponentChange = false;
        }
 public NotificationRegistryTests()
 {
     _services = new Mock<IServiceCollection>();
     _registry = new NotificationRegistry<TestNotification>(_services.Object);
 }
 public NotificationRegistryTests()
 {
     _registry = new NotificationRegistry();
 }