Пример #1
0
        private void mainForm_Closing(object sender, FormClosingEventArgs e)
        {
            // If no child forms open, skip this logic and close
            if (MdiChildren.Count() == 0)
            {
                return;
            }

            // Checks if user really wants to close
            DialogResult = MessageBox.Show("Are you sure you want to exit?", "Confirm Exit?", MessageBoxButtons.OKCancel);
            if (DialogResult == DialogResult.OK)
            {
                // Request close for each child form
                foreach (Form child in MdiChildren)
                {
                    if (child is TextEditorForm)
                    {
                        ((TextEditorForm)child).CloseFile(MessageBoxButtons.YesNo);
                    }
                }
                // If no more children are open and child forms were closed, do not cancel close request for parent
                if (MdiChildren.Count() == 0)
                {
                    e.Cancel = false;
                }
            }
            else // Cancels closing
            {
                e.Cancel = true;
            }
        }
Пример #2
0
 /// <summary>
 /// Réaffichage du panneau central
 /// </summary>
 private void Restore()
 {
     if (MdiChildren.Count() == 0)
     {
         panneauAccueil.Show();
     }
 }
Пример #3
0
 private void SetNum_Click(object sender, EventArgs e)
 {
     for (int i = 0, j = 1; i < MdiChildren.Count(); i++, j++)
     {
         MdiChildren[i].Text = j.ToString();
     }
 }
Пример #4
0
 private void Close_Click(object sender, EventArgs e)
 {
     do
     {
         MdiChildren[0].Close();
     }while (MdiChildren.Count() > 0);
 }
Пример #5
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     loadding.Hide();
     timer1.Start();
     if (!CheckForInternetConnection())
     {
         MessageBox.Show("Hệ thống đang bị mất kết nối mạng, vui lòng kiểm tra lại kết nối mạng và thử lại", "Mất kết nối mạng", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         Environment.Exit(0);
     }
     else
     {
         if (role != "1")
         {
             ChucVu                    = "Nhân Viên";
             PhanQuyen.Visible         = false;
             ThietLapKetNoiSQL.Visible = false;
             PhucHoiSQL.Visible        = false;
             SaoLuuSQL.Visible         = false;
             NhanVien.Visible          = false;
         }
         else
         {
             ChucVu = "Quản Lý";
         }
         if (MdiChildren.Count() == 0)
         {
             txtXinChao.Caption = "Xin chào: ".ToUpper() + name;
             txtChucVu.Caption  = "Chức vụ: ".ToUpper() + ChucVu;
             WelcomeBack.Text   = "Chào mừng quay trở lại: " + name;
         }
     }
 }
Пример #6
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (auth.login != "")
            {
                modulesMenuItem.Enabled = true;
            }
            else
            {
                modulesMenuItem.Enabled = false;
            }
            if (auth.login == "admin")
            {
                dbBackupMenuItem.Enabled = userConfigMenuItem.Enabled = true;
            }
            else
            {
                dbBackupMenuItem.Enabled = userConfigMenuItem.Enabled = false;
            }
            if (MdiChildren.Count() > 0)
            {
                closeAllWindowsMenuItem.Enabled = true;
            }
            else
            {
                closeAllWindowsMenuItem.Enabled = false;
            }

            statusLbl.Text = "Користувач: " + auth.login;
        }
Пример #7
0
 private void MainScreen_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape && MdiChildren.Count() > 0)//esc'ye basıldıysa ve çocuk form açıksa
     {
         ActiveMdiChild.Close();
     }
 }
Пример #8
0
        private void новыйToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Canvas frmChild = new Canvas();

            frmChild.Text      = (MdiChildren.Count() == 0) ? "Canvas" : "Canvas " + "(" + (MdiChildren.Count() + 1) + ")";
            frmChild.MdiParent = this;
            frmChild.Show();
        }
Пример #9
0
 private void usunToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MdiChildren.Count() > 1)
     {
         Form toDelete = this.ActiveMdiChild;
         toDelete.Close();
     }
 }
Пример #10
0
 private void NamberOfWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     switch (MessageBox.Show($"namber child - {MdiChildren.Count()}", "About program", MessageBoxButtons.OK, MessageBoxIcon.Information))
     {
     case DialogResult.OK:
         break;
     }
 }
Пример #11
0
        /// <summary>
        /// Ferme toutes les applications ouvertes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fermerToutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int nb = MdiChildren.Count(); //compte le nombre d'applications ouverte

            for (int i = 0; i < nb; i++)  //Boucle pour répéter l'opération autant de fois qu'il y a de d'appli ouverte
            {
                ActiveMdiChild.Close();   //prends la fenêtre enfant ouverte et la ferme
            }
        }
Пример #12
0
        private void Form_Closed(ToolStripMenuItem mi, DataForm form)
        {
            var tsi = mi.DropDownItems.Cast <ToolStripItem>().Single(x => x.Tag == form);

            mi.DropDownItems.Remove(tsi);

            // child form is still in list at this point,
            // so disable button if this is the last child which is about to close
            BtnClose.Enabled = MdiChildren.Count() != 1;
        }
 private void GalvanicaMdi_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MdiChildren.Count() > 0)
     {
         foreach (Form f in MdiChildren)
         {
             f.Close();
         }
     }
 }
