Пример #1
0
        private void AddControlToDockContent(IActivateItems activator, Control control, DockContent content, string label, Bitmap image)
        {
            control.Dock = DockStyle.Fill;
            content.Controls.Add(control);
            content.TabText = label;

            if (image != null)
            {
                content.Icon = _iconFactory.GetIcon(image);
            }

            var consult = control as IConsultableBeforeClosing;

            if (consult != null)
            {
                content.FormClosing += consult.ConsultAboutClosing;
            }

            content.KeyPreview = true;

            var tab = content as RDMPSingleControlTab;

            if (tab != null)
            {
                content.TabPageContextMenuStrip = new RDMPSingleControlTabMenu(activator, tab, _windowManager);
            }
        }
Пример #2
0
        private void AddControlToDockContent(IActivateItems activator, Control control, DockContent content, string label, Bitmap image)
        {
            control.Dock = DockStyle.Fill;
            content.Controls.Add(control);
            content.TabText = label;

            if (image != null)
            {
                content.Icon = _iconFactory.GetIcon(image);
            }

            if (control is IConsultableBeforeClosing consult)
            {
                content.FormClosing += consult.ConsultAboutClosing;
            }

            if (control is ISaveableUI saveable)
            {
                content.FormClosing += (s, e) => saveable.GetObjectSaverButton()?.CheckForUnsavedChangesAnOfferToSave();
            }

            content.KeyPreview = true;

            if (content is RDMPSingleControlTab tab)
            {
                content.TabPageContextMenuStrip = new RDMPSingleControlTabMenu(activator, tab, _windowManager);

                //Create handler for AfterPublish
                RefreshObjectEventHandler handler = null;
                handler = (s, e) =>
                {
                    // After global changes, rebuild the context menu

                    if (!content.IsDisposed)
                    {
                        content.TabPageContextMenuStrip = new RDMPSingleControlTabMenu(activator, tab, _windowManager);
                    }
                    else
                    if (handler != null)
                    {
                        activator.RefreshBus.AfterPublish -= handler;     //don't leak handlers
                    }
                };

                //register the event handler
                activator.RefreshBus.AfterPublish += handler;
            }
        }
Пример #3
0
        //Constructor
        public StartupUI(Startup startup)
        {
            _startup = startup;

            InitializeComponent();

            if (_startup == null)
            {
                return;
            }

            Text = "RDMP - v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            _startup.DatabaseFound      += StartupDatabaseFound;
            _startup.MEFFileDownloaded  += StartupMEFFileDownloaded;
            _startup.PluginPatcherFound += StartupPluginPatcherFound;

            pbDisconnected.Image = CatalogueIcons.ExternalDatabaseServer;

            var icon = new IconFactory();

            this.Icon = icon.GetIcon(CatalogueIcons.Main);
        }
Пример #4
0
        private void ApplyTheme(WideMessageBoxTheme theme)
        {
            switch (theme)
            {
            case WideMessageBoxTheme.Exception:
                pbIcon.Image = Images.ErrorIcon;
                break;

            case WideMessageBoxTheme.Warning:
                pbIcon.Image = Images.WarningIcon;
                break;

            case WideMessageBoxTheme.Help:
                pbIcon.Image = Images.InformationIcon;
                break;

            default:
                throw new ArgumentOutOfRangeException("theme");
            }

            var f = new IconFactory();

            Icon = f.GetIcon((Bitmap)pbIcon.Image);
        }