예제 #1
0
        private static void SetupDockPanel(DockState dockState, SortedDictionary <int, DockState> ZOrderDictionary)
        {
            var settings = ApplicationSettings.GetDockPaneSettings(dockState);

            if (!ZOrderDictionary.Keys.Any(x => x == settings.ZOrderIndex))
            {
                ZOrderDictionary.Add(settings.ZOrderIndex, dockState);
            }
            var         dockWindow       = Globals.Forms.DockPanel.DockWindows[dockState];
            var         contentPanes     = settings.ContentPanes;
            DockContent activatedContent = null;

            if (contentPanes != null && contentPanes.Count > 0)
            {
                foreach (var contentPane in contentPanes)
                {
                    var dockContent = ShowForm(contentPane, dockState);
                    if (contentPane.IsActivated)
                    {
                        activatedContent = dockContent;
                    }
                }
                activatedContent?.Activate();
            }
        }
예제 #2
0
        private void OpenFormMethod(string formName)
        {
            //避免重复打开

            DockContent frm = FindDockContent(formName);

            if (frm != null)
            {
                frm.BringToFront();
                frm.Activate();
                return;
            }

            switch (formName)
            {
            case "FrmCamera1Config":
                new FrmCamera1Config().Show(dockPanel2);
                break;

            case "FrmCamera2Config":
                new FrmCamera2Config().Show(dockPanel2);
                break;

            case "FrmCamera3Config":
                new FrmCamera3Config().Show(dockPanel2);
                break;

            case "FrmCamera4Config":
                new FrmCamera4Config().Show(dockPanel2);
                break;

            default:
                break;
            }
        }
예제 #3
0
        /// <summary>单击事件
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void item_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;

            if (item != null)
            {
                object frm = GetForm(item.Tag.ToString(), item.Name);
                if (frm is DockContent)
                {
                    DockContent itemDockContent = frm as DockContent;
                    itemDockContent.Text = item.Text;
                    IDockContent iDockContent = FindDocument(itemDockContent.Text);
                    if (iDockContent == null)
                    {
                        itemDockContent.Show(dockPanel1);
                    }
                    else
                    {
                        itemDockContent.Activate();
                    }
                }
                else
                {
                    Form frmother = frm as Form;
                    frmother.ShowDialog();
                }
            }
        }
예제 #4
0
        public DockContent Show(Type type, params object[] args)
        {
            DockContent form = null;

            if (formContainer.ContainsKey(type))
            {
                form = formContainer[type];
            }
            if (form != null && form.IsDisposed)
            {
                formContainer.Remove(type);
                form = null;
            }

            if (form == null)
            {
                form = (DockContent)Activator.CreateInstance(type, args);
                formContainer.Add(type, form);
                form.Show(this.mainDockPanel);
            }
            else if (!form.Visible)
            {
                form.Show();
            }
            else
            {
                form.Activate();
            }

            return(form);
        }
        public static void EnsureVisible(this DockContent form, DockPanel parent, DockState defaultState)
        {
            switch (form.DockState)
            {
            case DockState.Unknown:
            case DockState.Hidden:
                form.Show(parent, defaultState);
                break;

            case DockState.DockBottomAutoHide:
                form.DockState = DockState.DockBottom;
                break;

            case DockState.DockTopAutoHide:
                form.DockState = DockState.DockTop;
                break;

            case DockState.DockLeftAutoHide:
                form.DockState = DockState.DockLeft;
                break;

            case DockState.DockRightAutoHide:
                form.DockState = DockState.DockRight;
                break;
            }
            form.Activate();
        }
