private bool verifyModel() { if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmDrawBoard") { List <string> lstErr = ((frmDrawBoard)ActiveMdiChild).pnlDrawBoard.VerifyModel(); listErrorList.Items.Clear(); if (lstErr.Count > 0) { listErrorList.ForeColor = Color.Red; listErrorList.Items.AddRange(lstErr.ToArray()); dockErrorList.Show(); return(false); } else { listErrorList.ForeColor = Color.Black; listErrorList.Items.Add("Verification Successful..."); listErrorList.Items.Add("Your model now can be generated to Physical Model"); dockErrorList.Show(); return(true); } } return(false); }
private void LoadPhyicalForm() { if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmDrawBoard") { if (verifyModel()) { ((frmDrawBoard)ActiveMdiChild).pnlDrawBoard.EndEditDataType(); MetaData ERD = ((frmDrawBoard)ActiveMdiChild).pnlDrawBoard.getMetaData(); string formName = ActiveMdiChild.Text + "Physical"; Form f = findForm(formName); if (f != null) { f.Close(); } frmPhysicalDrawBoard frmPhysical = new frmPhysicalDrawBoard(ERD); frmPhysical.Text = formName; frmPhysical.MdiParent = this; frmPhysical.Show(); //frmPhysical.FormClosing += new FormClosingEventHandler(drawboard_FormClosing); } } }
/// <summary> /// Metoda koja se koristi za promjenu sadržaja/djeteta MDI kontejnera, /// a MDI kontejner je FrmMain /// </summary> /// <param name="forma">forma s kojom zamjenjujemo trenutni sadržaj</param> private void PrikaziFormu(Form forma) { /* * ako postoji trenutno/aktivno dijete MDI kontejnera i ako tip forme (koju prosljeđujemo metodi) * nije jednak tipu trenutnog/aktivnog djeteta kontejnera, zatvori aktivno dijete, postavi * FrmMain (forma dohvaćena uz pomoću "this") kao roditelja forme koju prosljeđujemo te prikaži tu * formu maksimizirano. Ako pak nema aktivnog djeteta kontejnera, postavi FrmMain kao roditelja * forme koju prosljeđujemo te prikaži tu formu maksimizirano */ if (ActiveMdiChild != null && forma.GetType() != ActiveMdiChild.GetType()) { ActiveMdiChild.Close(); forma.MdiParent = this; forma.WindowState = FormWindowState.Maximized; forma.Show(); } else if (ActiveMdiChild == null) { forma.MdiParent = this; forma.WindowState = FormWindowState.Maximized; forma.Show(); } }
private void byOfficeToolStripMenuItem_Click(object sender, EventArgs e) { if (ActiveMdiChild.GetType() == typeof(FRM_EquipmentEditing)) { // get the active mdi child and determine if it is an equipment form FRM_EquipmentEditing tempForm = (FRM_EquipmentEditing)ActiveMdiChild; } }
public void deleteShape() { if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmDrawBoard") { if (((frmDrawBoard)ActiveMdiChild).pnlDrawBoard.deleteAffectingShape()) { btnUndo.Enabled = true; } } }
private void menuItem5_Click(object sender, System.EventArgs e) { if (this.ActiveMdiChild != null) { if (ActiveMdiChild.GetType() == typeof(Form2)) { ((Form2)this.ActiveMdiChild).SaveDJZ(); } } }
private void redoToolStripMenuItem_Click(object sender, EventArgs e) { if (ActiveMdiChild.GetType() != typeof(FrontalMethod.MethodForm)) { if ((ProjectForm)this.ActiveMdiChild == null) { return; } ((ProjectForm)this.ActiveMdiChild).Redo(); } }
private void NavTabControl_TabStripMouseDoubleClick(object sender, MouseEventArgs e) { if (ActiveMdiChild != null) { Type formType = ActiveMdiChild.GetType(); SuperTabItem tabitem = NavTabControl.SelectedTab as SuperTabItem; if (tabitem != null && tabitem.Text != "欢迎") { tabitem.Close(); } } }
private void NavTabControl_DoubleClick(object sender, EventArgs e) { if (ActiveMdiChild != null) { Type formType = ActiveMdiChild.GetType(); SuperTabItem tabitem = NavTabControl.SelectedTab as SuperTabItem; if (tabitem != null && tabitem.Text != "欢迎" && formType != tabitem.AttachedControl.Controls[0].GetType()) { tabitem.Close(); } } }
public void CloseOthers() { if (ActiveMdiChild != null) { Type formType = ActiveMdiChild.GetType(); for (int i = NavTabControl.Tabs.Count - 1; i >= 0; i--) { SuperTabItem tabitem = NavTabControl.Tabs[i] as SuperTabItem; if (tabitem != null && tabitem.Text != "欢迎" && formType != tabitem.AttachedControl.Controls[0].GetType()) { tabitem.Close(); } } } }
private void frmMain_MdiChildActivate(object sender, EventArgs e) { // If there are no child forms, hide the tab control. if (ActiveMdiChild != null) { ActiveMdiChild.WindowState = FormWindowState.Maximized; // If this is a new child form and does not have a tab page, create one. if (ActiveMdiChild.Tag == null) { TabPage tp = new TabPage { // Add a tab page. Tag = ActiveMdiChild, Parent = tabForms }; if (ActiveMdiChild.GetType() == typeof(frmCareer)) { tp.Text = ((frmCareer)ActiveMdiChild).CharacterObject.CharacterName; } else if (ActiveMdiChild.GetType() == typeof(frmCreate)) { tp.Text = ((frmCreate)ActiveMdiChild).CharacterObject.CharacterName; } else if (ActiveMdiChild.GetType() == typeof(frmCharacterRoster)) { tp.Text = LanguageManager.GetString("String_CharacterRoster"); } tabForms.SelectedTab = tp; ActiveMdiChild.Tag = tp; ActiveMdiChild.FormClosed += ActiveMdiChild_FormClosed; } } // Don't show the tab control if there is only one window open. if (tabForms.TabCount > 1) { tabForms.Visible = true; } else { tabForms.Visible = false; } }
private void CloseOtherTabs() { if (ActiveMdiChild == null) { return; } Type formType = ActiveMdiChild.GetType(); for (int i = superTabControlMain.Tabs.Count - 1; i >= 0; i--) { SuperTabItem tabitem = superTabControlMain.Tabs[i] as SuperTabItem; if (tabitem != null && formType != tabitem.AttachedControl.Controls[0].GetType()) { tabitem.Close(); } } }
private void CloseTab() { if (ActiveMdiChild == null) { return; } Type formType = ActiveMdiChild.GetType(); for (int i = superTabControlMain.Tabs.Count; i >= 0; i--) { SuperTabItem tabitem = superTabControlMain.Tabs[i] as SuperTabItem; if (tabitem == null || formType != tabitem.AttachedControl.Controls[0].GetType()) { continue; } tabitem.Close(); break; } }
private void MDIUI_MdiChildActivate(object sender, EventArgs e) { if (ActiveMdiChild.GetType().IsAssignableFrom(typeof(DocumentForm))) { if (ActiveMdiChild != null && !ActiveMdiChild.IsDisposed) { activeDocument = ((DocumentForm)ActiveMdiChild); DataGridViewCell cell = activeDocument.extraCellTable.CurrentCell; formulaInput.Text = activeDocument.extraCellTable.ece.getCell(cell.ColumnIndex, cell.RowIndex).formula; setEditOptions(true); } else { setEditOptions(false); activeDocument = null; addressInput.Text = ""; formulaInput.Text = ""; } } }
private void MainForm_MdiChildActivate(object sender, EventArgs e) { Type type = ActiveMdiChild?.GetType(); if (type == typeof(frmMotifCreator)) { ActivateButton(btnPeptideList); } else if (type == typeof(frmAnalyzePeptideArray)) { ActivateButton(btnPeptideArray); } else if (type == typeof(frmAnalyzePermutationArray)) { ActivateButton(btnPermutationArray); } else if (type == typeof(frmAnalyzeOPALArray)) { ActivateButton(btnOPALArray); } else if (type == typeof(frmSequenceGenerator)) { ActivateButton(btnSequenceGenerator); } else if (type == typeof(frmMotifScorerPeptide)) { ActivateButton(btnMotifBasedPeptideScorer); } else if (type == typeof(frmMotifScorerProtein)) { ActivateButton(btnMotifBasedProteinScorer); } else if (type == typeof(frmMotifValidationDesigner)) { ActivateButton(btnMotifValidationDesigner); } else { DeactivateButtons(); } }
private void LoadDDLForm() { LoadPhyicalForm(); if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmPhysicalDrawBoard") { MetaDataPhysical mdp = ((frmPhysicalDrawBoard)ActiveMdiChild).pnlPhysical.getMetaDataPhysical(); string formName = ActiveMdiChild.Text.Substring(0, ActiveMdiChild.Text.IndexOf("Physical")) + " Generate DDL"; Form f = findForm(formName); if (f != null) { f.Close(); } GenerateScriptSQL gpm = new GenerateScriptSQL(this, mdp); gpm.Text = formName; gpm.MdiParent = this; gpm.Show(); } }
private void MainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.D) { cloneWindowToolStripMenuItem_Click(sender, e); } else if (e.Control && e.KeyCode == Keys.O) { openFileToolStripMenuItem_Click(sender, e); } else if (e.Control && e.KeyCode == Keys.S) { ZapiszCTRLSToolStripMenuItem_Click(sender, e); } else if (e.Control && e.KeyCode == Keys.W) { if (ActiveMdiChild != null && ActiveMdiChild.GetType() != typeof(SteganographyPreviewWindow)) { ActiveMdiChild.Close(); } } }
private void transferToolStripMenuItem_Click(object sender, EventArgs e) { if (ActiveMdiChild != null) { if (ActiveMdiChild.GetType().Name != "Form3") { ActiveMdiChild.Close(); Form3 obj2 = new Form3(); obj2.MdiParent = this; obj2.Show(); } else { MessageBox.Show("Form is already open"); } } else { Form3 obj2 = new Form3(); obj2.MdiParent = this; obj2.Show(); } }
private void EditControl_MainForm_Click(object sender, EventArgs e) { myAssembly = Assembly.GetAssembly(CurrentActiveForm.GetType()); if (sender.GetType().ToString() == "System.Windows.Forms.ToolStripMenuItem") { myMenuItem = (ToolStripMenuItem)sender; pvtstrControlText = myMenuItem.Text; } else { myToolStripButton = (ToolStripButton)sender; pvtstrControlText = myToolStripButton.Text; } try { ActiveMdiChild.GetType().InvokeMember("btn" + pvtstrControlText + "_Click", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, this.ActiveMdiChild, new object[] { null, e }); } catch { System.Windows.Forms.MessageBox.Show("'" + ActiveMdiChild.GetType().ToString() + ".btn" + pvtstrControlText + "_Click' Needs to be Set to Public.\n\nSpeak to System Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { try { // get active MDI Form and determine if it is an EquipmentView Form if (ActiveMdiChild.GetType() == typeof(FRM_EquipmentEditing)) { // get the active mdi child and determine if it is an equipment form FRM_EquipmentEditing tempForm = (FRM_EquipmentEditing)ActiveMdiChild; if (tempForm.PageEquip.getResultCount() == 0) { MessageBox.Show("Database table has no entries!", "Saving Failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SaveFileDialog save = new SaveFileDialog(); save.Filter = "SQL Server Database Files|*.mdf"; save.Title = "Save Inventory File"; save.FileName = "Equipment_Record"; DialogResult result = save.ShowDialog(); if (result == DialogResult.OK && tempForm.IsNewDB == true) { try { if (File.Exists(save.FileName)) // overwrite the existing file { File.Delete(save.FileName); string str = Path.GetFileNameWithoutExtension(save.FileName); str += "_log.ldf"; string str2 = Path.GetDirectoryName(save.FileName); File.Delete(str2 + @"\\" + str); // delete the ldf file } tempForm.Db.Dispose(true); File.Move(tempForm.Db.fileName, save.FileName); tempForm.IsNewDB = false; tempForm.Filepath = save.FileName; // load the saved Database and bind it to the DGV tempForm.initalizeDataGrid(tempForm.getDGV()); tempForm.PageEquip.ReCount(); tempForm.PageEquip.loadPage(); tempForm.PageMnf.ReCount(); tempForm.PageMnf.loadPage(); } catch (Exception err) { MessageBox.Show(err.Message); } } else if (result == DialogResult.OK && tempForm.IsNewDB == false) { try { if (File.Exists(save.FileName)) // overwrite if the file is exisiting { File.Delete(save.FileName); string str = Path.GetFileNameWithoutExtension(save.FileName); str += "_log.ldf"; string str2 = Path.GetDirectoryName(save.FileName); File.Delete(str2 + @"\\" + str); // delete the ldf file } File.Copy(tempForm.Db.fileName, save.FileName); // copy DB to the new DIR tempForm.Db.Dispose(true); tempForm.IsNewDB = false; tempForm.Filepath = save.FileName; // load the saved Database and bind it to the DGV tempForm.initalizeDataGrid(tempForm.getDGV()); tempForm.PageEquip.ReCount(); tempForm.PageEquip.loadPage(); } catch (Exception) { MessageBox.Show("Failed to Save file, are you trying to overwrite a locked DB?", "Saving Failed", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception) { } }