/// <summary> /// Creates an editor of the given type, or if one is already open, brings it to focus /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public virtual T OpenEditor <T>() where T : IEditor { Console.WriteLine("Opening a " + typeof(T).Name + " for document " + Name); T Editor = (T)AttachedEditors.FirstOrDefault(x => x.GetType() == typeof(T)); if (Editor != null) { DockableForm form = Editor as DockableForm; if (form != null) { //Bring this form to the forefront in the docking area it is already at. form.Show(MainForm.PrimaryDockingPanel, form.DockState); } return(Editor); } //Create the new editor Editor = (T)typeof(T).GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); Editor.ActiveDocument = this; OnDocumentEdited += Editor.NotifyDocumentModified; OnDocumentSaved += Editor.NotifyDocumentSaved; AttachedEditors.Add(Editor); return(Editor); }
public MainForm() { InitializeComponent(); // Set main form as MDI container to hold several forms this.IsMdiContainer = true; this.splitContainer1.SplitterDistance = this.Width / 2; // Create checking form mCheckingForm_O = new DockableForm(this); mCheckingForm_O.DockWindow(); mCheckingForm_O.SetFrameTitle("Checking"); this.splitContainer1.Panel1.Controls.Add(mCheckingForm_O); mCheckingForm_O.Show(); // Create job form mJobForm_O = new DockableForm(this); mJobForm_O.DockWindow(); mJobForm_O.SetFrameTitle("Jobs"); this.splitContainer1.Panel2.Controls.Add(mJobForm_O); mJobForm_O.Show(); // Set toolstrip renderer toolStrip1.Renderer = new BorderlessToolStripRenderer(); }
/// <summary> /// 文本 /// </summary> public override string ToString() { if (DockableForm != null) { return("DFI: " + DockableForm.ToString()); } return(base.ToString()); }
public void DockForm(DockableForm ChildForm_O) { if (ChildForm_O.Equals(mCheckingForm_O)) { this.splitContainer1.Panel1Collapsed = false; this.splitContainer1.Panel1.Controls.Add(mCheckingForm_O); } else if (ChildForm_O.Equals(mJobForm_O)) { this.splitContainer1.Panel2Collapsed = false; this.splitContainer1.Panel2.Controls.Add(mJobForm_O); } }
public static PeptideFileAnalysisFrame ActivatePeptideDataForm <T>(Form sibling, PeptideFileAnalysis peptideFileAnalysis) where T : PeptideFileAnalysisForm { PeptideFileAnalysisFrame peptideFileAnalysisFrame = null; foreach (var form in Application.OpenForms) { if (!(form is PeptideFileAnalysisFrame)) { continue; } if (((PeptideFileAnalysisFrame)form).PeptideFileAnalysis != peptideFileAnalysis) { continue; } peptideFileAnalysisFrame = (PeptideFileAnalysisFrame)form; break; } if (peptideFileAnalysisFrame == null) { peptideFileAnalysisFrame = new PeptideFileAnalysisFrame(peptideFileAnalysis); if (sibling is DockableForm) { DockableForm dockableSibling = (DockableForm)sibling; if (dockableSibling.DockPanel != null) { peptideFileAnalysisFrame.Show(dockableSibling.DockPanel, dockableSibling.DockState); } } else { if (sibling != null) { peptideFileAnalysisFrame.Show(sibling.Parent); } else { peptideFileAnalysisFrame.Show(null); } } } peptideFileAnalysisFrame.ShowForm <T>(); return(peptideFileAnalysisFrame); }
public static PeptideDataForm ActivatePeptideDataForm(Form sibling, PeptideAnalysis peptideAnalysis) { PeptideDataForm peptideDataForm; foreach (var form in Application.OpenForms) { if (!(form is PeptideDataForm)) { continue; } if (((PeptideDataForm)form).PeptideAnalysis != peptideAnalysis) { continue; } peptideDataForm = (PeptideDataForm)form; peptideDataForm.Activate(); return(peptideDataForm); } peptideDataForm = new PeptideDataForm(peptideAnalysis); if (sibling is DockableForm) { DockableForm dockableSibling = (DockableForm)sibling; if (dockableSibling.DockPanel != null) { peptideDataForm.Show(dockableSibling.DockPanel, dockableSibling.DockState); return(peptideDataForm); } } if (sibling != null) { peptideDataForm.Show(sibling.Parent); } else { peptideDataForm.Show(null); } peptideDataForm.ShowForm <PeptideInfoForm>(); return(peptideDataForm); }
public void ClearData() { if (InvokeRequired) { Invoke(new MethodInvoker(() => ClearData())); return; } refreshDataLabel.Visible = true; percentTicGraphControl.GraphPane.CurveList.Clear(); percentPeakCountGraphControl.GraphPane.CurveList.Clear(); meanMzErrorGraphControl.GraphPane.CurveList.Clear(); lastActiveGraphForm = dockPanel.LastActiveContent as DockableForm ?? meanMzErrorGraphForm; percentTicGraphForm.Hide(); percentPeakCountGraphForm.Hide(); meanMzErrorGraphForm.Hide(); Text = TabText = "Fragmentation Statistics"; Refresh(); }
public bool UndockForm(DockableForm ChildForm_O) { bool Undocked_b = false; if (mCheckingForm_O.IsDocked() && mJobForm_O.IsDocked()) { if (ChildForm_O.Equals(mCheckingForm_O)) { this.splitContainer1.Panel1.Controls.Remove(mCheckingForm_O); this.splitContainer1.Panel1Collapsed = true; Undocked_b = true; } else if (ChildForm_O.Equals(mJobForm_O)) { this.splitContainer1.Panel2.Controls.Remove(mJobForm_O); this.splitContainer1.Panel2Collapsed = true; Undocked_b = true; } } return(Undocked_b); }
public void ClearData() { if (InvokeRequired) { Invoke(new MethodInvoker(() => ClearData())); return; } precursorMassErrorForm.ZedGraphControl.GraphPane.CurveList.Clear(); scanTimeDistributionForm.ZedGraphControl.GraphPane.CurveList.Clear(); chargeStatesForm.ZedGraphControl.GraphPane.CurveList.Clear(); lastActiveGraphForm = dockPanel.LastActiveContent as DockableForm ?? precursorMassErrorForm; precursorMassErrorForm.Hide(); scanTimeDistributionForm.Hide(); chargeStatesForm.Hide(); refreshDataLabel.Visible = true; Text = TabText = "Distribution Statistics"; Refresh(); }
void zedGraphControl_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState) { if (ShowDataTable == null) { return; } var e = new ShowDataTableEventArgs(); ShowDataTable(this, e); int index = menuStrip.Items.Cast <ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count(); menuStrip.Items.Insert(index, new ToolStripMenuItem("Show Data Table", null, (x, y) => { var tableForm = new DockableForm { Text = this.Text + " Data Table", Size = new Size(480, 600) }; var dgv = new DataGridView { Dock = DockStyle.Fill, DataSource = e.DataTable, RowHeadersVisible = false, AllowUserToDeleteRows = false, AllowUserToAddRows = false, ReadOnly = true, ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText }; tableForm.Controls.Add(dgv); tableForm.Show(this); })); }
/// <summary> /// 获取此实例的哈希代码 /// </summary> /// <returns>hash code</returns> public override int GetHashCode() { ValidateNotDisposed(); return(DockableForm.GetHashCode()); }
void resultsGrid_FormClosed(object sender, FormClosedEventArgs e) { // Update settings and menu check Settings.Default.ShowResultsGrid = false; _resultsGridForm = null; }
private void DestroyResultsGrid() { if (_resultsGridForm != null) { _resultsGridForm.FormClosed -= resultsGrid_FormClosed; _resultsGridForm.VisibleChanged -= resultsGrid_VisibleChanged; _resultsGridForm.HideOnClose = false; _resultsGridForm.Close(); _resultsGridForm = null; } }
private DockableForm CreateResultsGrid() { Debug.Assert(null == _resultsGridForm); _resultsGridForm = new LiveResultsGrid(this); _resultsGridForm.FormClosed += resultsGrid_FormClosed; _resultsGridForm.VisibleChanged += resultsGrid_VisibleChanged; return _resultsGridForm; }
public void ShowResultsGrid(bool show) { if (show) { if (_resultsGridForm != null && !Program.SkylineOffscreen) { _resultsGridForm.Activate(); } else { _resultsGridForm = _resultsGridForm ?? CreateResultsGrid(); var rectFloat = GetFloatingRectangleForNewWindow(); _resultsGridForm.Show(dockPanel, rectFloat); } } else { if (_resultsGridForm != null) { _resultsGridForm.Hide(); } } }
public void PushDockableWindow(DockableForm form, DockState state) { form.Show(dockPanel, state); }
public void ClearData () { if (InvokeRequired) { Invoke(new MethodInvoker(() => ClearData())); return; } precursorMassErrorForm.ZedGraphControl.GraphPane.CurveList.Clear(); scanTimeDistributionForm.ZedGraphControl.GraphPane.CurveList.Clear(); chargeStatesForm.ZedGraphControl.GraphPane.CurveList.Clear(); lastActiveGraphForm = dockPanel.LastActiveContent as DockableForm ?? precursorMassErrorForm; precursorMassErrorForm.Hide(); scanTimeDistributionForm.Hide(); chargeStatesForm.Hide(); refreshDataLabel.Visible = true; Text = TabText = "Distribution Statistics"; Refresh(); }
public void ClearData () { if (InvokeRequired) { Invoke(new MethodInvoker(() => ClearData())); return; } refreshDataLabel.Visible = true; percentTicGraphControl.GraphPane.CurveList.Clear(); percentPeakCountGraphControl.GraphPane.CurveList.Clear(); meanMzErrorGraphControl.GraphPane.CurveList.Clear(); lastActiveGraphForm = dockPanel.LastActiveContent as DockableForm ?? meanMzErrorGraphForm; percentTicGraphForm.Hide(); percentPeakCountGraphForm.Hide(); meanMzErrorGraphForm.Hide(); Text = TabText = "Fragmentation Statistics"; Refresh(); }
public FragmentationStatisticsForm (IDPickerForm owner) { InitializeComponent(); this.owner = owner; FormClosing += delegate(object sender, FormClosingEventArgs e) { e.Cancel = true; DockState = DockState.DockBottomAutoHide; }; Text = TabText = "Fragmentation Statistics"; Icon = Properties.Resources.BlankIcon; refreshButton.Image = new Icon(Properties.Resources.Refresh, refreshButton.Width / 2, refreshButton.Height / 2).ToBitmap(); refreshDataLabel.LinkClicked += (sender, e) => refreshButton_Click(sender, e); percentTicGraphForm = new DockableForm { Text = "%TIC" }; percentPeakCountGraphForm = new DockableForm { Text = "%PeakCount" }; meanMzErrorGraphForm = new DockableForm { Text = "Mean m/z error" }; percentTicGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentTicGraphForm.Text }; percentPeakCountGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentPeakCountGraphForm.Text }; meanMzErrorGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = meanMzErrorGraphForm.Text }; percentTicGraphForm.Controls.Add(percentTicGraphControl); percentPeakCountGraphForm.Controls.Add(percentPeakCountGraphControl); meanMzErrorGraphForm.Controls.Add(meanMzErrorGraphControl); initializeGraphControl(percentTicGraphControl); initializeGraphControl(percentPeakCountGraphControl); initializeGraphControl(meanMzErrorGraphControl); lastActiveGraphForm = meanMzErrorGraphForm; graphControls = new List<ZedGraphControl> { percentTicGraphControl, percentPeakCountGraphControl, meanMzErrorGraphControl }; percentTicGraphForm.FormClosing += (sender, e) => e.Cancel = true; percentPeakCountGraphForm.FormClosing += (sender, e) => e.Cancel = true; meanMzErrorGraphForm.FormClosing += (sender, e) => e.Cancel = true; fragmentTolerance = new MZTolerance(0.5, MZTolerance.Units.MZ); fragmentToleranceUnitsComboBox.Text = fragmentTolerance.value.ToString(); fragmentToleranceUnitsComboBox.SelectedIndex = (int) fragmentTolerance.units; }
private void BindFormWithMenuItem(DockableForm form, ToolStripMenuItem menuitem) { form.Closing += (sender, args) => { args.Cancel = true; form.DockHandler.Hide(); menuitem.Checked = false; }; menuitem.Click += (sender, args) => { if (menuitem.Checked) { form.DockHandler.Hide(); menuitem.Checked = false; } else { form.DockHandler.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockRight); menuitem.Checked = true; } }; }
void zedGraphControl_ContextMenuBuilder (ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState) { if (ShowDataTable == null) return; var e = new ShowDataTableEventArgs(); ShowDataTable(this, e); int index = menuStrip.Items.Cast<ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count(); menuStrip.Items.Insert(index, new ToolStripMenuItem("Show Data Table", null, (x, y) => { var tableForm = new DockableForm { Text = this.Text + " Data Table", Size = new Size(480, 600) }; var dgv = new DataGridView { Dock = DockStyle.Fill, DataSource = e.DataTable, RowHeadersVisible = false, AllowUserToDeleteRows = false, AllowUserToAddRows = false, ReadOnly = true, ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText }; tableForm.Controls.Add(dgv); tableForm.Show(this); })); }
public void SetParentWindow(DockableForm ParentWindow_O) { mParentWindow_O = ParentWindow_O; }
public FragmentationStatisticsForm(IDPickerForm owner) { InitializeComponent(); this.owner = owner; FormClosing += delegate(object sender, FormClosingEventArgs e) { e.Cancel = true; DockState = DockState.DockBottomAutoHide; }; Text = TabText = "Fragmentation Statistics"; Icon = Properties.Resources.BlankIcon; refreshButton.Image = new Icon(Properties.Resources.Refresh, refreshButton.Width / 2, refreshButton.Height / 2).ToBitmap(); refreshDataLabel.LinkClicked += (sender, e) => refreshButton_Click(sender, e); percentTicGraphForm = new DockableForm { Text = "%TIC" }; percentPeakCountGraphForm = new DockableForm { Text = "%PeakCount" }; meanMzErrorGraphForm = new DockableForm { Text = "Mean m/z error" }; percentTicGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentTicGraphForm.Text }; percentPeakCountGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentPeakCountGraphForm.Text }; meanMzErrorGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = meanMzErrorGraphForm.Text }; percentTicGraphForm.Controls.Add(percentTicGraphControl); percentPeakCountGraphForm.Controls.Add(percentPeakCountGraphControl); meanMzErrorGraphForm.Controls.Add(meanMzErrorGraphControl); initializeGraphControl(percentTicGraphControl); initializeGraphControl(percentPeakCountGraphControl); initializeGraphControl(meanMzErrorGraphControl); lastActiveGraphForm = meanMzErrorGraphForm; graphControls = new List <ZedGraphControl> { percentTicGraphControl, percentPeakCountGraphControl, meanMzErrorGraphControl }; percentTicGraphForm.FormClosing += (sender, e) => e.Cancel = true; percentPeakCountGraphForm.FormClosing += (sender, e) => e.Cancel = true; meanMzErrorGraphForm.FormClosing += (sender, e) => e.Cancel = true; fragmentTolerance = new MZTolerance(0.5, MZTolerance.Units.MZ); fragmentToleranceUnitsComboBox.Text = fragmentTolerance.value.ToString(); fragmentToleranceUnitsComboBox.SelectedIndex = (int)fragmentTolerance.units; }