예제 #6
0
        /// <summary>
        /// Shows the content.
        /// </summary>
        /// <param name="vc">The view content.</param>
        internal void ShowContent(IViewContent vc)
        {
            DockContent content = new DockContent();

            content.TabText            = vc.Title;
            content.Text               = vc.Title;
            content.ToolTipText        = vc.Description;
            content.CloseButton        = vc.AllowUserClose;
            content.CloseButtonVisible = vc.AllowUserClose;
            content.Tag = vc;
            var icon = vc.ViewIcon;

            if (icon != null)
            {
                content.Icon     = icon;
                content.ShowIcon = true;
            }

            if (vc.IsExclusiveToDocumentRegion)
            {
                content.DockAreas = DockAreas.Document;
            }
            else
            {
                content.DockAreas = (DockAreas)(vc.DefaultRegion);
            }
            vc.SetParentForm(content);
            vc.ViewContentActivating += (sender, e) =>
            {
                content.Activate();
            };
            vc.TitleChanged += (sender, e) =>
            {
                content.TabText = vc.Title;
                content.Text    = vc.Title;
            };
            vc.DescriptionChanged += (sender, e) =>
            {
                content.ToolTipText = vc.Description;
            };
            if (vc.AllowUserClose && vc.IsExclusiveToDocumentRegion)
            {
                content.TabPageContextMenuStrip = documentTabContextMenu;
            }

            content.ClientSize     = vc.ContentControl.Size;
            vc.ContentControl.Dock = DockStyle.Fill;
            content.Controls.Add(vc.ContentControl);

            if (vc.IsModalWindow && vc.DefaultRegion == ViewRegion.Floating)
            {
                content.StartPosition = FormStartPosition.CenterParent;
                content.ShowDialog();
            }
            else
            {
                content.Show(contentPanel);
            }
        }
예제 #7
0
 public void ParentChart_OnActivated(object sender, EventArgs e)
 {
     foreach (Reporter reporterToPopup in this.ReporterShortNamesUserInvoked.Values)
     {
         DockContent form = reporterToPopup.Parent as DockContent;
         form.Activate();
     }
 }
예제 #8
0
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            DockContent databaseInspector = Services.Resolve <IDatabaseInspector>() as DockContent;

            if (databaseInspector != null)
            {
                HostWindow.ShowDatabaseInspector(databaseInspector as IDatabaseInspector, DockState.DockLeft);
                databaseInspector.Activate();
            }
        }
예제 #9
0
        /// <summary>
        /// Initializes the default docking layout.
        /// </summary>
        private void InitializeDefaultLayout()
        {
            mLogWindow?.Show(LogDockPanel, DockState.Document);
            mLogScript?.Show(LogDockPanel, DockState.Document);
            mMessageDetails?.Show(LogDockPanel, DockState.DockBottom);
            mBookmarks?.Show(LogDockPanel, DockState.DockBottom);
            mFilter?.Show(LogDockPanel, DockState.DockBottom);
            mLogStatistic?.Show(LogDockPanel, DockState.DockBottom);
            mLoggerTree?.Show(LogDockPanel, DockState.DockRight);

            mMessageDetails?.Activate();
        }
 private void ActivateDockWindow(DockContent window)
 {
     if (!window.IsActivated)
     {
         if (window.DockPanel == null)
         {
             window.Show(this.dockPanel);
         }
         window.PanelPane.Activate();
         window.Activate();
     }
 }
예제 #11
0
 private void OpenFloatingOrActivate(DockContent view)
 {
     if ((view.DockAreas & DockAreas.Float) > 0 && !view.Created)
     {
         Size viewSize = new Size(view.Bounds.Size.Width, view.Bounds.Size.Height);
         view.Show(dockPanel, DockState.Float);
         view.FloatPane.FloatWindow.Size = viewSize;
     }
     else
     {
         view.Activate();
     }
 }
예제 #12
0
파일: MainForm.cs 프로젝트: 524300045/pc
        private void tsbPrePack_Click(object sender, EventArgs e)
        {
            DockContent fx = FindCurrentForm("PrePackageForm");

            if (fx == null)
            {
                AddToFrame(new PrePackageForm());
            }
            else
            {
                fx.Activate();
            }
        }
예제 #13
0
파일: MainForm.cs 프로젝트: 524300045/pc
        private void tsbBox_Click(object sender, EventArgs e)
        {
            DockContent fx = FindCurrentForm("BoxPrintForm");

            if (fx == null)
            {
                AddToFrame(new BoxPrintForm());
            }
            else
            {
                fx.Activate();
            }
        }
