Exemple #1
0
        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);
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
        /// <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();
            }
        }
Exemple #4
0
 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;
     }
 }
Exemple #5
0
 public void deleteShape()
 {
     if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmDrawBoard")
     {
         if (((frmDrawBoard)ActiveMdiChild).pnlDrawBoard.deleteAffectingShape())
         {
             btnUndo.Enabled = true;
         }
     }
 }
Exemple #6
0
 private void menuItem5_Click(object sender, System.EventArgs e)
 {
     if (this.ActiveMdiChild != null)
     {
         if (ActiveMdiChild.GetType() == typeof(Form2))
         {
             ((Form2)this.ActiveMdiChild).SaveDJZ();
         }
     }
 }
Exemple #7
0
 private void redoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveMdiChild.GetType() != typeof(FrontalMethod.MethodForm))
     {
         if ((ProjectForm)this.ActiveMdiChild == null)
         {
             return;
         }
         ((ProjectForm)this.ActiveMdiChild).Redo();
     }
 }
Exemple #8
0
 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();
         }
     }
 }
Exemple #9
0
 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();
         }
     }
 }
Exemple #10
0
 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();
             }
         }
     }
 }
Exemple #11
0
        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;
            }
        }
Exemple #12
0
        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();
                }
            }
        }
Exemple #13
0
        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;
            }
        }
Exemple #14
0
 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 = "";
         }
     }
 }
Exemple #15
0
        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();
            }
        }
Exemple #16
0
        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();
            }
        }
Exemple #17
0
 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();
         }
     }
 }
Exemple #18
0
 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);
            }
        }
Exemple #20
0
        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)
            { }
        }