protected bool TryCloseTab(int index)
        {
            if (index >= 0 || index < Tabs.Count)
            {
                IDockContent content = Tabs[index].Content;

                if ((Tabs[index].Content.DockHandler.Form as DeskTab).ShowQuestionClose)
                {
                    if (ShowPersianMessageBox.ShowMessge("پيغام", "آيا تب " + Tabs[index].Content.DockHandler.TabText + " بسته شود",
                                                         MessageBoxButtons.YesNo, false, false) == DialogResult.Yes)
                    {
                        // Close the specified content.
                        DockPane.CloseContent(content);
                        if (PatchController.EnableSelectClosestOnClose == true)
                        {
                            SelectClosestPane(index);
                        }
                        return(true);
                    }
                }
                else
                {
                    // Close the specified content.
                    DockPane.CloseContent(content);
                    if (PatchController.EnableSelectClosestOnClose == true)
                    {
                        SelectClosestPane(index);
                    }
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        private bool CloseProgramm()
        {
            var close =
                ShowPersianMessageBox.ShowMessge("پيام سيستم",
                                                 "آيا مي خواهيد از سيستم خارج شويد؟", MessageBoxButtons.YesNo, false, false);

            if (close == DialogResult.Yes)
            {
                //if (CheckBackupPermission.HavePermission())
                //{
                var res =
                    ShowPersianMessageBox.ShowMessge("پيام سيستم",
                                                     "آيا مي خواهيد از اطلاعات پشتيبان بگيريد؟", MessageBoxButtons.YesNo, false, false);
                if (res == DialogResult.Yes)
                {
                    // backup
                    //Atiran.BackupAndRestore.AtiranBackup c = new Atiran.BackupAndRestore.AtiranBackup(true);
                    //new Atiran.UI.WindowsForms.Shortcuts.UserControlLoader(c, true, false, true);
                }
                //}

                // user Logouted
                //Connections.UserService.UserLogouted(Connections.GetCurrentSysUser.Instance.user_id);
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case Keys.Escape:
            case Keys.Alt | Keys.F4:
            {
                try
                {
                    if (((DeskTab)ActiveMdiChild).ShowQuestionClose)
                    {
                        if (ShowPersianMessageBox.ShowMessge("پيغام",
                                                             "آيا تب " + ((DeskTab)ActiveMdiChild).Text + " بسته شود",
                                                             MessageBoxButtons.YesNo, false, false) == DialogResult.Yes)
                        {
                            ActiveMdiChild.Close();
                        }
                    }
                    else
                    {
                        ActiveMdiChild.Close();
                    }
                }
                catch (Exception)
                {
                    Close();
                }

                return(true);
            }

            case Keys.Home:
            {
                ((ToolStripMenuItem)MyMnSt.Items[0]).ShowDropDown();
                return(true);
            }

            case Keys.Scroll:
            {
                try
                {
                    MainTab.NextTabFocus();
                }
                catch (Exception)
                {
                    break;
                }

                return(true);
            }
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (((DeskTab)((Form)this.TopLevelControl).ActiveMdiChild).ShowQuestionClose)
     {
         if (ShowPersianMessageBox.ShowMessge("پيغام", "آيا تب " + ((Form)this.TopLevelControl).ActiveMdiChild.Text + " بسته شود",
                                              MessageBoxButtons.YesNo, false, false) == DialogResult.Yes)
         {
             ((Form)this.TopLevelControl).ActiveMdiChild.Close();
         }
     }
     else
     {
         ((Form)this.TopLevelControl).ActiveMdiChild.Close();
     }
 }
Exemplo n.º 5
0
 private void miClose_Click(object sender, EventArgs e)
 {
     if (ShowQuestionClose)
     {
         if (ShowPersianMessageBox.ShowMessge("پيغام", "آيا تب " + Text + " بسته شود",
                                              MessageBoxButtons.YesNo, false, false) == DialogResult.Yes)
         {
             Close();
         }
     }
     else
     {
         Close();
     }
 }
Exemplo n.º 6
0
        private void TryClose(Atiran.Utility.Docking2.Desk.DeskTab form, Form[] forms)
        {
            if (form.ShowQuestionClose)
            {
                if (!isCLoseAll)
                {
                    string TextTabs = form.Text;
                    foreach (Form tab in forms)
                    {
                        TextTabs += "\n" + tab.Text;
                    }
                    var result = ShowPersianMessageBox.ShowMessge("آيا تب ها بسته شوند؟", TextTabs,
                                                                  MessageBoxButtons.YesNo, false);
                    if (result == DialogResult.Yes)
                    {
                        form.Close();
                    }
                    else if (result == DialogResult.OK)
                    {
                        isCLoseAll = true;
                        form.Close();
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        isCanselCLoseAll = true;
                    }
                }
                else
                {
                    form.Close();
                }
            }
            else
            {
                form.Close();
            }

            deskTabs.Remove(form);
        }