コード例 #1
0
ファイル: main.cs プロジェクト: sf71316/SQLTool
        private void NewFile()
        {
            this.ClearNotify();
            saveFileDialog.Title      = "Choose new project file folder";
            saveFileDialog.DefaultExt = "json";
            saveFileDialog.Filter     = "json files (*.json)|*.json|project files (*.sdj)|*.sdj";
            var result = saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                var frm = new newprojfrm(saveFileDialog.FileName);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    // this.MdiChildren.ToList().ForEach(p => p.Close());
                    frm.Project.SavePath = saveFileDialog.FileName;
                    var editor = new editor(frm.Project);
                    editor.MdiParent = this;
                    editor.Dock      = DockStyle.Fill;
                    editor.Show();
                    editor.Focus();
                    editor.WindowState             = FormWindowState.Maximized;
                    this.SaveStripMenuItem.Enabled = true;
                }
            }
        }
コード例 #2
0
ファイル: main.cs プロジェクト: sf71316/SQLTool
        private async void OpenFile()
        {
            this.ClearNotify();
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                //this.MdiChildren.ToList().ForEach(p => p.Close());
                ProjectModel model   = new ProjectModel();
                var          project = await model.LoadAsync(openFileDialog.FileName);

                if (project != null)
                {
                    project.SavePath = openFileDialog.FileName;
                    var editor = new editor(project);
                    editor.MdiParent = this;
                    editor.Dock      = DockStyle.Fill;
                    editor.Show();
                    editor.Focus();
                    editor.WindowState             = FormWindowState.Maximized;
                    this.SaveStripMenuItem.Enabled = true;
                }
                else
                {
                    MessageBox.Show("this file can't open.", "Error");
                }
            }
        }