예제 #14
0
파일: MainForm.cs 프로젝트: 524300045/pc
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            DockContent fx = FindCurrentForm("PackageTaskForm");

            if (fx == null)
            {
                AddToFrame(new PackageTaskForm());
            }
            else
            {
                fx.Activate();
            }
        }
예제 #15
0
 private void InitNumbersControlPanel()
 {
     if (_numberDockContent != null)
     {
         _numberDockContent.Activate();
         return;
     }
     _numberDockContent            = new DockContent();
     _numbersControlPanelView.Dock = DockStyle.Fill;
     _numberDockContent.Controls.Add(_numbersControlPanelView);
     _numberDockContent.Show(_dockPanel, DockState.DockRightAutoHide);
     _numberDockContent.Text        = "Numbers Control Panel";
     _numberDockContent.HideOnClose = true;
 }
예제 #16
0
        public static void ShowAndActivate(this DockContent content, DockPanel dockPanel)
        {
            content.Show(dockPanel);

            if (content.DockState == DockState.DockBottomAutoHide ||
                content.DockState == DockState.DockLeftAutoHide ||
                content.DockState == DockState.DockRightAutoHide ||
                content.DockState == DockState.DockTopAutoHide)
            {
                dockPanel.ActiveAutoHideContent = content;
            }

            content.Activate();
        }
예제 #17
0
 private void InitFractalDataGrid()
 {
     if (_dataGridDockContent != null)
     {
         _dataGridDockContent.Activate();
         return;
     }
     _dataGridDockContent      = new DockContent();
     _fractalDataGridView.Dock = DockStyle.Fill;
     _dataGridDockContent.Controls.Add(_fractalDataGridView);
     _dataGridDockContent.Show(_dockPanel, DockState.DockLeftAutoHide);
     _dataGridDockContent.Text        = "Fractal Data Grid";
     _dataGridDockContent.HideOnClose = true;
 }
예제 #18
0
 private void InitFractalEditor()
 {
     if (_editorDockContent != null)
     {
         _editorDockContent.Activate();
         return;
     }
     _editorDockContent      = new DockContent();
     _fractalEditorView.Dock = DockStyle.Fill;
     _editorDockContent.Controls.Add(_fractalEditorView);
     _editorDockContent.Show(_dockPanel, DockState.DockRightAutoHide);
     _editorDockContent.Text        = "Fractal Transformations Editor";
     _editorDockContent.HideOnClose = true;
 }
예제 #19
0
        private void ShowOptionsView()
        {
            if (optionsView == null)
            {
                OptionsView view = new OptionsView(options.ToArray(), new PropertyGrid());
                view.Closed += view_Closed;

                optionsView = view;
                hostServices.Show(optionsView, DockState.Document);
            }
            else
            {
                optionsView.Activate();
            }
        }
예제 #20
0
        /// <summary>
        /// Displays the HomeUI tab or brings it to the front if it is already open
        /// </summary>
        public void PopHome()
        {
            if (_home == null)
            {
                _home = new HomeUI(this.ActivateItems);

                _homeContent         = _windowFactory.Create(ActivateItems, _home, "Home", FamFamFamIcons.application_home);
                _homeContent.Closed += (s, e) => _home = null;
                _homeContent.Show(_mainDockPanel, DockState.Document);
            }
            else
            {
                _homeContent.Activate();
            }
        }
예제 #21
0
 /// <summary>
 /// Shows the panel
 /// </summary>
 private void AutoShowPanel(Object sender, System.EventArgs e)
 {
     this.autoShow.Stop();
     if (this.entriesView.Items.Count > 0)
     {
         DockContent panel = this.Parent as DockContent;
         DockState   ds    = panel.VisibleState;
         if (!panel.Visible || ds.ToString().EndsWithOrdinal("AutoHide"))
         {
             panel.Show();
             if (ds.ToString().EndsWithOrdinal("AutoHide"))
             {
                 panel.Activate();
             }
         }
     }
 }
예제 #22
0
 /// <summary>
 /// Shows the panel
 /// </summary>
 private void AutoShowPanel(Object sender, System.EventArgs e)
 {
     this.autoShow.Stop();
     if (this.textLog.TextLength > 0)
     {
         DockContent panel = this.Parent as DockContent;
         DockState   ds    = panel.VisibleState;
         if (!panel.Visible || ds.ToString().EndsWith("AutoHide"))
         {
             panel.Show();
             if (ds.ToString().EndsWith("AutoHide"))
             {
                 panel.Activate();
             }
         }
     }
 }
