コード例 #1
0
        public RDMPSingleControlTabMenu(IActivateItems activator, RDMPSingleControlTab tab, WindowManager windowManager)
        {
            _tab = tab;
            Items.Add("Close Tab", null, (s, e) => tab.Close());
            Items.Add("Close All Tabs", null, (s, e) => windowManager.CloseAllWindows(tab));
            Items.Add("Close All But This", null, (s, e) => windowManager.CloseAllButThis(tab));

            Items.Add("Show", null, (s, e) => tab.HandleUserRequestingEmphasis(activator));

            if (tab is PersistableSingleDatabaseObjectDockContent single)
            {
                var uiFactory = new AtomicCommandUIFactory(activator);
                var builder   = new GoToCommandFactory(activator);

                var gotoMenu = new ToolStripMenuItem(AtomicCommandFactory.GoTo)
                {
                    Enabled = false
                };
                Items.Add(gotoMenu);

                foreach (var cmd in builder.GetCommands(single.DatabaseObject))
                {
                    gotoMenu.DropDownItems.Add(uiFactory.CreateMenuItem(cmd));
                    gotoMenu.Enabled = true;
                }
                RDMPContextMenuStrip.RegisterFetchGoToObjecstCallback(gotoMenu);
            }

            Items.Add("Refresh", FamFamFamIcons.arrow_refresh, (s, e) => _tab.HandleUserRequestingTabRefresh(activator));

            var help = new ToolStripMenuItem("Help", FamFamFamIcons.help, (s, e) => _tab.ShowHelp(activator));

            help.ShortcutKeys = Keys.F1;
            Items.Add(help);
        }
コード例 #2
0
ファイル: WindowFactory.cs プロジェクト: HicServices/RDMP
        public DockContent Create(IActivateItems activator, Control control, string label, Bitmap image)
        {
            DockContent content = new RDMPSingleControlTab(activator.RefreshBus, control);

            AddControlToDockContent(activator, control, content, label, image);

            _windowManager.AddAdhocWindow(content);

            return(content);
        }
コード例 #3
0
        /// <summary>
        /// Records the fact that a new single object editing tab has been opened.  .
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if another instance of the Control Type is already active with the same DatabaseObject</exception>
        /// <param name="window"></param>
        public void AddWindow(RDMPSingleControlTab window)
        {
            if (window is PersistableSingleDatabaseObjectDockContent singleObjectUI)
            {
                if (AlreadyActive(singleObjectUI.Control.GetType(), singleObjectUI.DatabaseObject))
                {
                    throw new ArgumentOutOfRangeException($"Cannot create another window for object {singleObjectUI.DatabaseObject} of type {singleObjectUI.Control.GetType()} because there is already a window active for that object/window type");
                }
            }

            _trackedWindows.Add(window);

            window.FormClosed += (s, e) => Remove(window);
        }
コード例 #4
0
        public RDMPSingleControlTabMenu(IActivateItems activator, RDMPSingleControlTab tab, WindowManager windowManager)
        {
            _tab = tab;
            Items.Add("Close Tab", null, (s, e) => tab.Close());
            Items.Add("Close All Tabs", null, (s, e) => windowManager.CloseAllWindows(tab));
            Items.Add("Close All But This", null, (s, e) => windowManager.CloseAllButThis(tab));

            Items.Add("Show", null, (s, e) => tab.HandleUserRequestingEmphasis(activator));
            Items.Add("Refresh", FamFamFamIcons.arrow_refresh, (s, e) => _tab.HandleUserRequestingTabRefresh(activator));

            var help = new ToolStripMenuItem("Help", FamFamFamIcons.help, (s, e) => _tab.ShowHelp(activator));

            help.ShortcutKeys = Keys.F1;
            Items.Add(help);
        }
コード例 #5
0
        /// <summary>
        /// Records the fact that a new single object editing tab has been opened.  .
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if another instance of the Control Type is already active with the same DatabaseObject</exception>
        /// <param name="window"></param>
        public void AddWindow(RDMPSingleControlTab window)
        {
            var singleObjectUI = window as PersistableSingleDatabaseObjectDockContent;

            if (singleObjectUI != null)
            {
                if (AlreadyActive(singleObjectUI.GetControl().GetType(), singleObjectUI.DatabaseObject))
                {
                    throw new ArgumentOutOfRangeException("Cannot create another window for object " + singleObjectUI.DatabaseObject + " of type " + singleObjectUI.GetControl().GetType() + " because there is already a window active for that object/window type");
                }
            }

            _trackedWindows.Add(window);

            window.FormClosed += (s, e) => Remove(window);
        }
コード例 #6
0
        /// <summary>
        /// Closes all Tracked windows
        /// </summary>
        /// <param name="tab"></param>
        public void CloseAllWindows(RDMPSingleControlTab tab)
        {
            if (tab != null)
            {
                CloseAllButThis(tab);
                tab.Close();
            }
            else
            {
                foreach (var trackedWindow in _trackedWindows.ToArray())
                {
                    trackedWindow.Close();
                }

                foreach (var adhoc in _trackedAdhocWindows.ToArray())
                {
                    adhoc.Close();
                }
            }
        }
コード例 #7
0
        public RDMPSingleControlTabMenu(IActivateItems activator, RDMPSingleControlTab tab, WindowManager windowManager)
        {
            _tab = tab;
            Items.Add("Close Tab", null, (s, e) => tab.Close());
            Items.Add("Close All Tabs", null, (s, e) => windowManager.CloseAllWindows(tab));
            Items.Add("Close All But This", null, (s, e) => windowManager.CloseAllButThis(tab));

            Items.Add("Show", null, (s, e) => tab.HandleUserRequestingEmphasis(activator));

            if (tab is PersistableSingleDatabaseObjectDockContent single)
            {
                var builder = new GoToMenuBuilder(activator);
                Items.Add(builder.GetMenu(single.DatabaseObject));
            }

            Items.Add("Refresh", FamFamFamIcons.arrow_refresh, (s, e) => _tab.HandleUserRequestingTabRefresh(activator));

            var help = new ToolStripMenuItem("Help", FamFamFamIcons.help, (s, e) => _tab.ShowHelp(activator));

            help.ShortcutKeys = Keys.F1;
            Items.Add(help);
        }
コード例 #8
0
 private void Remove(RDMPSingleControlTab window)
 {
     _trackedWindows.Remove(window);
 }