예제 #1
0
        public SessionTreeViewManager(ProjectForm2 theParentForm, Project theProject, System.Windows.Forms.TreeView theSessionTreeView)
        {
            _ParentForm = theParentForm;
            _MainForm = (MainForm)_ParentForm._MainForm;
            _Project = theProject;
            _SessionTreeView = theSessionTreeView;

            _StorageSCUEmulatorFormAsyncCallback = new System.AsyncCallback(this.ResultsFromExecutingEmulatorStorageScuAsynchronously);
            _StorageSCUEmulatorForm = new StorageSCUEmulatorForm(_StorageSCUEmulatorFormAsyncCallback);
        }
예제 #2
0
        /// <summary>
        /// This method will be called is this project form is closed or when
        /// the main form is closed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProjectForm2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            bool theMainFormIsClosing = true;

            // We don't know if calling of this method this is a consequence of closing this project form or
            // as a consequence of closing the main form.
            // The following code is needed to find this out (see the Form class Closing event in MSDN)

            if (((MainForm)ParentForm)._IsClosing)
                // Closing is done through the Exit menu item.
            {
                theMainFormIsClosing = true;
            }
            else
                // The X from the MainForm or ProjectForm2 is pressed.
            {

                // The position of the cursor in screen coordinates.
                Point theCursorPosition = Cursor.Position;

                if ((ParentForm.Top + SystemInformation.CaptionHeight) < theCursorPosition.Y)
                {
                    theMainFormIsClosing = false;
                }
                else
                {
                    theMainFormIsClosing = true;
                }
            }

            // Close if allowed.
            if (theMainFormIsClosing)
            {
                // Don't do anything.
                // The Main form will also receive a closing event and handle the closing of the application.
            }
            else
            {
                e.Cancel = false;
                MainForm theMainForm = (MainForm)ParentForm;
                DialogResult theDialogResult;

                if (IsExecuting())
                {
                    // Ask the user if execution needs to be stopped.
                    theDialogResult = MessageBox.Show("Executing is still going on.\nStop execution?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

                    if (theDialogResult == DialogResult.Yes)
                    {
                        // Stop the execution.
                        Notify(new StopExecution(this));

                        // Because execution is performed in a different thread, wait some
                        // time to enable the execution to stop. Also give feedback to the user
                        // of this waiting by showing a form stating this.
                        TimerMessageForm theTimerMessageForm = new TimerMessageForm();

                        theTimerMessageForm.ShowDialogSpecifiedTime("Stopping execution...", 3000);

                        // Find out if execution really has stopped.
                        if (IsExecuting())
                        {
                            theDialogResult = MessageBox.Show("Failed to stop execution.\n This form will not be closed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                            e.Cancel = true;
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }

                if (ParentForm.MdiChildren.Length == 1)
                    // This is the last project form that is being closed,
                    // so the project needs to be closed.
                {
                    if (!e.Cancel)
                    {
                        // e.Cancel is false, so no execution takes place any more.
                        // Close the project.
                        // If unsaved changes exist, give the user the possibility to save them.
                        _Project.Close(true);

                        if (_Project.HasUserCancelledLastOperation())
                            // The user has cancelled the close operation.
                        {
                            // Cancel the closing of this last project form.
                            e.Cancel = true;
                        }
                        else
                            // The user has not cancelled the close operation.
                        {
                            _Project = null;
                            Notify(new ProjectClosed());
                        }
                    }
                }
            }
        }
예제 #3
0
파일: WizardNew.cs 프로젝트: ewcasas/DVTK
        public void ConstructAndSaveProject(Project theProject)
        {
            theProject.display_message = new Dvt.Project.CallBackMessageDisplay (this.CallBackMessageDisplay);

            theProject.New(this.ProjectFileName.Text);

            foreach (object session in this.ListBoxSessions.Items)
            {
                theProject.AddSession(session.ToString());
            }

            theProject.SaveProject();
        }
예제 #4
0
        public ProjectForm2(Project theProject, MainForm theMainForm)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _ActivityReportEventHandler = new Dvtk.Events.ActivityReportEventHandler(TCM_OnActivityReportEvent);

            _Project = theProject;
            _MainForm = theMainForm;
            ListBoxSecuritySettings.SelectedIndex = 0;
            _SessionTreeViewManager = new SessionTreeViewManager(this, theProject, SessionTreeView);
            _SopClassesManager = new SopClassesManager(this, DataGridSpecifySopClasses, ComboBoxSpecifySopClassesAeTitle, ListBoxSpecifySopClassesDefinitionFileDirectories, RichTextBoxSpecifySopClassesInfo, _SessionTreeViewManager, ButtonSpecifySopClassesRemoveDirectory);
            _TCM_ValidationResultsManager = new ValidationResultsManager(WebDescriptionView);

            _TCM_ValidationResultsManager1 = new ValidationResultsManager(axWebBrowserScript);

            // Because the webbrowser navigation is "cancelled" when browsing to an .xml file
            // first another html file has to be shown to make this work under Windows 2000.
            _TCM_ValidationResultsManager.ShowHtml("about:blank");

            _TCM_AppendTextToActivityLogging_ThreadSafe_Delegate = new TCM_AppendTextToActivityLogging_ThreadSafe_Delegate(this.TCM_AppendTextToActivityLogging_ThreadSafe);

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            // MK!!!
        }
예제 #5
0
파일: ProjectForm.cs 프로젝트: ewcasas/DVTK
        public ProjectForm(Project project_data)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Set the callback for activity logging.
            _activity_handler = new Dvtk.Events.ActivityReportEventHandler(this.OnActivityReportEvent);

            // Set the event handler used when a process if finished executing.
            this.RunningProcessEvent += new EventHandler(FinishRunningProcessExecution);

            this.project = project_data;

            if (this.project.GetNrSessions () > 0)
            {
                this.UpdateSessionTreeView ();
                this.SessionBrowser.Select();
            }
            else
            {
                // No session file is available, this means that no session is selected.
                // Normally when selecting a session, all controls on the form are updated and
                // resized. Now we have to explicitly resize the form.
                this._active_page = ActivePage.session;
                this.UpdatePageVisibility ();
                //this.ResizeProjectForm ();
            }

            // Initialize the tablestyle for the SOPClass view. This can be done
            // only once.
            this.SOPClasses.TableStyles.Add (this.CreateTableStyle());
        }