예제 #23
0
        /// <summary>
        /// 显示导航菜单对应的功能模块
        /// </summary>
        public void ShowModule()
        {
            DockContent dc = GetAlreadyAdded();

            if (dc != null)
            {
                if (dc.IsHidden)
                {
                    dc.Activate();
                }
            }
            else
            {
                Content.Tag = ID;
                Content.Show(parent, DockState.Document);
            }
        }
예제 #24
0
        /// <summary>
        /// </summary>
        /// <param name="Content"></param>
        private void ShowContent(DockContent Content, DockState DefaultDockState)
        {
            if (Content.DockState == DockState.Unknown)
            {
                Content.Show(DockPanel, DefaultDockState);
            }

            Content.Show();
            if (Content.DockState == DockState.DockLeftAutoHide ||
                Content.DockState == DockState.DockRightAutoHide ||
                Content.DockState == DockState.DockTopAutoHide ||
                Content.DockState == DockState.DockBottomAutoHide)
            {
                DockPanel.ActiveAutoHideContent = Content;
            }

            Content.Activate();
        }
예제 #25
0
        public void SelectContent(Form frm)
        {
            DockContent dockableForm = frm as DockContent;

            if (dockableForm == null ||
                Program.MainForm == null ||
                Program.MainForm.DockPanel == null ||
                !Program.MainForm.DockPanel.Contents.Contains(dockableForm)
                )
            {
                frm.Show();
                return;
            }

            if (Program.MainForm.DockPanel.Contents.Contains(dockableForm))
            {
                dockableForm.Activate();
            }
        }
예제 #26
0
        /// <summary>The main form_ shown.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void MainForm_Shown(object sender, EventArgs e)
        {
            _services.InitializePlugIns();
            DockContent dbInspectorForm = _dbInspector as DockContent;

            if (dbInspectorForm != null)
            {
                // the activate for "DockContent" is different to that of "Form".
                dbInspectorForm.Activate();
            }

            _initialized = true;
            SetPointerState(Cursors.Default);
            SetStatus(null, string.Empty);

            // now check for command line args that are "command type names"
            if (_arguements != null && _arguements.Length > 0)
            {
                foreach (string arg in _arguements)
                {
                    if (arg.StartsWith("/cmd:"))
                    {
                        string   cmdName = arg.Substring(5);
                        ICommand cmd     = CommandManager.GetCommandInstanceByPartialName(cmdName);
                        if (cmd != null)
                        {
                            cmd.Execute();
                        }
                    }
                }
            }
            else
            {
                CommandManager.GetCommandInstance <NewQueryFormCommand>().Execute();
            }
        }
예제 #27
0
 internal void SelectContent(DockContent dc, bool Activate)
 {
     dc.Activate();
 }
