示例#1
0
        private void unitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                AddNewUnit ARF = null;

                if (IsFormAlreadyOpen(typeof(AddNewUnit)) == null)
                {
                    ARF           = new AddNewUnit();
                    ARF.MdiParent = this;
                    ARF.Show();
                }
                else
                {
                    Form selectedForm = IsFormAlreadyOpen(typeof(AddNewUnit));
                    foreach (Form OpenForm in this.MdiChildren)
                    {
                        if (OpenForm == selectedForm)
                        {
                            if (selectedForm.WindowState == FormWindowState.Minimized)
                            {
                                selectedForm.WindowState = FormWindowState.Normal;
                            }
                            selectedForm.Select();
                        }
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.GetBaseException().ToString());
            }
        }
示例#2
0
        private void unitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                AddNewUnit ARF = null;

                if (IsFormAlreadyOpen(typeof(AddNewUnit)) == null)
                {
                    ARF = new AddNewUnit();
                    ARF.MdiParent = this;
                    ARF.Show();
                }
                else
                {
                    Form selectedForm = IsFormAlreadyOpen(typeof(AddNewUnit));
                    foreach (Form OpenForm in this.MdiChildren)
                    {
                        if (OpenForm == selectedForm)
                        {
                            if (selectedForm.WindowState == FormWindowState.Minimized)
                            {
                                selectedForm.WindowState = FormWindowState.Normal;
                            }
                            selectedForm.Select();
                        }
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.GetBaseException().ToString());
            }
        }