Beispiel #1
0
        public void UnSelectAllDefinitionFiles()
        {
            int tempCount = 0;

            DvtkApplicationLayer.Session theSession     = GetSessionTreeViewManager().GetSession();
            DataGridBoolColumn           dataBoolColumn = new DataGridBoolColumn();

            foreach (DefinitionFile theDefinitionFile in  _DefinitionFilesInfoForDataGrid)
            {
                string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);
                theSession.Implementation.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                //_DataGridSopClasses[tempCount,0] = dataBoolColumn.FalseValue;
                // Get the column style for the "loaded" column.
                DataGridColumnStyle theColStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                _DataGridSopClasses.BeginEdit(theColStyle, tempCount);
                theDefinitionFile.Loaded = false;
                _DataGridSopClasses.EndEdit(theColStyle, tempCount, false);

                tempCount++;
            }

            _DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");
            // Notify the rest of the world.
            SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);

            Notify(theSessionChange);
        }
Beispiel #2
0
        /// <summary>
        /// The reason we handle the mouseup event ourselves, is because with the normal
        /// grid, you first have to select a cell, and only then you can enable/disable a
        /// checkbox. We want to enable/disable the checkbox with 1 click.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;
            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();

            // Find out what part of the data grid is below the mouse pointer.
            theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

            switch (theHitTestInfo.Type)
            {
            case System.Windows.Forms.DataGrid.HitTestType.Cell:
                // If this is the "loaded" column...
                if (theHitTestInfo.Column == 0)
                {
                    // Remember the cell we've changed. We don't want to change this cell when we move the mouse.
                    // (see DataGrid_MouseMove).
                    _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                    // Get the column style for the "loaded" column.
                    DataGridColumnStyle theDataGridColumnStyle;
                    theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                    // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                    _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                    DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                    theDefinitionFile.Loaded = !theDefinitionFile.Loaded;
                    _DataGridSopClasses.EndEdit(theDataGridColumnStyle, theHitTestInfo.Row, false);


                    // Change the "loaded" state in the session object.
                    string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                    if (theDefinitionFile.Loaded)
                    {
                        // The definition file was not loaded yet. Load it now.
                        theSession.Implementation.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                    }
                    else
                    {
                        // The definition file was loaded. Unload it now.
                        theSession.Implementation.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                    }

                    // Remember the new "loaded" state for the case where the mouse is moved over other
                    // "loaded" checkboxes while keeping the left mouse button pressed.
                    _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown = theDefinitionFile.Loaded;

                    // Notify the rest of the world.
                    SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                    Notify(theSessionChange);
                }

                if (theHitTestInfo.Column == 1)
                {
                    DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                    DefinitionName = theDefinitionFile.Filename;
                }
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Add a definition file direcotory.
        /// </summary>
        public void AddDefinitionFileDirectory()
        {
            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();
            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.Implementation.DefinitionManagement.DefinitionFileDirectoryList;

            FolderBrowserDialog theFolderBrowserDialog = new FolderBrowserDialog();

            theFolderBrowserDialog.Description = "Select the directory where definition files are located.";

            if (theFolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                bool   isExistingDirectory = false;
                string theNewDirectory     = GetDirectoryWithTrailingSlashesRemoved(theFolderBrowserDialog.SelectedPath);

                // Find out if this new directory already exists.
                foreach (string theExistingDirectory in theDefinitionFileDirectoryList)
                {
                    if (theNewDirectory == GetDirectoryWithTrailingSlashesRemoved(theExistingDirectory))
                    {
                        isExistingDirectory = true;
                        break;
                    }
                }

                theNewDirectory = theNewDirectory + "\\";

                // Only add this new directory if it does not already exist.
                if (!isExistingDirectory)
                {
                    DirectoryInfo theDirectoryInfo = new DirectoryInfo(theNewDirectory);

                    // If the new directory is not valid, show an error message.
                    if (!theDirectoryInfo.Exists)
                    {
                        MessageBox.Show("The directory \"" + theNewDirectory + "\" is not a valid directory.",
                                        "Directory not added",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        theDefinitionFileDirectoryList.Add(theNewDirectory);

                        // Notify the rest of the world.
                        // This will implicitly also update this specify SOP classes tab.

                        SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_OTHER);
                        Notify(theSessionChange);
                    }
                }
                else
                {
                    MessageBox.Show("The directory \"" + theNewDirectory + "\" is already present in\nthe list of definition file directories.",
                                    "Directory not added",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
        }
Beispiel #4
0
        public void SelectedAeTitleVersionChanged()
        {
            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();

            AeTitleVersion theAeTitleVersion = (AeTitleVersion)_ComboBoxAeTitle.SelectedItem;

            if ((theAeTitleVersion._AeTitle != theSession.Implementation.DefinitionManagement.ApplicationEntityName) ||
                (theAeTitleVersion._Version != theSession.Implementation.DefinitionManagement.ApplicationEntityVersion))
            {
                theSession.Implementation.DefinitionManagement.ApplicationEntityName    = theAeTitleVersion._AeTitle;
                theSession.Implementation.DefinitionManagement.ApplicationEntityVersion = theAeTitleVersion._Version;
                // TO DO
                SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_AE_TITLE_VERSION);
                Notify(theSessionChange);
            }
        }
Beispiel #5
0
        public void RemoveDefinitionFileDirectory()
        {
            string theSelectedDirectory;

            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();
            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.Implementation.DefinitionManagement.DefinitionFileDirectoryList;
            theSelectedDirectory = (string)_ListBoxDefinitionFileDirectories.SelectedItem;
            theDefinitionFileDirectoryList.Remove(theSelectedDirectory);
            theSession.HasSessionChanged = true;
            // Notify the rest of the world.
            // This will implicitly also update this specify SOP classes tab.
            // TO DO
            Update();
            SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_OTHER);

            Notify(theSessionChange);
        }
Beispiel #6
0
        /// <summary>
        /// When moving the mouse over other "loaded" check box while keeping the left mouse button pressed,
        /// change the "loaded" state to the new state when the left mouse button was pressed.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            if (e.Button == MouseButtons.Left)
            {
                System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;

                theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

                switch (theHitTestInfo.Type)
                {
                case System.Windows.Forms.DataGrid.HitTestType.Cell:
                    // If this is the "loaded" column...
                    if (theHitTestInfo.Column == 0)
                    {
                        // If another "loaded" check box is pointed to, not the one where the state has
                        // last been changed...
                        if (theHitTestInfo.Row != _MouseEventInfoForDataGrid_LoadedStateChangedForRow)
                        {
                            DefinitionFile theDefinitionFile     = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                            bool           theCurrentLoadedState = theDefinitionFile.Loaded;

                            // Only if the state will change...
                            if (theCurrentLoadedState != _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown)
                            {
                                // Get the column style for the "loaded" column.
                                DataGridColumnStyle theDataGridColumnStyle;
                                theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                                // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                                _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                                theDefinitionFile.Loaded = _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown;
                                _DataGridSopClasses.EndEdit(theDataGridColumnStyle, theHitTestInfo.Row, false);

                                // Change the "loaded" state in the session object.
                                string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                                if (_MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown)
                                {
                                    // The definition file was not loaded yet. Load it now.
                                    theSession.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                                }
                                else
                                {
                                    // The definition file was loaded. Unload it now.
                                    theSession.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                                }

                                // Remember the cell we've changed. We don't want to change the loaded
                                // state with each minor mouse move.
                                _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                                // Notify the rest of the world.
                                SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                                Notify(theSessionChange);
                            }
                            else
                            // State will not change. The cell under the mouse will not be selected. This
                            // results in scrolling that will not work when the mouse is moved to the bottom
                            // of the datagrid.
                            //
                            // To solve this, explicitly make the cell under the mouse selected.
                            {
                                DataGridCell currentSelectedCell = _DataGridSopClasses.CurrentCell;
                                DataGridCell newSelectedCell     = new DataGridCell(theHitTestInfo.Row, currentSelectedCell.ColumnNumber);

                                _DataGridSopClasses.CurrentCell = newSelectedCell;
                            }
                        }
                    }
                    break;
                }
            }
        }
Beispiel #7
0
        private void UpdateTlsVersionFlag(Dvtk.Sessions.TlsVersionFlags theVersionFlag, CheckBox theCheckBox)
        {
            if (GetSelectedSessionNew().Implementation is Dvtk.Sessions.ISecure)
            {
                Dvtk.Sessions.ISecuritySettings theISecuritySettings = null;
                theISecuritySettings = (GetSelectedSessionNew().Implementation as Dvtk.Sessions.ISecure).SecuritySettings;

                bool isCurrentlyChecked = ((theISecuritySettings.TlsVersionFlags & theVersionFlag) != 0);

                try
                {
                    if (theCheckBox.Checked)
                    {
                        theISecuritySettings.TlsVersionFlags |= theVersionFlag;
                    }
                    else
                    {
                        theISecuritySettings.TlsVersionFlags &= ~theVersionFlag;
                    }

                    SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
                catch (Exception theException)
                {
                    // Put the state of the check box back to the unchanged setting of the session.
                    theCheckBox.Checked = isCurrentlyChecked;

                    MessageBox.Show(theException.Message + "\n\nThe change for checkbox \"" + theCheckBox.Text + "\" is not allowed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                // Sanity check.
                Debug.Assert(false);
            }
        }
Beispiel #8
0
        private void TextBoxSUTTCPIPAddress_TextChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                DvtkApplicationLayer.Session session = GetSession();

                if (session is DvtkApplicationLayer.ScriptSession)
                {
                    (session as DvtkApplicationLayer.ScriptSession).SutHostName = TextBoxSUTTCPIPAddress.Text;
                }
                else if(session is DvtkApplicationLayer.EmulatorSession)
                {
                    (session as DvtkApplicationLayer.EmulatorSession).SutHostName = TextBoxSUTTCPIPAddress.Text;
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #9
0
        private void NumericSUTMaxPDU_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.

            if (_TCM_UpdateCount == 0)
            {
                DvtkApplicationLayer.Session session = GetSession();

                if (session is DvtkApplicationLayer.ScriptSession)
                {
                    (session as DvtkApplicationLayer.ScriptSession).SutMaximumLengthReceived = (uint)NumericSUTMaxPDU.Value;
                }
                else if(session is DvtkApplicationLayer.EmulatorSession)
                {
                    (session as DvtkApplicationLayer.EmulatorSession).SutMaximumLengthReceived = (uint)NumericSUTMaxPDU.Value;
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #10
0
        private void NumericSessonID_ValueChanged(object sender, EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                GetSession().SessionId = System.Convert.ToUInt16(NumericSessonID.Value);

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #11
0
        private void ComboBoxStorageMode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                switch(ComboBoxStorageMode.SelectedIndex)
                {
                    case 0:
                        GetSelectedSessionNew().Mode = DvtkApplicationLayer.Session.StorageMode.AsDataSet;
                        break;

                    case 1:
                        GetSelectedSessionNew().Mode = DvtkApplicationLayer.Session.StorageMode.AsMedia;
                        break;

                    case 2:
                        GetSelectedSessionNew().Mode = DvtkApplicationLayer.Session.StorageMode.AsMediaOnly;
                        break;

                    case 3:
                        GetSelectedSessionNew().Mode = DvtkApplicationLayer.Session.StorageMode.NoStorage;
                        break;

                    default:
                        // Not supposed to get here.
                        Debug.Assert(false);
                        break;
                }

                SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #12
0
        public void SelectedAeTitleVersionChanged()
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            AeTitleVersion theAeTitleVersion = (AeTitleVersion)_ComboBoxAeTitle.SelectedItem;

            if ( (theAeTitleVersion._AeTitle != theSession.DefinitionManagement.ApplicationEntityName) ||
                (theAeTitleVersion._Version != theSession.DefinitionManagement.ApplicationEntityVersion) )
            {
                theSession.DefinitionManagement.ApplicationEntityName = theAeTitleVersion._AeTitle;
                theSession.DefinitionManagement.ApplicationEntityVersion = theAeTitleVersion._Version;

                SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_AE_TITLE_VERSION);

                Notify(theSessionChange);
            }
        }
Beispiel #13
0
        private void TextBoxSUTTCPIPAddress_TextChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                if (GetSelectedSession() is Dvtk.Sessions.IConfigurableSut)
                {
                    Dvtk.Sessions.ISutSystemSettings theISutSystemSettings = null;
                    theISutSystemSettings = (GetSelectedSession() as Dvtk.Sessions.IConfigurableSut).SutSystemSettings;

                    theISutSystemSettings.HostName = TextBoxSUTTCPIPAddress.Text;

                    SessionChange theSessionChange = new SessionChange(GetSelectedSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }
            }
        }
Beispiel #14
0
        public void UnSelectAllDefinitionFiles()
        {
            int tempCount = 0;
            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();
            DataGridBoolColumn dataBoolColumn = new DataGridBoolColumn();
            foreach (DefinitionFile theDefinitionFile in  _DefinitionFilesInfoForDataGrid)
            {
                string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);
                theSession.Implementation.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                //_DataGridSopClasses[tempCount,0] = dataBoolColumn.FalseValue;
                // Get the column style for the "loaded" column.
                DataGridColumnStyle theColStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                _DataGridSopClasses.BeginEdit(theColStyle, tempCount);
                theDefinitionFile.Loaded = false;
                _DataGridSopClasses.EndEdit (theColStyle, tempCount, false);

                tempCount++ ;
            }

            _DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid , "");
            // Notify the rest of the world.
            SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
            Notify(theSessionChange);
        }
Beispiel #15
0
        private void ButtonBrowseDataDirectory_Click(object sender, EventArgs e)
        {
            TheFolderBrowserDialog.Description = "Select the data directory where the data files should be stored.";

            // Only if the current directory exists, set this directory in the dialog browser.
            if (TextBoxDataRoot.Text != "")
            {
                DirectoryInfo theDirectoryInfo = new DirectoryInfo(TextBoxDataRoot.Text);

                if (theDirectoryInfo.Exists)
                {
                    TheFolderBrowserDialog.SelectedPath = TextBoxDataRoot.Text;
                }
            }

            if (TheFolderBrowserDialog.ShowDialog(this) == DialogResult.OK)
            {
                TextBoxDataRoot.ReadOnly = false;
                int index = TheFolderBrowserDialog.SelectedPath.IndexOf("#");
                if (index < 0)
                {
                    if (GetSession().DataDirectory != TheFolderBrowserDialog.SelectedPath)
                    {
                        GetSession().DataDirectory = TheFolderBrowserDialog.SelectedPath;
                        TextBoxDataRoot.Text = TheFolderBrowserDialog.SelectedPath;
                        TextBoxDataRoot.ReadOnly = true;

                        // Notify the rest of the world of the change.
                        SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                        Notify(theSessionChange);
                    }
                }
                else
                {
                    MessageBox.Show("Data Directory with '#' in it is not allowed . Please select another result directory.", "Warning");
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// When moving the mouse over other "loaded" check box while keeping the left mouse button pressed,
        /// change the "loaded" state to the new state when the left mouse button was pressed.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            if (e.Button == MouseButtons.Left)
            {
                System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;

                theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

                switch (theHitTestInfo.Type)
                {
                    case System.Windows.Forms.DataGrid.HitTestType.Cell:
                        // If this is the "loaded" column...
                        if (theHitTestInfo.Column == 0)
                        {
                            // If another "loaded" check box is pointed to, not the one where the state has
                            // last been changed...
                            if (theHitTestInfo.Row != _MouseEventInfoForDataGrid_LoadedStateChangedForRow)
                            {
                                DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                                bool theCurrentLoadedState = theDefinitionFile.Loaded;

                                // Only if the state will change...
                                if (theCurrentLoadedState != _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown)
                                {
                                    // Get the column style for the "loaded" column.
                                    DataGridColumnStyle theDataGridColumnStyle;
                                    theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                                    // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                                    _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                                    theDefinitionFile.Loaded = _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown;
                                    _DataGridSopClasses.EndEdit (theDataGridColumnStyle, theHitTestInfo.Row, false);

                                    // Change the "loaded" state in the session object.
                                    string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                                    if (_MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown)
                                    {
                                        // The definition file was not loaded yet. Load it now.
                                        theSession.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                                    }
                                    else
                                    {
                                        // The definition file was loaded. Unload it now.
                                        theSession.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                                    }

                                    // Remember the cell we've changed. We don't want to change the loaded
                                    // state with each minor mouse move.
                                    _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                                    // Notify the rest of the world.
                                    SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                                    Notify(theSessionChange);
                                }
                                else
                                    // State will not change. The cell under the mouse will not be selected. This
                                    // results in scrolling that will not work when the mouse is moved to the bottom
                                    // of the datagrid.
                                    //
                                    // To solve this, explicitly make the cell under the mouse selected.
                                {
                                    DataGridCell currentSelectedCell = _DataGridSopClasses.CurrentCell;
                                    DataGridCell newSelectedCell = new DataGridCell(theHitTestInfo.Row, currentSelectedCell.ColumnNumber);

                                    _DataGridSopClasses.CurrentCell = newSelectedCell;
                                }
                            }
                        }
                        break;
                }
            }
        }
Beispiel #17
0
        private void ButtonBrowseResultsDir_Click(object sender, System.EventArgs e)
        {
            TheFolderBrowserDialog.Description = "Select the root directory where the result files should be stored.";

            // Only if the current directory exists, set this directory in the dialog browser.
            if (TextBoxResultsRoot.Text != "")
            {
                DirectoryInfo theDirectoryInfo = new DirectoryInfo(TextBoxResultsRoot.Text);

                if (theDirectoryInfo.Exists)
                {
                    TheFolderBrowserDialog.SelectedPath = TextBoxResultsRoot.Text;
                }
            }

            if (TheFolderBrowserDialog.ShowDialog (this) == DialogResult.OK)
            {
                int index = TheFolderBrowserDialog.SelectedPath.IndexOf("#");
                if (index < 0)
                {
                    // MK!!! TextBoxResultsRoot.Text = TheFolderBrowserDialog.SelectedPath;
                    if (GetSession().ResultsRootDirectory != TheFolderBrowserDialog.SelectedPath)
                    {

                        GetSession().ResultsRootDirectory = TheFolderBrowserDialog.SelectedPath;

                        // Notify the rest of the world of the change.
                        SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.RESULTS_DIR);
                        Notify(theSessionChange);
                    }
                }
                else
                {
                    MessageBox.Show("Result Directory with '#' in it is not allowed . Please select another result directory.", "Warning");
                }
            }
        }
Beispiel #18
0
        private void NumericSUTMaxPDU_Leave(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                if (GetSelectedSession() is Dvtk.Sessions.IConfigurableSut)
                {
                    Dvtk.Sessions.ISutSystemSettings theISutSystemSettings = null;
                    theISutSystemSettings = (GetSelectedSession() as Dvtk.Sessions.IConfigurableSut).SutSystemSettings;

                    theISutSystemSettings.MaximumLengthReceived = (uint)NumericSUTMaxPDU.Value;

                    SessionChange theSessionChange = new SessionChange(GetSelectedSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }
            }
        }
Beispiel #19
0
        private void ButtonBrowseScriptsDir_Click(object sender, System.EventArgs e)
        {
            DvtkApplicationLayer.ScriptSession theScriptSession = null;

            if (GetSelectedSessionNew() is DvtkApplicationLayer.ScriptSession)
            {
                theScriptSession = (DvtkApplicationLayer.ScriptSession)GetSelectedSessionNew();
            }
            else
            {
                // Not supposed to get here.
                throw new System.ApplicationException("Error: not expected to get here.");
            }

            TheFolderBrowserDialog.Description = "Select the root directory containing the script files.";

            // Only if the current directory exists, set this directory in the dialog browser.
            if (TextBoxScriptRoot.Text != "")
            {
                DirectoryInfo theDirectoryInfo = new DirectoryInfo(TextBoxScriptRoot.Text);

                if (theDirectoryInfo.Exists)
                {
                    TheFolderBrowserDialog.SelectedPath = TextBoxScriptRoot.Text;
                }
            }

            if (TheFolderBrowserDialog.ShowDialog (this) == DialogResult.OK)
            {
                //MK!! TextBoxScriptRoot.Text = TheFolderBrowserDialog.SelectedPath;
                if (theScriptSession.DicomScriptRootDirectory != TheFolderBrowserDialog.SelectedPath)
                {
                    theScriptSession.DicomScriptRootDirectory = TheFolderBrowserDialog.SelectedPath;

                    // Notify the rest of the world of the change.
                    SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.SCRIPTS_DIR);
                    Notify(theSessionChange);
                }
            }
        }
Beispiel #20
0
        private void NumericDVTListenPort_ValueChanged(object sender, System.EventArgs e)
        {
            if (_TCM_UpdateCount == 0)
            {
                userControlSessionTree.Focus();
                DvtkApplicationLayer.Session session = GetSession();

                if (session is DvtkApplicationLayer.ScriptSession)
                {
                    (session as DvtkApplicationLayer.ScriptSession).DvtPort = (ushort)NumericDVTListenPort.Value;
                }
                else if(session is DvtkApplicationLayer.EmulatorSession)
                {
                    (session as DvtkApplicationLayer.EmulatorSession).DvtPort = (ushort)NumericDVTListenPort.Value;
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #21
0
        private void ButtonTrustedCertificatesFile_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog theOpenFileDialog = new OpenFileDialog();

            theOpenFileDialog.Filter = "PEM Certificate files (*.pem;*.cer)|*.pem;*.cer";

            theOpenFileDialog.Title = "Select the file containing the SUT Public Keys (certificates)";

            theOpenFileDialog.CheckFileExists = false;

            // Only if the current file exists, set this file in the file browser.
            if (TextBoxTrustedCertificatesFile.Text != "")
            {
                if (File.Exists(TextBoxTrustedCertificatesFile.Text))
                {
                    theOpenFileDialog.FileName = TextBoxTrustedCertificatesFile.Text;
                }
            }

            if (theOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                TextBoxTrustedCertificatesFile.Text = theOpenFileDialog.FileName;
                ((Dvtk.Sessions.ISecure)GetSelectedSessionNew().Implementation).SecuritySettings.CertificateFileName = theOpenFileDialog.FileName;

                // Notify the rest of the world of the change.
                SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #22
0
        private void NumericSUTListenPort_ValueChanged(object sender, System.EventArgs e)
        {
            // touch it to repair known MS bug
            object obj = NumericSUTListenPort.Value;
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                DvtkApplicationLayer.Session session = GetSession();

                if (session is DvtkApplicationLayer.ScriptSession)
                {
                    (session as DvtkApplicationLayer.ScriptSession).SutPort = (ushort)NumericSUTListenPort.Value;
                }
                else if(session is DvtkApplicationLayer.EmulatorSession)
                {
                    (session as DvtkApplicationLayer.EmulatorSession).SutPort = (ushort)NumericSUTListenPort.Value;
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #23
0
        private void ButtonViewCertificates_Click(object sender, System.EventArgs e)
        {
            try
            {
                CredentialsCertificatesForm cred_cert_form = null;

                cred_cert_form = new CredentialsCertificatesForm (GetSession(), false);

                if (cred_cert_form.ShowDialog () == DialogResult.OK)
                {
                    SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
            }
            catch (Exception theException)
            {
                MessageBox.Show(theException.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Beispiel #24
0
        private void NumericSUTMaxPDU_ValueChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (NumericSUTMaxPDU.Value > 0 && NumericSUTMaxPDU.Value < 512)
            {
                MessageBox.Show("Numeric value cannot be less than 512 except zero.");
                NumericSUTMaxPDU.Value = 512;
            }

            if (_TCM_UpdateCount == 0)
            {
                DvtkApplicationLayer.Session session = GetSession();

                if (session is DvtkApplicationLayer.ScriptSession)
                {
                    (session as DvtkApplicationLayer.ScriptSession).SutMaximumLengthReceived = (uint)NumericSUTMaxPDU.Value;
                }
                else if(session is DvtkApplicationLayer.EmulatorSession)
                {
                    (session as DvtkApplicationLayer.EmulatorSession).SutMaximumLengthReceived = (uint)NumericSUTMaxPDU.Value;
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #25
0
        private void ButtonViewCredentials_Click(object sender, System.EventArgs e)
        {
            bool passed = false;
            bool displayPassword = true;
            DialogResult result = DialogResult.None;
            (GetSelectedSessionNew().Implementation as Dvtk.Sessions.ISecure).SecuritySettings.TlsPassword = "******";
            while(!passed)
            {
                try
                {
                    CredentialsCertificatesForm cred_cert_form = null;

                    cred_cert_form = new CredentialsCertificatesForm (GetSelectedSessionNew(), true);
                    result = cred_cert_form.ShowDialog();
                    passed = true;
                    displayPassword = false;
                }
                catch (Exception theException)
                {
                    if (theException.GetType().FullName == "Wrappers.Exceptions.PasswordExpection")
                    {
                        passed = false;
                        PassWordForm passWordForm = new PassWordForm(GetSelectedSessionNew(), displayPassword);
                        displayPassword = false;
                        if (passWordForm.ShowDialog()!= DialogResult.OK)
                        {
                            passed = true;
                            displayPassword = false;
                        }
                    }
                    else
                    {
                        MessageBox.Show(theException.Message ,"Warning", MessageBoxButtons.OK,MessageBoxIcon.Warning);
                        passed = true;
                    }
                }
            }
            if (result == DialogResult.OK)
            {
                (GetSelectedSessionNew().Implementation as Dvtk.Sessions.ISecure).SecuritySettings.TlsPassword = "******";
                SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #26
0
        private void TextBoxTestedBy_TextChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                GetSession().TestedBy  = TextBoxTestedBy.Text;

                SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #27
0
        private void CheckBoxCheckRemoteCertificates_CheckedChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                if (GetSelectedSessionNew().Implementation is Dvtk.Sessions.ISecure)
                {
                    Dvtk.Sessions.ISecuritySettings theISecuritySettings = null;
                    theISecuritySettings = (GetSelectedSessionNew().Implementation as Dvtk.Sessions.ISecure).SecuritySettings;

                    bool isCurrentlyChecked = theISecuritySettings.CheckRemoteCertificate;

                    try
                    {
                        theISecuritySettings.CheckRemoteCertificate = CheckBoxCheckRemoteCertificates.Checked;

                        SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                        Notify(theSessionChange);
                    }
                    catch (Exception theException)
                    {
                        // Put the state of the check box back to the unchanged setting of the session.
                        CheckBoxCheckRemoteCertificates.Checked = isCurrentlyChecked;

                        MessageBox.Show(theException.Message + "\n\nThe change for checkbox \"" + CheckBoxCheckRemoteCertificates.Text + "\" is not allowed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    // Sanity check.
                    Debug.Assert(false);
                }
            }
        }
Beispiel #28
0
        /// <summary>
        /// The reason we handle the mouseup event ourselves, is because with the normal
        /// grid, you first have to select a cell, and only then you can enable/disable a
        /// checkbox. We want to enable/disable the checkbox with 1 click.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            // Find out what part of the data grid is below the mouse pointer.
            theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

            switch (theHitTestInfo.Type)
            {
            case System.Windows.Forms.DataGrid.HitTestType.Cell:
                // If this is the "loaded" column...
                if (theHitTestInfo.Column == 0)
                {
                    // Remember the cell we've changed. We don't want to change this cell when we move the mouse.
                    // (see DataGrid_MouseMove).
                    _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                    // Get the column style for the "loaded" column.
                    DataGridColumnStyle theDataGridColumnStyle;
                    theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

//						// Workaround for following problem:
//						// If the SOP classes tab has already been filled, and another session contains less
//						// records for the datagrid, windows gets confused and thinks there are more records
//						// then actually present in _DefinitionFilesInfoForDataGrid resulting in an assertion.
//						_DataGridSopClasses.SetDataBinding(null, "");
//
//						// Actually refresh the data grid.
//						_DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");

                    // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                    _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                    DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                    theDefinitionFile.Loaded = !theDefinitionFile.Loaded;
                    _DataGridSopClasses.EndEdit(theDataGridColumnStyle, theHitTestInfo.Row, false);

                    // Change the "loaded" state in the session object.
                    string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                    if (theDefinitionFile.Loaded)
                    {
                        // The definition file was not loaded yet. Load it now.
                        theSession.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                    }
                    else
                    {
                        // The definition file was loaded. Unload it now.
                        theSession.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                    }

                    // Remember the new "loaded" state for the case where the mouse is moved over other
                    // "loaded" checkboxes while keeping the left mouse button pressed.
                    _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown = theDefinitionFile.Loaded;

                    // Notify the rest of the world.
                    SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                    Notify(theSessionChange);
                }

//					// If this is the "Open Definition File" column...
//					if (theHitTestInfo.Column == 7)
//					{
//						// Remember the cell we've changed. We don't want to change this cell when we move the mouse.
//						// (see DataGrid_MouseMove).
//						_MouseEventInfoForDataGrid_OpenStateChangedForRow = theHitTestInfo.Row;
//
//						// Get the column style for the "Open" column.
//						DataGridColumnStyle theDataGridColumnStyle;
//						theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[7];
//
//						// Change the "Open" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
//						_DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
//						DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
//						theDefinitionFile.Open = !theDefinitionFile.Open;
//						_DataGridSopClasses.EndEdit (theDataGridColumnStyle, theHitTestInfo.Row, false);
//
//						// Get full definition file name.
//						string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);
//
//						if (theDefinitionFile.Open)
//						{
//							// Open the definition file in notepad.
//							System.Diagnostics.Process theProcess  = new System.Diagnostics.Process();
//
//							theProcess.StartInfo.FileName= "Notepad.exe";
//							theProcess.StartInfo.Arguments = theFullFileName;
//
//							theProcess.Start();
//						}
//
//						// Remember the new "Open" state for the case where the mouse is moved over other
//						// "Open" checkboxes while keeping the left mouse button pressed.
//						_MouseEventInfoForDataGrid_OpenStatedAfterMouseDown = theDefinitionFile.Open;
//					}
//
                break;
            }
        }
Beispiel #29
0
        private void CheckBoxDefineSQLength_CheckedChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                DvtkApplicationLayer.Session theSelectedSession = GetSelectedSessionNew();

                // Update the session member.
                if (theSelectedSession is DvtkApplicationLayer.ScriptSession)
                {
                    DvtkApplicationLayer.ScriptSession theScriptSession = (DvtkApplicationLayer.ScriptSession)theSelectedSession;
                    theScriptSession.DefineSqLength = CheckBoxDefineSQLength.Checked;
                }
                if (theSelectedSession is DvtkApplicationLayer.EmulatorSession)
                {
                    DvtkApplicationLayer.EmulatorSession theEmulatorSession = (DvtkApplicationLayer.EmulatorSession)theSelectedSession;
                    theEmulatorSession.DefineSqLength = CheckBoxDefineSQLength.Checked;
                }

                // Notify the rest of the world that the session has been changed.
                SessionChange theSessionChange = new SessionChange(theSelectedSession, SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #30
0
        /// <summary>
        /// The reason we handle the mouseup event ourselves, is because with the normal
        /// grid, you first have to select a cell, and only then you can enable/disable a
        /// checkbox. We want to enable/disable the checkbox with 1 click.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;
            DvtkApplicationLayer.Session theSession = GetSessionTreeViewManager().GetSession();

            // Find out what part of the data grid is below the mouse pointer.
            theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

            switch (theHitTestInfo.Type)
            {
                case System.Windows.Forms.DataGrid.HitTestType.Cell:
                    // If this is the "loaded" column...
                    if (theHitTestInfo.Column == 0)
                    {
                        // Remember the cell we've changed. We don't want to change this cell when we move the mouse.
                        // (see DataGrid_MouseMove).
                        _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                        // Get the column style for the "loaded" column.
                        DataGridColumnStyle theDataGridColumnStyle;
                        theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

                        // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                        _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                        DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                        theDefinitionFile.Loaded = !theDefinitionFile.Loaded;
                        _DataGridSopClasses.EndEdit (theDataGridColumnStyle, theHitTestInfo.Row, false);

                        // Change the "loaded" state in the session object.
                        string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                        if (theDefinitionFile.Loaded)
                        {
                            // The definition file was not loaded yet. Load it now.
                            theSession.Implementation.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                        }
                        else
                        {
                            // The definition file was loaded. Unload it now.
                            theSession.Implementation.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                        }

                        // Remember the new "loaded" state for the case where the mouse is moved over other
                        // "loaded" checkboxes while keeping the left mouse button pressed.
                        _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown = theDefinitionFile.Loaded;

                        // Notify the rest of the world.
                        SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                        Notify(theSessionChange);
                    }

                    if (theHitTestInfo.Column == 1)
                    {
                        DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                        DefinitionName = theDefinitionFile.Filename;
                    }
                    break;
            }
        }
Beispiel #31
0
 private void CheckBoxGenerateDetailedValidationResults_CheckedChanged(object sender, System.EventArgs e)
 {
     // Only react when the user has made changes, not when the TCM_Update method has been called.
     if (_TCM_UpdateCount == 0)
     {
         // Update the session member.
         GetSession().DetailedValidationResults = CheckBoxGenerateDetailedValidationResults.Checked;
         // Notify the rest of the world that the session has been changed.
         SessionChange theSessionChange = new SessionChange(GetSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
         Notify(theSessionChange);
     }
 }
Beispiel #32
0
        /// <summary>
        /// The reason we handle the mouseup event ourselves, is because with the normal
        /// grid, you first have to select a cell, and only then you can enable/disable a
        /// checkbox. We want to enable/disable the checkbox with 1 click.
        /// </summary>
        /// <param name="e"></param>
        public void DataGrid_MouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid.HitTestInfo theHitTestInfo;
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            // Find out what part of the data grid is below the mouse pointer.
            theHitTestInfo = _DataGridSopClasses.HitTest(e.X, e.Y);

            switch (theHitTestInfo.Type)
            {
                case System.Windows.Forms.DataGrid.HitTestType.Cell:
                    // If this is the "loaded" column...
                    if (theHitTestInfo.Column == 0)
                    {
                        // Remember the cell we've changed. We don't want to change this cell when we move the mouse.
                        // (see DataGrid_MouseMove).
                        _MouseEventInfoForDataGrid_LoadedStateChangedForRow = theHitTestInfo.Row;

                        // Get the column style for the "loaded" column.
                        DataGridColumnStyle theDataGridColumnStyle;
                        theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[0];

            //						// Workaround for following problem:
            //						// If the SOP classes tab has already been filled, and another session contains less
            //						// records for the datagrid, windows gets confused and thinks there are more records
            //						// then actually present in _DefinitionFilesInfoForDataGrid resulting in an assertion.
            //						_DataGridSopClasses.SetDataBinding(null, "");
            //
            //						// Actually refresh the data grid.
            //						_DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");

                        // Change the "loaded" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
                        _DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
                        DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
                        theDefinitionFile.Loaded = !theDefinitionFile.Loaded;
                        _DataGridSopClasses.EndEdit (theDataGridColumnStyle, theHitTestInfo.Row, false);

                        // Change the "loaded" state in the session object.
                        string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);

                        if (theDefinitionFile.Loaded)
                        {
                            // The definition file was not loaded yet. Load it now.
                            theSession.DefinitionManagement.LoadDefinitionFile(theFullFileName);
                        }
                        else
                        {
                            // The definition file was loaded. Unload it now.
                            theSession.DefinitionManagement.UnLoadDefinitionFile(theFullFileName);
                        }

                        // Remember the new "loaded" state for the case where the mouse is moved over other
                        // "loaded" checkboxes while keeping the left mouse button pressed.
                        _MouseEventInfoForDataGrid_LoadedStatedAfterMouseDown = theDefinitionFile.Loaded;

                        // Notify the rest of the world.
                        SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE);
                        Notify(theSessionChange);
                    }

            //					// If this is the "Open Definition File" column...
            //					if (theHitTestInfo.Column == 7)
            //					{
            //						// Remember the cell we've changed. We don't want to change this cell when we move the mouse.
            //						// (see DataGrid_MouseMove).
            //						_MouseEventInfoForDataGrid_OpenStateChangedForRow = theHitTestInfo.Row;
            //
            //						// Get the column style for the "Open" column.
            //						DataGridColumnStyle theDataGridColumnStyle;
            //						theDataGridColumnStyle = _DataGridSopClasses.TableStyles[0].GridColumnStyles[7];
            //
            //						// Change the "Open" stated in _DefinitionFilesInfoForDataGrid and the data grid itself.
            //						_DataGridSopClasses.BeginEdit(theDataGridColumnStyle, theHitTestInfo.Row);
            //						DefinitionFile theDefinitionFile = (DefinitionFile)_DefinitionFilesInfoForDataGrid[theHitTestInfo.Row];
            //						theDefinitionFile.Open = !theDefinitionFile.Open;
            //						_DataGridSopClasses.EndEdit (theDataGridColumnStyle, theHitTestInfo.Row, false);
            //
            //						// Get full definition file name.
            //						string theFullFileName = System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename);
            //
            //						if (theDefinitionFile.Open)
            //						{
            //							// Open the definition file in notepad.
            //							System.Diagnostics.Process theProcess  = new System.Diagnostics.Process();
            //
            //							theProcess.StartInfo.FileName= "Notepad.exe";
            //							theProcess.StartInfo.Arguments = theFullFileName;
            //
            //							theProcess.Start();
            //						}
            //
            //						// Remember the new "Open" state for the case where the mouse is moved over other
            //						// "Open" checkboxes while keeping the left mouse button pressed.
            //						_MouseEventInfoForDataGrid_OpenStatedAfterMouseDown = theDefinitionFile.Open;
            //					}
            //
                    break;
            }
        }
Beispiel #33
0
        private void CheckBoxLogRelation_CheckedChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                Dvtk.Sessions.LogLevelFlags flag = (Dvtk.Sessions.LogLevelFlags)((GetSelectedSessionNew().LogLevelMask));
                if (CheckBoxLogRelation.Checked)
                {
                    flag |= Dvtk.Sessions.LogLevelFlags.ImageRelation;
                }
                else
                {
                    flag ^= Dvtk.Sessions.LogLevelFlags.ImageRelation;
                }

                GetSelectedSessionNew().LogLevelMask = (int)flag;
                SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                Notify(theSessionChange);
            }
        }
Beispiel #34
0
        public void RemoveDefinitionFileDirectory()
        {
            string theSelectedDirectory;
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

            theSelectedDirectory = (string)_ListBoxDefinitionFileDirectories.SelectedItem;

            theDefinitionFileDirectoryList.Remove(theSelectedDirectory);

            // Notify the rest of the world.
            // This will implicitly also update this specify SOP classes tab.
            SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_OTHER);
            Notify(theSessionChange);
        }
Beispiel #35
0
        private void CheckBoxSecureConnection_CheckedChanged(object sender, System.EventArgs e)
        {
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                Dvtk.Sessions.ISecure theISecure = GetSelectedSessionNew().Implementation as Dvtk.Sessions.ISecure;

                if (theISecure == null)
                {
                    // Sanity check.
                    Debug.Assert(false);
                }
                else
                {
                    theISecure.SecuritySettings.SecureSocketsEnabled = CheckBoxSecureConnection.Checked;

                    _TCM_SessionUsedForContentsOfTabSessionInformation = null;
                    TCM_UpdateTabSessionInformation();

                    SessionChange theSessionChange = new SessionChange(GetSelectedSessionNew(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
            }
        }
Beispiel #36
0
        /// <summary>
        /// Add a definition file direcotory.
        /// </summary>
        public void AddDefinitionFileDirectory()
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

            FolderBrowserDialog theFolderBrowserDialog = new FolderBrowserDialog();

            theFolderBrowserDialog.Description = "Select the directory where definition files are located.";

            if (theFolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                bool isExistingDirectory = false;
                string theNewDirectory = GetDirectoryWithTrailingSlashesRemoved(theFolderBrowserDialog.SelectedPath);

                // Find out if this new directory already exists.
                foreach (string theExistingDirectory in theDefinitionFileDirectoryList)
                {
                    if (theNewDirectory == GetDirectoryWithTrailingSlashesRemoved(theExistingDirectory))
                    {
                        isExistingDirectory = true;
                        break;
                    }
                }

                theNewDirectory = theNewDirectory + "\\";

                // Only add this new directory if it does not already exist.
                if (!isExistingDirectory)
                {
                    DirectoryInfo theDirectoryInfo = new DirectoryInfo(theNewDirectory);

                    // If the new directory is not valid, show an error message.
                    if (!theDirectoryInfo.Exists)
                    {
                        MessageBox.Show("The directory \"" + theNewDirectory + "\" is not a valid directory.",
                            "Directory not added",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                    }
                    else
                    {
                        theDefinitionFileDirectoryList.Add(theNewDirectory);

                        // Notify the rest of the world.
                        // This will implicitly also update this specify SOP classes tab.
                        SessionChange theSessionChange = new SessionChange(theSession, SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_OTHER);
                        Notify(theSessionChange);
                    }
                }
                else
                {
                    MessageBox.Show("The directory \"" + theNewDirectory + "\" is already present in\nthe list of definition file directories.",
                                    "Directory not added",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
        }
Beispiel #37
0
        private void NumericSUTListenPort_Leave(object sender, System.EventArgs e)
        {
            // touch it to repair known MS bug
            object obj = NumericSUTListenPort.Value;
            // Only react when the user has made changes, not when the TCM_Update method has been called.
            if (_TCM_UpdateCount == 0)
            {
                if (GetSelectedSession() is Dvtk.Sessions.IConfigurableSut)
                {
                    Dvtk.Sessions.ISutSystemSettings theISutSystemSettings = null;
                    theISutSystemSettings = (GetSelectedSession() as Dvtk.Sessions.IConfigurableSut).SutSystemSettings;

                    theISutSystemSettings.Port = (ushort)NumericSUTListenPort.Value;

                    SessionChange theSessionChange = new SessionChange(GetSelectedSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
                else
                {
                    // Not supposed to get here.
                    throw new System.ApplicationException("Error: not expected to get here.");
                }
            }
        }