예제 #28
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            using (new WaitCursor(Cursors.Default, Settings.Default.WaitCursorTimeout))
            {
                try
                {
                    if (mLogProvider != null && ModifierKeys != Keys.Shift)
                    {
                        string previousLayout = mLogProvider.LoadLayout();

                        if (!string.IsNullOrEmpty(previousLayout))
                        {
                            using (MemoryStream memStream = new MemoryStream(Encoding.UTF8.GetBytes(previousLayout)))
                            {
                                LogDockPanel.LoadFromXml(
                                    memStream
                                    , GetContentFromPersistString);
                            }
                        }
                        else
                        {
                            InitializeDefaultLayout();
                        }
                    }
                    else
                    {
                        InitializeDefaultLayout();
                    }

                    tsbShowMessageDetails.Checked = mMessageDetails != null && !mMessageDetails.IsHidden;
                    tsbShowLoggerTree.Checked     = mLoggerTree != null && !mLoggerTree.IsHidden;
                    tsbShowBookmarks.Checked      = mBookmarks != null && !mBookmarks.IsHidden;
                    tsbShowFilter.Checked         = mFilter != null && !mFilter.IsHidden;
                    tsbShowStatistic.Checked      = mLogStatistic != null && !mLogStatistic.IsHidden;

                    if (mLogProvider != null)
                    {
                        mLogProvider.Initialize(this);

                        tsbShowTrace.Available = (mLogProvider.SupportedLevels & LogLevel.Trace) != 0;
                        tsbShowDebug.Available = (mLogProvider.SupportedLevels & LogLevel.Debug) != 0;
                        tsbShowInfo.Available  = (mLogProvider.SupportedLevels & LogLevel.Info) != 0;
                        tsbShowWarn.Available  = (mLogProvider.SupportedLevels & LogLevel.Warning) != 0;
                        tsbShowError.Available = (mLogProvider.SupportedLevels & LogLevel.Error) != 0;
                        tsbShowFatal.Available = (mLogProvider.SupportedLevels & LogLevel.Fatal) != 0;

                        if (mLogProvider.SupportedLevels == LogLevel.None)
                        {
                            tslLogLevel.Available = false;
                            tssLogLevel.Available = false;

                            tsbStartPause.Margin = new Padding(
                                SystemInformation.Border3DSize.Width
                                , tsbStartPause.Margin.Top
                                , tsbStartPause.Margin.Right
                                , tsbStartPause.Margin.Bottom);
                        }

                        tsbReload.Available = mLogProvider.SupportsReload;
                    }
                }
                finally
                {
                    // Register the main document as a filter provider.
                    ((ILogFilterHandler)mLogWindow).RegisterFilterProvider(this);

                    // Set the initial focus to the log window.
                    mLogWindow.Activate();
                }
            }
        }
예제 #29
0
 public void Activate()
 {
     _dockContent.Activate();
 }
예제 #30
0
        private void tsTop_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
            case "tsbNewHttpRequest":

                DockContent content = FindFormType(typeof(HttpRequestTestList));

                if (content == null)
                {
                    HttpRequestTestList httpRequestTest = new HttpRequestTestList();

                    httpRequestTest.Show(this.dpnlMain);
                }
                else
                {
                    content.Activate();
                }



                break;


            case "tsbHttpBatchSender":

                DockContent tsbHttpBatchSendercontent = FindFormType(typeof(HttpBatchSender));

                if (tsbHttpBatchSendercontent == null)
                {
                    HttpBatchSender httpRequestTest = new HttpBatchSender();

                    httpRequestTest.Show(this.dpnlMain);
                }
                else
                {
                    tsbHttpBatchSendercontent.Activate();
                }



                break;

            case "tsbSendTestdata":

                DockContent tsbfrmTestSender = FindFormType(typeof(frmTestSender));

                if (tsbfrmTestSender == null)
                {
                    frmTestSender httpRequestTest = new frmTestSender();

                    httpRequestTest.Show(this.dpnlMain);
                }
                else
                {
                    tsbfrmTestSender.Activate();
                }



                break;

            case "tsbLoadPhoneData":

                DockContent tsbLoadPhoneDatadDock = FindFormType(typeof(FrmLoadPhoneData));

                if (tsbLoadPhoneDatadDock == null)
                {
                    if (ofdLoadPhoneText.ShowDialog() == DialogResult.OK)
                    {
                        FrmLoadPhoneData frmLoadPhoneData = new FrmLoadPhoneData();

                        frmLoadPhoneData.Show(this.dpnlMain);

                        frmLoadPhoneData.LoadText(ofdLoadPhoneText.FileName);
                    }
                }
                else
                {
                    tsbLoadPhoneDatadDock.Activate();
                }

                break;

            case "tsbSycnDataToNoSQL":

                DockContent tsbSycnDataToNoSQLDock = FindFormType(typeof(FrmPhoneDataToNoSQL));

                if (tsbSycnDataToNoSQLDock == null)
                {
                    FrmPhoneDataToNoSQL frmLoadPhoneData = new FrmPhoneDataToNoSQL();

                    frmLoadPhoneData.Show(this.dpnlMain);
                }
                else
                {
                    tsbSycnDataToNoSQLDock.Activate();
                }

                break;
            }
        }