Ejemplo n.º 1
0
        public ControlPanel(PluginMain pluginMain, PluginConfig config)
        {
            InitializeComponent();
            tableLayoutPanel0.PerformLayout();
            splitContainer1.SplitterDistance = splitContainer1.Height - 180;

            this.pluginMain = pluginMain;
            this.config     = config;

            this.checkBoxFollowLog.Checked = this.config.FollowLatestLog;

            generalTab = new ConfigTabPage
            {
                Name = Resources.GeneralTab,
                Text = "",
            };
            generalTab.Controls.Add(new GeneralConfigTab());

            eventTab = new ConfigTabPage
            {
                Name = Resources.EventConfigTab,
                Text = "",
            };
            eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel());

            PluginMain.Logger.RegisterListener(AddLogEntry);
            Registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e)));
        }
Ejemplo n.º 2
0
        private void AddConfigTab(IOverlay overlay)
        {
            var label = overlay.GetType().Name;

            if (overlayNames.ContainsKey(label))
            {
                label = overlayNames[label];
            }

            var tabPage = new ConfigTabPage
            {
                Name      = overlay.Name,
                Text      = label,
                IsOverlay = true,
            };

            var control = overlay.CreateConfigControl();

            if (control != null)
            {
                control.Dock      = DockStyle.Fill;
                control.BackColor = SystemColors.ControlLightLight;
                tabPage.Controls.Add(control);

                this.tabControl.TabPages.Add(tabPage);
                ((GeneralConfigTab)_generalTab.Controls[0]).SetReadmeVisible(false);
            }
        }
Ejemplo n.º 3
0
        public ControlPanel(TinyIoCContainer container)
        {
            InitializeComponent();
            tableLayoutPanel0.PerformLayout();
            splitContainer1.SplitterDistance = (int)Math.Round(Height * 0.75);

            _container  = container;
            _logger     = container.Resolve <ILogger>();
            _pluginMain = container.Resolve <PluginMain>();
            _config     = container.Resolve <IPluginConfig>();
            _registry   = container.Resolve <Registry>();

            this.checkBoxFollowLog.Checked = _config.FollowLatestLog;

            _generalTab = new ConfigTabPage
            {
                Name = Resources.GeneralTab,
                Text = "",
            };
            _generalTab.Controls.Add(new GeneralConfigTab(container));

            _eventTab = new ConfigTabPage
            {
                Name = Resources.EventConfigTab,
                Text = "",
            };
            _eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel(container));

            _logger.RegisterListener(AddLogEntry);
            _registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e)));
        }
Ejemplo n.º 4
0
        public ControlPanel(TinyIoCContainer container)
        {
            InitializeComponent();
            tableLayoutPanel0.PerformLayout();
            // Make the log box big until we load the overlays since the log is going to be *very*
            // important if we never make it that far.
            splitContainer1.SplitterDistance = 5;

            _container  = container;
            _logger     = container.Resolve <ILogger>();
            _pluginMain = container.Resolve <PluginMain>();
            _config     = container.Resolve <IPluginConfig>();
            _registry   = container.Resolve <Registry>();

            this.checkBoxFollowLog.Checked = _config.FollowLatestLog;

            _generalTab = new ConfigTabPage
            {
                Name = Resources.GeneralTab,
                Text = "",
            };
            _generalTab.Controls.Add(new GeneralConfigTab(container));

            _eventTab = new ConfigTabPage
            {
                Name = Resources.EventConfigTab,
                Text = "",
            };
            _eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel(container));

            _logger.RegisterListener(AddLogEntry);
            _registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e)));

            Resize += (o, e) =>
            {
                if (!logResized && Height > 500 && tabControl.TabCount > 0)
                {
                    logResized = true;
                    // Overlay tabs have been initialised, everything is fine; make the log small again.
                    splitContainer1.SplitterDistance = (int)Math.Round(Height * 0.75);
                }
            };
        }
Ejemplo n.º 5
0
        private void AddConfigTab(IEventSource source)
        {
            var label = source.GetType().Name;

            if (esNames.ContainsKey(label))
            {
                label = esNames[label];
            }

            var tabPage = new ConfigTabPage
            {
                Name          = source.Name,
                Text          = "",
                IsEventSource = true,
            };

            var control = source.CreateConfigControl();

            if (control != null)
            {
                control.Dock      = DockStyle.Fill;
                control.BackColor = SystemColors.ControlLightLight;
                tabPage.Controls.Add(control);

                var index = 0;
                foreach (var page in this.tabControl.TabPages)
                {
                    if (index == 0 || ((ConfigTabPage)page).IsEventSource)
                    {
                        index++;
                    }
                    else
                    {
                        break;
                    }
                }

                this.tabControl.TabPages.Insert(index, tabPage);
            }
        }