예제 #1
0
파일: MainForm.cs 프로젝트: ewcasas/DVTK
        private void ActionOpenProjectOrSession()
        {
            bool hasUserCancelledOperation = false;

            // If unsaved changes exist for the project and/or sessions, ask the user
            // whether to save them.

            if ((_Project.IsProjectConstructed) && (_Project.AreProjectOrSessionsChanged()))
            {
                _Project.Save(true);
                hasUserCancelledOperation = _Project._HasUserCancelledLastOperation;
            }

            if (!hasUserCancelledOperation)
            {
                if (this.DialogOpenProject.ShowDialog (this) == DialogResult.OK)
                {
                    ProjectForm2 child_project;

                    if (_Project.IsProjectConstructed)
                    {
                        // User already decided what to save.
                        _Project.Close(false);

                        CloseAlProjectForms();
                    }

                    FileInfo file = new FileInfo(this.DialogOpenProject.FileName);

                    if (file.Extension == ".pdvt")
                    {
                        _Project.display_message = new Dvt.Project.CallBackMessageDisplay (this.CallBackMessageDisplay);
                        _Project.Load(this.DialogOpenProject.FileName);
                    }

                    if (file.Extension == ".ses")
                    {
                        _Project.display_message = new Dvt.Project.CallBackMessageDisplay (this.CallBackMessageDisplay);
                        _Project.New(this.DialogOpenProject.FileName.Replace (".ses", ".pdvt"));
                        _Project.AddSession (this.DialogOpenProject.FileName);
                    }
                    child_project = new ProjectForm2(_Project, this);

                    child_project.MdiParent = this;

                    child_project.Show();
                    child_project.Activate();

                    // Make the project form update itself completely.
                    child_project.Update(this, new UpdateAll());
                }
                else
                {
                    // No project or session is opened, but
                    // changed project and/or changes sessions may have been saved.
                    Notify(this, new Saved());
                }

                this.UpdateUIControls ();
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: ewcasas/DVTK
        private void ActionNew()
        {
            bool hasUserCancelledOperation = false;
            WizardNew   wizard;

            // If unsaved changes exist for the project and/or sessions, ask the user
            // whether to save them.
            if (_Project.AreProjectOrSessionsChanged())
            {
                // The user decides whether or what to save.
                _Project.Save(true);
                hasUserCancelledOperation = _Project.HasUserCancelledLastOperation();
            }

            if (!hasUserCancelledOperation)
            {
                wizard = new WizardNew (WizardNew.StartPage.project);
                wizard.Text = "New Project Wizard";

                wizard.ShowDialog(this);

                if (wizard.has_created_project)
                {
                    ProjectForm2     child_project;

                    // If a project is loaded, close the project and close all project forms
                    if (_Project.IsProjectConstructed)
                    {
                        // The user already has indicated which unsaved changes needed to be saved,
                        // so don't ask a second time.
                        _Project.Close(false);

                        CloseAlProjectForms();
                    }

                    wizard.ConstructAndSaveProject(_Project);

                    child_project = new ProjectForm2 (_Project, this);
                    child_project.MdiParent = this;

                    child_project.Show ();
                    child_project.Activate();

                    // Make the project form update itself completely.
                    child_project.Update(this, new UpdateAll());

                }
                else
                {
                    // No project is created using the wizard, but
                    // changed project and/or changes sessions may have been saved.
                    Notify(this, new Saved());
                }

                UpdateUIControls ();
            }
        }
예제 #3
0
파일: MainForm.cs 프로젝트: ewcasas/DVTK
        private void WindowNewProjectViewAndTile_Click(object sender, System.EventArgs e)
        {
            ProjectForm2 theChildProjectForm = new ProjectForm2(_Project, this);

            theChildProjectForm.MdiParent = this;

            // Note: Show is not robust enough for MDI childs with window state maximized.
            // Workaround: Forcing all existing child windows to window state normal before show.
            foreach (object theObject in this.MdiChildren)
            {
                ProjectForm2 theProjectForm2 = theObject as ProjectForm2;
                if (theProjectForm2 != null)
                {
                    theProjectForm2.WindowState = FormWindowState.Normal;
                }
            }

            theChildProjectForm.Show ();
            theChildProjectForm.Activate();

            this.LayoutMdi (MdiLayout.TileHorizontal);

            // Make the project form update itself completely.
            UpdateAll theUpdateAll = new UpdateAll();
            theChildProjectForm.Update(this, theUpdateAll);

            this.UpdateUIControls ();
        }
예제 #4
0
파일: MainForm.cs 프로젝트: ewcasas/DVTK
        private void WindowNewProjectView_Click(object sender, System.EventArgs e)
        {
            ProjectForm2 theChildProjectForm = new ProjectForm2(_Project, this);

            theChildProjectForm.MdiParent = this;

            theChildProjectForm.Show ();
            theChildProjectForm.Activate();

            // Make the project form update itself completely.
            UpdateAll theUpdateAll = new UpdateAll();
            theChildProjectForm.Update(this, theUpdateAll);

            this.UpdateUIControls ();
        }
예제 #5
0
파일: MainForm.cs 프로젝트: ewcasas/DVTK
        public MainForm()
        {
            _UserSettings.Load();

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Cursor.Current = Cursors.WaitCursor;

            // Create the singleton array class for all supported Transfer Syntaxes

            Dvtk.Setup.Initialize ();
            _FindForm = new FindForm(this);

            if (_StartWithProjectFile != "")
            {
                _Project.display_message = new Dvt.Project.CallBackMessageDisplay (this.CallBackMessageDisplay);
                _Project.Load(_StartWithProjectFile);
            }
            else if (_StartWithSessionFile != "")
            {
                _Project.display_message = new Dvt.Project.CallBackMessageDisplay (this.CallBackMessageDisplay);
                _Project.New(_StartWithSessionFile.ToLower().Replace (".ses", ".pdvt"));
                _Project.AddSession (_StartWithSessionFile);
            }

            if (_Project.IsProjectConstructed)
            {
                ProjectForm2 theProjectForm = new ProjectForm2(_Project, this);

                theProjectForm.MdiParent = this;

                theProjectForm.Show();
                theProjectForm.Activate();

                // Make the project form update itself completely.
                UpdateAll theUpdateAll = new UpdateAll();
                theProjectForm.Update(this, theUpdateAll);
            }

            this.UpdateUIControls ();

            Cursor.Current = Cursors.Default;
        }