Exemple #1
0
        private void startForm(int p)
        {
            Form instance = null;

            // Looking for MyForm among all opened forms
            foreach (Form form in Application.OpenForms)
            {
                switch (p)
                {
                case 0:
                    if (form is Dossiers)
                    {
                        instance = form;
                        break;
                    }
                    break;

                case 1:
                    if (form is Musiques)
                    {
                        instance = form;
                        break;
                    }
                    break;

                case 2:
                case 3:
                    if (form is Photos_Videos)
                    {
                        instance = form;
                        break;
                    }
                    break;
                }
            }

            if (Object.ReferenceEquals(null, instance))
            {
                switch (p)
                {
                case 0:
                    instance           = new Dossiers();
                    instance.MdiParent = this;
                    instance.Show();
                    break;

                case 1:
                    instance           = new Musiques();
                    instance.MdiParent = this;
                    instance.Show();
                    instance.WindowState = FormWindowState.Maximized;
                    break;

                case 2:
                    instance           = new Photos_Videos(true);
                    instance.MdiParent = this;
                    instance.Show();
                    instance.WindowState = FormWindowState.Maximized;
                    break;

                case 3:
                    instance           = new Photos_Videos(false);
                    instance.MdiParent = this;
                    instance.Show();
                    instance.WindowState = FormWindowState.Maximized;
                    break;
                }
            }
            else
            {
                instance.BringToFront();
            }
        }
Exemple #2
0
        private void startForm(int p)
        {
            Form instance = null;

            // Looking for MyForm among all opened forms
            foreach (Form form in Application.OpenForms)
                switch (p)
                {
                    case 0:
                        if (form is Dossiers)
                        {
                            instance = form;
                            break;
                        }
                        break;
                    case 1:
                        if (form is Musiques)
                        {
                            instance = form;
                            break;
                        }
                        break;
                    case 2:
                    case 3:
                        if (form is Photos_Videos)
                        {
                            instance = form;
                            break;
                        }
                        break;
                }

            if (Object.ReferenceEquals(null, instance))
            {
                switch (p)
                {
                    case 0:
                        instance = new Dossiers();
                        instance.MdiParent = this;
                        instance.Show();
                        break;
                    case 1:
                        instance = new Musiques();
                        instance.MdiParent = this;
                        instance.Show();
                        instance.WindowState = FormWindowState.Maximized;
                        break;
                    case 2:
                        instance = new Photos_Videos(true);
                        instance.MdiParent = this;
                        instance.Show();
                        instance.WindowState = FormWindowState.Maximized;
                        break;
                    case 3:
                        instance = new Photos_Videos(false);
                        instance.MdiParent = this;
                        instance.Show();
                        instance.WindowState = FormWindowState.Maximized;
                        break;
                }
            }
            else
            {
                instance.BringToFront();
            }
        }