コード例 #1
0
ファイル: frmMain.cs プロジェクト: 406544970/MDIDemo
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBox.Show("您确定要退出此系统吗?", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         WaitDialogForm          waitDialogForm    = new WaitDialogForm("正在保存当前状态......", "温馨提示");
         List <Class_WindowType> class_WindowTypes = new List <Class_WindowType>();
         foreach (XtraMdiTabPage xtra in xtraTabbedMdiManager1.Pages)
         {
             if (ActiveMDIForm.Tag != null)
             {
                 Class_WindowType class_WindowType = new Class_WindowType();
                 class_WindowType = xtra.MdiChild.Tag as Class_WindowType;
                 if (class_WindowType != null)
                 {
                     if (class_WindowType.XmlFileName == (ActiveMDIForm.Tag as Class_WindowType).XmlFileName)
                     {
                         class_WindowType.ActiveSign = true;
                     }
                     class_WindowTypes.Add(class_WindowType);
                 }
             }
         }
         Class_SQLiteOperator class_SQLiteOperator = new Class_SQLiteOperator();
         class_SQLiteOperator.SaveCurrentOpenWin(class_WindowTypes);
         waitDialogForm.Close();
         waitDialogForm.Dispose();
         e.Cancel = false;
     }
     else
     {
         e.Cancel = true;
     }
 }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: 406544970/MDIDemo
        private void openFirstPage()
        {
            Class_WindowType class_WindowType = new Class_WindowType();

            class_WindowType.WindowType  = "welcome";
            class_WindowType.XmlFileName = "代码生成器欢迎您啊!";
            Form_welCome form_WelCome = new Form_welCome(mySkinName);

            form_WelCome.Tag      = class_WindowType;
            form_WelCome.mainPage = this;
            OpenSubForm(form_WelCome);

            displayOkMessage(string.Format("{0}登录成功", Class_MyInfo.UseNameValue));
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: 406544970/MDIDemo
        private void OpenSubForm(Form OpenPage)
        {
            RefreshForm(true);
            bool finder = false;
            int  num    = -1;

            foreach (Form Children in this.MdiChildren)
            {
                num++;
                Class_WindowType ChildrenTag = new Class_WindowType()
                {
                    XmlFileName = (Children.Tag as Class_WindowType).XmlFileName,
                    WindowType  = (Children.Tag as Class_WindowType).WindowType,
                };
                Class_WindowType OpenPageTag = new Class_WindowType()
                {
                    XmlFileName = (OpenPage.Tag as Class_WindowType).XmlFileName,
                    WindowType  = (OpenPage.Tag as Class_WindowType).WindowType,
                };
                if (OpenPageTag.XmlFileName != null && ChildrenTag.XmlFileName.Equals(OpenPageTag.XmlFileName))
                {
                    finder = true;
                    Children.WindowState = FormWindowState.Maximized;
                    Children.Select();
                    Children.BringToFront();
                    if (this.xtraTabbedMdiManager1.MdiParent != null)
                    {
                        this.xtraTabbedMdiManager1.Pages[Children].TabControl.ViewInfo.SelectedTabPageIndex = num;
                    }
                    break;
                }
            }
            if (!finder)
            {
                WaitDialogForm waitDialogForm = new WaitDialogForm("正在玩命加载中......", "温馨提示");
                OpenPage.MdiParent   = this;
                OpenPage.WindowState = FormWindowState.Maximized;
                OpenPage.Show();
                if (this.xtraTabbedMdiManager1.MdiParent != null)
                {
                    this.xtraTabbedMdiManager1.Pages[OpenPage].TabControl.ViewInfo.SelectedTabPageIndex = base.MdiChildren.Length - 1;
                }
                waitDialogForm.Close();
                waitDialogForm.Dispose();
            }

            RefreshForm(false);
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: 406544970/MDIDemo
        public void OpenDeleteWin(string xmlFileName)
        {
            IClass_InterFaceDataBase class_InterFaceDataBase;
            Class_PublicMethod       class_PublicMethod   = new Class_PublicMethod();
            Class_DeleteAllModel     class_DeleteAllModel = new Class_DeleteAllModel();

            Class_DeleteAllModel.Class_InsertDataBase class_DeleteDataBase = new Class_DeleteAllModel.Class_InsertDataBase();
            try
            {
                Class_WindowType class_WindowType = new Class_WindowType();
                class_WindowType.WindowType = "delete";
                Form_Delete form;
                if (xmlFileName != null)
                {
                    if (File.Exists(string.Format("{0}\\delete\\{1}.xml", Application.StartupPath, xmlFileName)))
                    {
                        class_DeleteAllModel = class_PublicMethod.FromXmlToDeleteObject <Class_DeleteAllModel>(xmlFileName);
                        class_DeleteDataBase = class_DeleteAllModel.class_SelectDataBase;
                        switch (class_DeleteDataBase.databaseType)
                        {
                        case "MySql":
                            class_InterFaceDataBase = new Class_MySqlDataBase(class_DeleteDataBase.dataSourceUrl, class_DeleteDataBase.dataBaseName, class_DeleteDataBase.dataSourceUserName, class_DeleteDataBase.dataSourcePassWord, class_DeleteDataBase.Port);
                            break;

                        case "SqlServer 2017":
                            class_InterFaceDataBase = new Class_SqlServer2017DataBase(class_DeleteDataBase.dataSourceUrl, class_DeleteDataBase.dataBaseName, class_DeleteDataBase.dataSourceUserName, class_DeleteDataBase.dataSourcePassWord);
                            break;

                        default:
                            class_InterFaceDataBase = new Class_MySqlDataBase(class_DeleteDataBase.dataSourceUrl, class_DeleteDataBase.dataBaseName, class_DeleteDataBase.dataSourceUserName, class_DeleteDataBase.dataSourcePassWord, class_DeleteDataBase.Port);
                            break;
                        }
                        class_WindowType.XmlFileName = xmlFileName;
                        form      = new Form_Delete(mySkinName, xmlFileName);
                        form.Text = string.Format("DELETE:{0}", xmlFileName);
                        form.Tag  = class_WindowType;
                        OpenSubForm(form);
                    }
                    else
                    {
                        MessageBox.Show(string.Format("文件【{0}.xml】不存在,无法打开界面!", xmlFileName)
                                        , "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    form      = new Form_Delete(mySkinName);
                    form.Text = "新DELETE";
                    form.Tag  = class_WindowType;
                    OpenSubForm(form);
                }
            }
            catch (Exception e)
            {
                if (xmlFileName != null)
                {
                    MessageBox.Show(string.Format("数据库[{0}:{3}]:Url[{1}],端口[{2}],连接失败,无法打开该界面!\r\n异常:{4}。"
                                                  , class_DeleteDataBase.databaseType
                                                  , class_DeleteDataBase.dataSourceUrl
                                                  , class_DeleteDataBase.Port
                                                  , class_DeleteDataBase.dataBaseName
                                                  , e.Message)
                                    , "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show(string.Format("异常:{0}。", e.Message)
                                    , "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: 406544970/MDIDemo
        private void OpenHistoryWin()
        {
            List <Class_WindowType> class_WindowTypes    = new List <Class_WindowType>();
            Class_SQLiteOperator    class_SQLiteOperator = new Class_SQLiteOperator();

            class_WindowTypes            = class_SQLiteOperator.GetWindowTypes();
            this.barEditItem2.Visibility = BarItemVisibility.Always;
            if ((class_WindowTypes != null) && (class_WindowTypes.Count > 0))
            {
                this.repositoryItemProgressBar2.Maximum = class_WindowTypes.Count;
                this.repositoryItemProgressBar2.Minimum = 0;
                Class_WindowType OpenPageTag = new Class_WindowType();
                int Counter = 0;
                foreach (Class_WindowType class_WindowType in class_WindowTypes)
                {
                    if (class_WindowType.ActiveSign)
                    {
                        OpenPageTag.XmlFileName = class_WindowType.XmlFileName;
                        OpenPageTag.WindowType  = class_WindowType.WindowType;
                        OpenPageTag.ActiveSign  = class_WindowType.ActiveSign;
                    }
                    switch (class_WindowType.WindowType)
                    {
                    case "select":
                        OpenSelectWin(class_WindowType.XmlFileName);
                        break;

                    case "insert":
                        OpenInsertWin(class_WindowType.XmlFileName);
                        break;

                    case "update":
                        OpenUpdateWin(class_WindowType.XmlFileName);
                        break;

                    case "delete":
                        OpenDeleteWin(class_WindowType.XmlFileName);
                        break;

                    case "welcome":
                        openFirstPage();
                        break;

                    default:
                        OpenSelectWin(class_WindowType.XmlFileName);
                        break;
                    }
                    this.barEditItem2.EditValue = (++Counter).ToString();
                    Thread.Sleep(0);
                    Application.DoEvents();
                }
                int num = -1;
                foreach (Form Children in this.MdiChildren)
                {
                    num++;
                    Class_WindowType ChildrenTag = new Class_WindowType()
                    {
                        XmlFileName = (Children.Tag as Class_WindowType).XmlFileName,
                        WindowType  = (Children.Tag as Class_WindowType).WindowType,
                    };
                    if (ChildrenTag.XmlFileName.Equals(OpenPageTag.XmlFileName))
                    {
                        Children.WindowState = FormWindowState.Maximized;
                        Children.Select();
                        Children.BringToFront();
                        if (this.xtraTabbedMdiManager1.MdiParent != null)
                        {
                            this.xtraTabbedMdiManager1.Pages[Children].TabControl.ViewInfo.SelectedTabPageIndex = num;
                        }
                        break;
                    }
                }
            }
            this.barEditItem2.Visibility = BarItemVisibility.Never;
        }