Пример #14
0
        private void GetLast_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (MdiChildren.Count() > i)
            {
                i++;
            }
            MdiChildren[--i].Activate();
        }
Пример #15
0
        private void MNowy_Click(object sender, EventArgs e)
        {
            var form = new Dokument
            {
                MdiParent = this,
                Text      = "Plik " + MdiChildren.Count()
            };

            form.Show();
        }
Пример #16
0
        /// <summary>
        /// Opens a new song in a song editor child window
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="plugin"></param>
        public void OpenSong(string fileName, ISongFilePlugin plugin = null)
        {
            for (int i = 0; i < MdiChildren.Count(); i++)
            {
                EditorChildMetaData md = (EditorChildMetaData)MdiChildren[i].Tag;
                if (!string.IsNullOrEmpty(md.Filename) &&
                    String.Compare(
                        Path.GetFullPath(md.Filename).TrimEnd('\\'),
                        Path.GetFullPath(fileName).TrimEnd('\\'),
                        StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    MdiChildren[i].Show();
                    MdiChildren[i].Focus();
                    return;
                }
            }

            try
            {
                if (plugin == null)
                {
                    plugin = SongFilePluginFactory.Create(fileName);
                }
                var sng = plugin.Load(fileName);

                SongTemplateMapper stm = new SongTemplateMapper(_settings);
                // Set default formattig if none exists
                if (sng.Formatting == null)
                {
                    stm.ApplyFormattingFromSettings(sng);
                }
                // Set default background if none is set
                foreach (var p in sng.Parts)
                {
                    foreach (var s in p.Slides)
                    {
                        if (s.Background == null)
                        {
                            s.Background = stm.GetDefaultBackground();
                        }
                    }
                }

                CreateSongEditorChildForm(sng, fileName, false);
            }
            catch (NotImplementedException)
            {
                MessageBox.Show(StringResources.SongFormatNotSupported, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e)
            {
                MessageBox.Show(StringResources.SongFileHasErrors + @" (" + e.Message + @")!", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #17
0
 public void deauthorize()
 {
     this.Text   = "ИС Учёт Времени [Не авторизован]";
     notify.Text = notify.BalloonTipTitle = this.Text;
     user.Clear();
     while (MdiChildren.Count() > 0)
     {
         MdiChildren[0].Close();
     }
     beginworkintoolmenu.Enabled = false;
 }
Пример #18
0
 private void VisualizarFormularioYTítulo(Form formulario, string título)
 {
     if (MdiChildren.Count() == 1)
     {
         MdiChildren[0].Close();
     }
     formulario.MdiParent = this;
     formulario.Dock      = DockStyle.Fill;
     formulario.Show();
     this.Text = título;
 }
Пример #19
0
        private void lISTARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                ActiveMdiChild.Close();
            }

            ListarClientes TelaListarClientes = new ListarClientes();

            TelaListarClientes.MdiParent = this;
            TelaListarClientes.Show();
        }
Пример #20
0
        private void cADASTRARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                ActiveMdiChild.Close();
            }

            CadCliente TelaCadCliente = new CadCliente();

            TelaCadCliente.MdiParent = this;
            TelaCadCliente.Show();
        }
Пример #21
0
        private void pROFISSIONAISToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                ActiveMdiChild.Close();
            }

            Profissionais TelaProfissionais = new Profissionais();

            TelaProfissionais.MdiParent = this;
            TelaProfissionais.Show();
        }
Пример #22
0
        private void Projects_roleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                Projects_roleForm proj_role = new Projects_roleForm();

                proj_role.MdiParent = this;
                proj_role.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                proj_role.Show();
            }
        }
Пример #23
0
        private void History_projectsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                History_projectsForm history_projects = new History_projectsForm();

                history_projects.MdiParent = this;
                history_projects.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                history_projects.Show();
            }
        }
Пример #24
0
        private void MyTaskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                MyTaskForm my_task = new MyTaskForm();

                my_task.MdiParent = this;
                my_task.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                my_task.Show();
            }
        }
Пример #25
0
        private void Status_projectsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                Status_projectsForm stat_proj = new Status_projectsForm();

                stat_proj.MdiParent = this;
                stat_proj.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                stat_proj.Show();
            }
        }
Пример #26
0
        private void RoleUsersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                Users_rolesForm users_role = new Users_rolesForm();

                users_role.MdiParent = this;
                users_role.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                users_role.Show();
            }
        }
Пример #27
0
        private void ListPostsToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                PostsForm posts = new PostsForm();

                posts.MdiParent = this;
                posts.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                posts.Show();
            }
        }
Пример #28
0
        private void listEmployeesToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            if (MdiChildren.Count() > 0)
            {
                MdiChildren[0].Close();

                EmployeesForm employees = new EmployeesForm();

                employees.MdiParent = this;
                employees.Anchor    = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                employees.Show();
            }
        }
Пример #29
0
        private void viewForm(Form frm)
        {
            if (!checkForm(frm))
            {
                frm.MdiParent = this;
                frm.Show();
            }

            if (MdiChildren.Count() > 0)
            {
                pb1.Hide();
                WelcomeBack.Hide();
            }
        }
Пример #30
0
 private bool isActive(Form form)
 {
     if (MdiChildren.Count() > 0)
     {
         foreach (var item in MdiChildren)
         {
             if (form.Name == item.Name)
             {
                 return(true);
             }
         }
     }
     return(false);
 }