Exemplo n.º 1
0
        /// <summary>
        /// Open MDI ChildForm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AppCommandNew_Executed(object sender, EventArgs e)
        {
            ICommandSource source = sender as ICommandSource;
            if (source.CommandParameter is string)
            {
                //If the child form is opened, bring to front for the form;
                bool isValid = false;
                foreach (Form form in Application.OpenForms)
                {
                    if (source.CommandParameter.ToString() == form.Name)
                    {
                        //form.Activate();
                        //form.WindowState = FormWindowState.Maximized;
                        //form.Show();
                        //form.BringToFront();
                        //form.Update();
                        form.Focus();
                        return;
                    }
                }
                if (!isValid)
                {
                    string frmName = source.CommandParameter.ToString();
                    switch (frmName)
                    {
                        case "frmLogisticsMonitoringView":
                            {
                                frmLogisticsMonitoringView frm = new frmLogisticsMonitoringView();
                                frm.MdiParent = this;
                                frm.WindowState = FormWindowState.Maximized;
                                frm.BringToFront();
                                frm.Show();
                                frm.Update();
                            }
                            break;
                        case "frmTaskManagementView":
                            {
                                frmTaskManagementView frm = new frmTaskManagementView();
                                frm.MdiParent = this;
                                frm.WindowState = FormWindowState.Maximized;
                                frm.BringToFront();
                                frm.Show();
                                frm.Update();
                            }
                            break;
                        case "frmWareHouseSearchView":
                            {
                                frmWareHouseSearchView frm = new frmWareHouseSearchView();
                                frm.MdiParent = this;
                                frm.WindowState = FormWindowState.Maximized;
                                frm.BringToFront();
                                frm.Show();
                                frm.Update();
                            }
                            break;
                        case "frmDiscreteJobsSearchView":
                            {
                                frmDiscreteJobsSearchView frm = new frmDiscreteJobsSearchView();
                                frm.MdiParent = this;
                                frm.WindowState = FormWindowState.Maximized;
                                frm.BringToFront();
                                frm.Show();
                                frm.Update();
                            }
                            break;
                    }
                }

            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Open MDI ChildForm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AppCommandNew_Executed(object sender, EventArgs e)
        {
            ICommandSource source = sender as ICommandSource;

            if (source.CommandParameter is string)
            {
                //If the child form is opened, bring to front for the form;
                bool isValid = false;
                foreach (Form form in Application.OpenForms)
                {
                    if (source.CommandParameter.ToString() == form.Name)
                    {
                        //form.Activate();
                        //form.WindowState = FormWindowState.Maximized;
                        //form.Show();
                        //form.BringToFront();
                        //form.Update();
                        form.Focus();
                        return;
                    }
                }
                if (!isValid)
                {
                    string frmName = source.CommandParameter.ToString();
                    switch (frmName)
                    {
                    case "frmLogisticsMonitoringView":
                    {
                        frmLogisticsMonitoringView frm = new frmLogisticsMonitoringView();
                        frm.MdiParent   = this;
                        frm.WindowState = FormWindowState.Maximized;
                        frm.BringToFront();
                        frm.Show();
                        frm.Update();
                    }
                    break;

                    case "frmTaskManagementView":
                    {
                        frmTaskManagementView frm = new frmTaskManagementView();
                        frm.MdiParent   = this;
                        frm.WindowState = FormWindowState.Maximized;
                        frm.BringToFront();
                        frm.Show();
                        frm.Update();
                    }
                    break;

                    case "frmWareHouseSearchView":
                    {
                        frmWareHouseSearchView frm = new frmWareHouseSearchView();
                        frm.MdiParent   = this;
                        frm.WindowState = FormWindowState.Maximized;
                        frm.BringToFront();
                        frm.Show();
                        frm.Update();
                    }
                    break;

                    case "frmDiscreteJobsSearchView":
                    {
                        frmDiscreteJobsSearchView frm = new frmDiscreteJobsSearchView();
                        frm.MdiParent   = this;
                        frm.WindowState = FormWindowState.Maximized;
                        frm.BringToFront();
                        frm.Show();
                        frm.Update();
                    }
                    break;
                    }
                }
            }
        }