コード例 #1
0
        /// <summary>
        /// Update the Specify SOP classes tab.
        /// </summary>
        public void Update()
        {
            if (_SessionUsedForContentsOfTabSpecifySopClasses == GetSessionTreeViewManager().GetSelectedSession())
            {
                // No need to update, this tab already contains the correct session information.
                _DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;

                Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
                Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

                // Update the definition file directories list box.
                _ListBoxDefinitionFileDirectories.Items.Clear();

                UpdateRemoveButton();

                foreach (string theDefinitionFileDirectory in theDefinitionFileDirectoryList)
                {
                    _ListBoxDefinitionFileDirectories.Items.Add(theDefinitionFileDirectory);
                }

                // Update the SOP classes data grid.
                // For every definition file directory, use the .def files present in the directory.
                _RichTextBoxInfo.Clear();
                _ComboBoxAeTitle.Items.Clear();
                _ComboBoxAeTitle.Items.Add(_DefaultAeTitleVersion);
                _DefinitionFilesInfoForDataGrid.Clear();

                // Add the correct information to the datagrid by inspecting the definition directory.
                // When doing this, also fill the combobox with available ae title - version combinations.
                AddSopClassesToDataGridFromDirectories();

                // Add the correct information to the datagrid by inspecting the loaded definitions.
                // When doing this, also fill the combobox with available ae title - version combinations.
                // Only add an entry if it does not already exist.
                AddSopClassesToDataGridFromLoadedDefinitions();

                // Make the correct AE title - version in the combo box the current one.
                SetSelectedAeTitleVersion();

                // 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, "");
                //_DataGridSopClasses.DataSource = _DefinitionFilesInfoForDataGrid;

                _DataGridSopClasses.Refresh();

                _SessionUsedForContentsOfTabSpecifySopClasses = GetSessionTreeViewManager().GetSelectedSession();

                Cursor.Current = Cursors.Default;
            }
        }
コード例 #2
0
        public static ArrayList GetAllNamesForSession(Dvtk.Sessions.Session theSession)
        {
            ArrayList     theResultsFiles = new ArrayList();
            DirectoryInfo theDirectoryInfo;

            FileInfo[] theFilesInfo;

            theDirectoryInfo = new DirectoryInfo(theSession.ResultsRootDirectory);

            if (theDirectoryInfo.Exists)
            {
                theFilesInfo = theDirectoryInfo.GetFiles("*.xml");

                foreach (FileInfo theFileInfo in theFilesInfo)
                {
                    string theResultsFileName = theFileInfo.Name;

                    if (IsValid(theResultsFileName))
                    {
                        theResultsFiles.Add(theResultsFileName);
                    }
                }
            }

            return(theResultsFiles);
        }
コード例 #3
0
        private bool IsDefinitionFileLoaded(string theFullDefinitionFileName)
        {
            bool theReturnValue = false;

            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            foreach (string theLoadedDefinitionFileName in theSession.DefinitionManagement.LoadedDefinitionFileNames)
            {
                string thetheLoadedDefinitionFullFileName = theLoadedDefinitionFileName;

                // If theLoadedDefinitionFileName does not contain a '\', this is a file name only.
                // Append the Root directory to get the full path name.
                if (theLoadedDefinitionFileName.LastIndexOf("\\") == -1)
                {
                    thetheLoadedDefinitionFullFileName = System.IO.Path.Combine(theSession.DefinitionManagement.DefinitionFileRootDirectory, theLoadedDefinitionFileName);
                }

                if (thetheLoadedDefinitionFullFileName == theFullDefinitionFileName)
                {
                    theReturnValue = true;
                    break;
                }
            }

            return(theReturnValue);
        }
コード例 #4
0
        /// <summary>
        /// From a list of results file names, return those results file names with the same session ID
        /// as the session ID of the supplied session.
        /// </summary>
        /// <param name="theSession">The session.</param>
        /// <param name="theResultsFileNames">Valid results file names.</param>
        /// <returns>List of results file names.</returns>
        public static ArrayList GetNamesForCurrentSessionId(Dvtk.Sessions.Session theSession, ArrayList theResultsFileNames)
        {
            ArrayList theNamesForCurrentSession = new ArrayList();
            string    theSessionIdAsString      = theSession.SessionId.ToString("000");

            foreach (string theResultsFileName in theResultsFileNames)
            {
                string theResultsFileSessionIdAsString = "";

                if (theResultsFileName.ToLower().StartsWith(_SUMMARY_PREFIX))
                {
                    theResultsFileSessionIdAsString = theResultsFileName.Substring(_SUMMARY_PREFIX.Length, 3);
                }
                else if (theResultsFileName.ToLower().StartsWith(_DETAIL_PREFIX))
                {
                    theResultsFileSessionIdAsString = theResultsFileName.Substring(_DETAIL_PREFIX.Length, 3);
                }
                else
                {
                    // Sanity check.
                    Debug.Assert(false);
                }

                if (theResultsFileSessionIdAsString == theSessionIdAsString)
                {
                    theNamesForCurrentSession.Add(theResultsFileName);
                }
            }

            return(theNamesForCurrentSession);
        }
コード例 #5
0
        public Dvtk.Sessions.Session LoadSession(string theSessionFullFileName)
        {
            FileInfo theSessionFileInfo = new FileInfo(theSessionFullFileName);

            Dvtk.Sessions.Session theSession = null;

            if (theSessionFileInfo.Exists)
            {
                try
                {
                    theSession = Dvtk.Sessions.SessionFactory.TheInstance.Load(theSessionFullFileName);

                    // In the Dvt UI, always generate summary validation results.
                    theSession.SummaryValidationResults = true;
                }
                catch (Exception e)
                {
                    string msg = string.Empty;
                    msg += string.Format("Failed to load session file: {0}\n", theSessionFullFileName);
                    msg += e.Message;
                    this.display_message(msg);
                    theSession = null;
                }
            }
            else
            {
                this.display_message(
                    string.Format(
                        "Session file \"{0}\" does not exist.",
                        theSessionFullFileName)
                    );
            }

            return(theSession);
        }
コード例 #6
0
 public static void BackupFiles(Dvtk.Sessions.Session theSession, ArrayList theFilesToBackup)
 {
     foreach (string theFileToBackup in theFilesToBackup)
     {
         BackupFile(theSession, theFileToBackup);
     }
 }
コード例 #7
0
        public void SetSelectedAeTitleVersion()
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            AeTitleVersion theCurrentAeTitleVersionInComboBox = null;

            foreach (AeTitleVersion theAeTitleVersion in _ComboBoxAeTitle.Items)
            {
                if ((theAeTitleVersion._AeTitle == theSession.DefinitionManagement.ApplicationEntityName) &&
                    (theAeTitleVersion._Version == theSession.DefinitionManagement.ApplicationEntityVersion))
                {
                    theCurrentAeTitleVersionInComboBox = theAeTitleVersion;
                    break;
                }
            }

            if (theCurrentAeTitleVersionInComboBox != null)
            {
                _ComboBoxAeTitle.SelectedItem = theCurrentAeTitleVersionInComboBox;
            }
            else
            {
                _ComboBoxAeTitle.SelectedItem = _DefaultAeTitleVersion;
            }
        }
コード例 #8
0
 public void SetSessionChanged(Dvtk.Sessions.Session theSession)
 {
     if (theSession == _SessionUsedForContentsOfTabSpecifySopClasses)
     {
         _SessionUsedForContentsOfTabSpecifySopClasses = null;
     }
 }
コード例 #9
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);
                }
            }
        }
コード例 #10
0
        private void AddSopClassesToDataGridFromLoadedDefinitions()
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();

            foreach (string theLoadedDefinitionFileName in theSession.DefinitionManagement.LoadedDefinitionFileNames)
            {
                string theLoadedDefinitionFullFileName = theLoadedDefinitionFileName;

                // If theLoadedDefinitionFileName does not contain a '\', this is a file name only.
                // Append the Root directory to get the full path name.
                if (theLoadedDefinitionFileName.LastIndexOf("\\") == -1)
                {
                    theLoadedDefinitionFullFileName = System.IO.Path.Combine(theSession.DefinitionManagement.DefinitionFileRootDirectory, theLoadedDefinitionFileName);
                }

                // Check if this definition file is already present in the data grid.
                // Do this by comparing the full file name of the definition file with the full file names
                // present in the data grid.
                bool IsDefinitionAlreadyPresent = false;

                foreach (DefinitionFile theDefinitionFile in  _DefinitionFilesInfoForDataGrid)
                {
                    if (System.IO.Path.Combine(theDefinitionFile.DefinitionRoot, theDefinitionFile.Filename) == theLoadedDefinitionFullFileName)
                    {
                        IsDefinitionAlreadyPresent = true;
                        break;
                    }
                }

                if (!IsDefinitionAlreadyPresent)
                {
                    try
                    {
                        AddSopClassToDataGridFromDefinitionFile(theLoadedDefinitionFullFileName);
                    }
                    catch (Exception exception)
                    {
                        string theErrorText;

                        theErrorText = string.Format("Definition file {0} could not be interpreted while reading definition present in session:\n{1}\n\n", theLoadedDefinitionFullFileName, exception.Message);

                        _RichTextBoxInfo.AppendText(theErrorText);
                    }
                    catch
                    {
                        string theErrorText;

                        theErrorText = string.Format("Definition file {0} could not be interpreted while reading definition present in session.\n\n", theLoadedDefinitionFullFileName);

                        _RichTextBoxInfo.AppendText(theErrorText);
                    }
                }
            }
        }
コード例 #11
0
        private SessionInformation GetSessionInformation(Dvtk.Sessions.Session theSession)
        {
            SessionInformation theSessionInformation = null;

            int theIndex = GetLoadedSessionsIndex(theSession);

            if (theIndex != -1)
            {
                theSessionInformation = GetSessionInformation(theIndex);
            }

            return(theSessionInformation);
        }
コード例 #12
0
ファイル: CountManager.cs プロジェクト: top501/DVTK-1
        public Wrappers.ICountingTarget CreateChildCountingTarget()
        {
            Dvtk.Sessions.Session session = this.m_parentSession;
            //
            // Create child-countManager for the same (parent)-session.
            //
            CountManager countManager = new CountManager(session);

            //
            // Register child-countManager in the child-collection of this parent-countManager
            //
            this.m_childCountManagers.Add(countManager);
            return(countManager);
        }
コード例 #13
0
        public void SetSessionChanged(Dvtk.Sessions.Session theSession, bool changed)
        {
            SessionInformation theSessionInformation = GetSessionInformation(theSession);

            if (theSessionInformation == null)
            {
                // Sanity check.
                Debug.Assert(false);
            }
            else
            {
                theSessionInformation.HasChanged = changed;
            }
        }
コード例 #14
0
        // TODO: Implement a function in Dvtk to unload a session file.
        public void RemoveSession(Dvtk.Sessions.Session theSession)
        {
            SessionInformation theSessionInformation = GetSessionInformation(theSession);

            if (theSessionInformation == null)
            {
                // Sanity check.
                Debug.Assert(false);
            }
            else
            {
                _LoadedSessions.Remove(theSessionInformation);
                _HasProjectChanged = true;
            }
        }
コード例 #15
0
ファイル: NodesInformation.cs プロジェクト: top501/DVTK-1
        /// <summary>
        /// Remove all expanded information for the supplied session.
        /// </summary>
        /// <param name="theSession">The session.</param>
        public void RemoveExpandInformationForSession(Dvtk.Sessions.Session theSession)
        {
            ArrayList theTagsToRemove = new ArrayList();

            foreach (TreeNodeTag theTreeNodeTag in _TagsOfExpandedNodes)
            {
                if (theTreeNodeTag._Session == theSession)
                {
                    theTagsToRemove.Add(theTreeNodeTag);
                }
            }

            foreach (TreeNodeTag theTreeNodeTagToRemove in theTagsToRemove)
            {
                _TagsOfExpandedNodes.Remove(theTreeNodeTagToRemove);
            }
        }
コード例 #16
0
        private int GetLoadedSessionsIndex(Dvtk.Sessions.Session theSession)
        {
            int theReturnValue = -1;

            for (int theIndex = 0; theIndex < _LoadedSessions.Count; theIndex++)
            {
                SessionInformation theSessionInformation = (SessionInformation)_LoadedSessions[theIndex];

                if (theSessionInformation.Session == theSession)
                {
                    theReturnValue = theIndex;
                    break;
                }
            }

            return(theReturnValue);
        }
コード例 #17
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);
            }
        }
コード例 #18
0
        /// <summary>
        /// Save the session under a new file name.
        ///
        /// A new session object will be created from this new saved file (and returned by this method)
        /// and added to the project. The original session wil not be saved.
        /// </summary>
        /// <param name="theCurrentSession"></param>
        /// <returns>The new created session object, null if save as a new session has been cancelled or failed.</returns>
        public Dvtk.Sessions.Session SaveSessionAs(Dvtk.Sessions.Session theCurrentSession)
        {
            Dvtk.Sessions.Session theNewSession = null;

            SaveFileDialog theSaveFileDialog = new SaveFileDialog();

            theSaveFileDialog.AddExtension    = true;
            theSaveFileDialog.DefaultExt      = ".ses";
            theSaveFileDialog.OverwritePrompt = false;
            theSaveFileDialog.Filter          = "All session files (*.ses)|*.ses";

            DialogResult theDialogResult = theSaveFileDialog.ShowDialog();

            // User has specified a file name and has pressed the OK button.
            if (theDialogResult == DialogResult.OK)
            {
                if (File.Exists(theSaveFileDialog.FileName))
                {
                    MessageBox.Show(string.Format("File name \"{0}\" already exists.\nOperation cancelled", theSaveFileDialog.FileName));
                }
                else
                {
                    // Save the current session to a new file.
                    string theCurrentSessionFullFileName = theCurrentSession.SessionFileName;

                    theCurrentSession.SessionFileName = theSaveFileDialog.FileName;
                    theCurrentSession.SaveToFile();
                    theCurrentSession.SessionFileName = theCurrentSessionFullFileName;


                    // Create a new session object from this new saved file and replace the current session.
                    theNewSession = LoadSession(theSaveFileDialog.FileName);

                    if (theNewSession != null)
                    {
                        int theCurrentIndex = GetLoadedSessionsIndex(theCurrentSession);

                        _LoadedSessions[theCurrentIndex] = new SessionInformation(theNewSession);
                        _HasProjectChanged = true;
                    }
                }
            }

            return(theNewSession);
        }
コード例 #19
0
        public bool GetSessionChanged(Dvtk.Sessions.Session theSession)
        {
            bool theReturnValue = false;

            SessionInformation theSessionInformation = GetSessionInformation(theSession);

            if (theSessionInformation == null)
            {
                // Sanity check.
                Debug.Assert(false);
            }
            else
            {
                theReturnValue = theSessionInformation.HasChanged;
            }

            return(theReturnValue);
        }
コード例 #20
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);
        }
コード例 #21
0
        /// <summary>
        /// Update the Specify SOP classes tab.
        /// </summary>
        public void UpdateDataGrid(Dvtk.Sessions.ScriptSession session)
        {
            theSession = session;

            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

            // Update the definition file directories list box.
            ListBoxSpecifySopClassesDefinitionFileDirectories.Items.Clear();

            UpdateRemoveButton();

            foreach (string theDefinitionFileDirectory in theDefinitionFileDirectoryList)
            {
                ListBoxSpecifySopClassesDefinitionFileDirectories.Items.Add(theDefinitionFileDirectory);
            }

            // Update the SOP classes data grid.
            // For every definition file directory, use the .def files present in the directory.
            RichTextBoxSpecifySopClassesInfo.Clear();
            _DefinitionFilesInfoForDataGrid.Clear();

            // Add the correct information to the datagrid by inspecting the definition directory.
            // When doing this, also fill the combobox with available ae title - version combinations.
            AddSopClassesToDataGridFromDirectories();

            // Add the correct information to the datagrid by inspecting the loaded definitions.
            // When doing this, also fill the combobox with available ae title - version combinations.
            // Only add an entry if it does not already exist.
            AddSopClassesToDataGridFromLoadedDefinitions();

            // 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.
            DataGridSpecifySopClasses.SetDataBinding(null, "");

            // Actually refresh the data grid.
            DataGridSpecifySopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");
            //DataGridSpecifySopClasses.DataSource = _DefinitionFilesInfoForDataGrid;

            DataGridSpecifySopClasses.Refresh();
        }
コード例 #22
0
        private void AddSopClassesToDataGridFromDirectories()
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

            foreach (string theDefinitionFileDirectory in theDefinitionFileDirectoryList)
            {
                DirectoryInfo theDirectoryInfo = new DirectoryInfo(theDefinitionFileDirectory);

                if (theDirectoryInfo.Exists)
                {
                    FileInfo[] theFilesInfo;

                    theFilesInfo = theDirectoryInfo.GetFiles("*.def");

                    foreach (FileInfo theDefinitionFileInfo in theFilesInfo)
                    {
                        try
                        {
                            AddSopClassToDataGridFromDefinitionFile(theDefinitionFileInfo.FullName);
                        }
                        catch (Exception exception)
                        {
                            string theErrorText;

                            theErrorText = string.Format("Definition file {0} could not be interpreted while reading directory:\n{1}\n\n", theDefinitionFileInfo.FullName, exception.Message);

                            _RichTextBoxInfo.AppendText(theErrorText);
                        }
                        catch
                        {
                            string theErrorText;

                            theErrorText = string.Format("Definition file {0} could not be interpreted while reading directory.\n\n", theDefinitionFileInfo.FullName);

                            _RichTextBoxInfo.AppendText(theErrorText);
                        }
                    }
                }
            }
        }
コード例 #23
0
        private static void BackupFile(Dvtk.Sessions.Session theSession, string theFileToBackup)
        {
            string theSourceFullFileName  = System.IO.Path.Combine(theSession.ResultsRootDirectory, theFileToBackup);
            string theDestinyFullFileName = theSourceFullFileName + "_backup";
            int    theCounter             = 1;

            try
            {
                while (File.Exists(theDestinyFullFileName + theCounter.ToString()))
                {
                    theCounter++;
                }

                File.Copy(theSourceFullFileName, theDestinyFullFileName + theCounter.ToString());
            }
            catch
            {
                // Don't do anything in the release version.
                Debug.Assert(false);
            }
        }
コード例 #24
0
        /// <summary>
        /// The information from a definition file is added to the datagrid and possibly to the combo box.
        ///
        /// An excpetion is thrown when retrieving details for the definition file fails.
        /// </summary>
        /// <param name="theDefinitionFullFileName">the full file name of the definition file.</param>
        private void AddSopClassToDataGridFromDefinitionFile(string theDefinitionFullFileName)
        {
            Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
            Dvtk.Sessions.DefinitionFileDetails theDefinitionFileDetails;

            // Try to get detailed information about this definition file.
            theDefinitionFileDetails = theSession.DefinitionManagement.GetDefinitionFileDetails(theDefinitionFullFileName);

            // No excpetion thrown when calling GetDefinitionFileDetails (otherwise this statement would not have been reached)
            // so this is a valid definition file. Add it to the data frid.
            DefinitionFile theDataGridDefinitionFileInfo =
                new DefinitionFile(IsDefinitionFileLoaded(theDefinitionFullFileName),
                                   System.IO.Path.GetFileName(theDefinitionFullFileName),
                                   theDefinitionFileDetails.SOPClassName,
                                   theDefinitionFileDetails.SOPClassUID,
                                   theDefinitionFileDetails.ApplicationEntityName,
                                   theDefinitionFileDetails.ApplicationEntityVersion,
                                   System.IO.Path.GetDirectoryName(theDefinitionFullFileName));

            _DefinitionFilesInfoForDataGrid.Add(theDataGridDefinitionFileInfo);

            // If the AE title - version does not yet exist in the combo box, add it.
            bool IsAeTitleVersionAlreadyInComboBox = false;

            foreach (AeTitleVersion theAeTitleVersion in _ComboBoxAeTitle.Items)
            {
                if ((theAeTitleVersion._AeTitle == theDefinitionFileDetails.ApplicationEntityName) &&
                    (theAeTitleVersion._Version == theDefinitionFileDetails.ApplicationEntityVersion))
                {
                    IsAeTitleVersionAlreadyInComboBox = true;
                    break;
                }
            }

            if (!IsAeTitleVersionAlreadyInComboBox)
            {
                AeTitleVersion theAeTitleVersion = new AeTitleVersion(theDefinitionFileDetails.ApplicationEntityName, theDefinitionFileDetails.ApplicationEntityVersion);
                _ComboBoxAeTitle.Items.Add(theAeTitleVersion);
            }
        }
コード例 #25
0
        /// <summary>
        /// Remove .xml files, and if exisiting, the corresponding .html files.
        /// </summary>
        /// <param name="theSession">The session.</param>
        /// <param name="theResultsFileNames">The results file names.</param>
        public static void Remove(Dvtk.Sessions.Session theSession, ArrayList theResultsFileNames)
        {
            foreach (string theResultsFileName in theResultsFileNames)
            {
                string theXmlResultsFullFileName  = System.IO.Path.Combine(theSession.ResultsRootDirectory, theResultsFileName);
                string theHtmlResultsFullFileName = theXmlResultsFullFileName.ToLower().Replace(".xml", ".html");

                if (!File.Exists(theXmlResultsFullFileName))
                {
                    // Sanity check.
                    Debug.Assert(false);
                }
                else
                {
                    try
                    {
                        File.Delete(theXmlResultsFullFileName);
                    }
                    catch
                    {
                        // In release mode, just continue.
                        Debug.Assert(false);
                    }
                }

                if (File.Exists(theHtmlResultsFullFileName))
                {
                    try
                    {
                        File.Delete(theHtmlResultsFullFileName);
                    }
                    catch
                    {
                        // In release mode, just continue.
                        Debug.Assert(false);
                    }
                }
            }
        }
コード例 #26
0
ファイル: ProjectForm2.cs プロジェクト: ewcasas/DVTK
        // May only be called from UpdateTabContents.
        private void TCM_UpdateTabSessionInformation()
        {
            _TCM_UpdateCount++;

            bool Update = false;
            Dvtk.Sessions.Session theSelectedSession = GetSelectedSession();

            // If this session tab has not yet been filled, fill it.
            if (_TCM_SessionUsedForContentsOfTabSessionInformation == null)
            {
                Update = true;
            }
            else
            {
                // If the current session is not equal to the session used to fill the session information tab
                // last time, fill it again.
                if (_TCM_SessionUsedForContentsOfTabSessionInformation != theSelectedSession)
                {
                    Update = true;
                }
            }

            // Update the complete contents of the session information tab.
            if (Update)
            {
                // General session properties.
                if (theSelectedSession is Dvtk.Sessions.ScriptSession)
                {
                    TextBoxSessionType.Text = "Script";
                }

                if (theSelectedSession is Dvtk.Sessions.MediaSession)
                {
                    TextBoxSessionType.Text = "Media";
                }

                if (theSelectedSession is Dvtk.Sessions.EmulatorSession)
                {
                    TextBoxSessionType.Text = "Emulator";
                }

                TextBoxSessionTitle.Text = theSelectedSession.SessionTitle;
                NumericSessonID.Value = theSelectedSession.SessionId;
                TextBoxTestedBy.Text = theSelectedSession.TestedBy;
                //DateTested.Value = theSelectedSession.Date;
                TextBoxResultsRoot.Text = theSelectedSession.ResultsRootDirectory;

                if (theSelectedSession is Dvtk.Sessions.ScriptSession)
                {
                    Dvtk.Sessions.ScriptSession theSelectedScriptSession;

                    theSelectedScriptSession = (Dvtk.Sessions.ScriptSession)theSelectedSession;

                    LabelScriptsDir.Visible = true;
                    TextBoxScriptRoot.Visible = true;
                    ButtonBrowseScriptsDir.Visible = true;
                    LabelDescriptionDir.Visible = true;
                    TextBoxDescriptionRoot.Visible = true;
                    ButtonBrowseDescriptionDir.Visible = true;

                    TextBoxScriptRoot.Text = theSelectedScriptSession.DicomScriptRootDirectory;
                    TextBoxDescriptionRoot.Text = theSelectedScriptSession.DescriptionDirectory;
                    CheckBoxDefineSQLength.Checked = theSelectedScriptSession.DefineSqLength;
                    CheckBoxAddGroupLengths.Checked = theSelectedScriptSession.AddGroupLength;
                }
                else
                {
                    LabelScriptsDir.Visible = false;
                    TextBoxScriptRoot.Visible = false;
                    ButtonBrowseScriptsDir.Visible = false;
                    LabelDescriptionDir.Visible = false;
                    TextBoxDescriptionRoot.Visible = false;
                    ButtonBrowseDescriptionDir.Visible = false;
                }

                CheckBoxGenerateDetailedValidationResults.Checked = theSelectedSession.DetailedValidationResults;

                if (theSelectedSession is Dvtk.Sessions.EmulatorSession)
                {
                    Dvtk.Sessions.EmulatorSession theSelectedEmulatorSession;
                    theSelectedEmulatorSession = (Dvtk.Sessions.EmulatorSession)theSelectedSession;

                    ButtonSpecifyTransferSyntaxes.Visible = true;
                    LabelSpecifyTransferSyntaxes.Visible = true;
                    CheckBoxDefineSQLength.Checked = theSelectedEmulatorSession.DefineSqLength;
                    CheckBoxAddGroupLengths.Checked = theSelectedEmulatorSession.AddGroupLength;
                }
                else
                {
                    ButtonSpecifyTransferSyntaxes.Visible = false;
                    LabelSpecifyTransferSyntaxes.Visible = false;
                }

                if (theSelectedSession is Dvtk.Sessions.MediaSession)
                {
                    CheckBoxDefineSQLength.Visible = false;
                    CheckBoxAddGroupLengths.Visible = false;
                }
                else
                {
                    CheckBoxDefineSQLength.Visible = true;
                    CheckBoxAddGroupLengths.Visible = true;
                }

                switch(theSelectedSession.StorageMode)
                {
                    case Dvtk.Sessions.StorageMode.AsDataSet:
                        ComboBoxStorageMode.SelectedIndex = 0;
                        break;

                    case Dvtk.Sessions.StorageMode.AsMedia:
                        ComboBoxStorageMode.SelectedIndex = 1;
                        break;

                    case Dvtk.Sessions.StorageMode.NoStorage:
                        ComboBoxStorageMode.SelectedIndex = 2;
                        break;

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

                CheckBoxLogRelation.Checked = (GetSelectedSession().LogLevelFlags & Dvtk.Sessions.LogLevelFlags.ImageRelation) == Dvtk.Sessions.LogLevelFlags.ImageRelation;

                // Dvt role settings.
                if (theSelectedSession is Dvtk.Sessions.IConfigurableDvt)
                {
                    Dvtk.Sessions.IDvtSystemSettings theIDvtSystemSettings = null;
                    theIDvtSystemSettings = (theSelectedSession as Dvtk.Sessions.IConfigurableDvt).DvtSystemSettings;

                    TextBoxDVTImplClassUID.Text = theIDvtSystemSettings.ImplementationClassUid;
                    TextBoxDVTImplVersionName.Text = theIDvtSystemSettings.ImplementationVersionName;
                    TextBoxDVTAETitle.Text = theIDvtSystemSettings.AeTitle;
                    NumericDVTListenPort.Value = theIDvtSystemSettings.Port;
                    NumericDVTTimeOut.Value = theIDvtSystemSettings.SocketTimeout;
                    NumericDVTMaxPDU.Value = theIDvtSystemSettings.MaximumLengthReceived;

                    PanelDVTRoleSettingsTitle.Visible = true;
                    if (MinDVTRoleSettings.Visible)
                    {
                        PanelDVTRoleSettingsContent.Visible = true;
                    }
                }
                else
                {
                    PanelDVTRoleSettingsTitle.Visible = false;
                    PanelDVTRoleSettingsContent.Visible = false;
                }

                // System under test settings.
                if (theSelectedSession is Dvtk.Sessions.IConfigurableSut)
                {
                    Dvtk.Sessions.ISutSystemSettings theISutSystemSettings = null;
                    theISutSystemSettings = (theSelectedSession as Dvtk.Sessions.IConfigurableSut).SutSystemSettings;

                    TextBoxSUTImplClassUID.Text = theISutSystemSettings.ImplementationClassUid;
                    TextBoxSUTImplVersionName.Text = theISutSystemSettings.ImplementationVersionName;
                    TextBoxSUTAETitle.Text = theISutSystemSettings.AeTitle;
                    NumericSUTListenPort.Value = theISutSystemSettings.Port;
                    TextBoxSUTTCPIPAddress.Text = theISutSystemSettings.HostName;
                    NumericSUTMaxPDU.Value = theISutSystemSettings.MaximumLengthReceived;

                    PanelSUTSettingTitle.Visible = true;
                    if (MinSUTSettings.Visible)
                    {
                        PanelSUTSettingContent.Visible = true;
                    }
                }
                else
                {
                    PanelSUTSettingTitle.Visible = false;
                    PanelSUTSettingContent.Visible = false;
                }

                // Security settings.
                if (theSelectedSession is Dvtk.Sessions.ISecure)
                {
                    Dvtk.Sessions.ISecuritySettings theISecuritySettings = null;

                    theISecuritySettings = (theSelectedSession as Dvtk.Sessions.ISecure).SecuritySettings;

                    CheckBoxSecureConnection.Checked = theISecuritySettings.SecureSocketsEnabled;

                    if (CheckBoxSecureConnection.Checked)
                    {
                        if (_TCM_ShowMinSecuritySettings)
                        {
                            PanelSecuritySettingsTitle.Visible = true;
                            PanelSecuritySettingsContent.Visible = true;

                            MinSecuritySettings.Visible = true;
                            MaxSecuritySettings.Visible = false;

                            CheckBoxCheckRemoteCertificates.Checked = theISecuritySettings.CheckRemoteCertificate;
                            CheckBoxCacheSecureSessions.Checked = theISecuritySettings.CacheTlsSessions;
                            CheckBoxTLS.Checked = ((theISecuritySettings.TlsVersionFlags & Dvtk.Sessions.TlsVersionFlags.TLS_VERSION_TLSv1) != 0);
                            CheckBoxSSL.Checked = ((theISecuritySettings.TlsVersionFlags & Dvtk.Sessions.TlsVersionFlags.TLS_VERSION_SSLv3) != 0);
                            CheckBoxAuthenticationDSA.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_AUTHENICATION_METHOD_DSA) != 0);
                            CheckBoxAuthenticationRSA.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_AUTHENICATION_METHOD_RSA) != 0);
                            CheckBoxDataIntegrityMD5.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_DATA_INTEGRITY_METHOD_MD5) != 0);
                            CheckBoxDataIntegritySHA.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_DATA_INTEGRITY_METHOD_SHA1) != 0);
                            CheckBoxEncryptionNone.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_NONE) != 0);
                            CheckBoxEncryptionTripleDES.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_3DES) != 0);
                            CheckBoxEncryptionAES128.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_AES128) != 0);
                            CheckBoxEncryptionAES256.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_AES256) != 0);
                            CheckBoxKeyExchangeDH.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_KEY_EXCHANGE_METHOD_DH) != 0);
                            CheckBoxKeyExchangeRSA.Checked = ((theISecuritySettings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_KEY_EXCHANGE_METHOD_RSA) != 0);
                            TextBoxTrustedCertificatesFile.Text = theISecuritySettings.CertificateFileName;
                            TextBoxSecurityCredentialsFile.Text = theISecuritySettings.CredentialsFileName;
                        }
                        else
                        {
                            PanelSecuritySettingsContent.Visible = false;

                            MinSecuritySettings.Visible = false;
                            MaxSecuritySettings.Visible = true;
                        }
                    }
                    else
                    {
                        PanelSecuritySettingsTitle.Visible = true;
                        PanelSecuritySettingsContent.Visible = false;

                        MinSecuritySettings.Visible = false;
                        MaxSecuritySettings.Visible = false;
                    }
                }
                else
                {
                    PanelSecuritySettingsTitle.Visible = false;
                    PanelSecuritySettingsContent.Visible = false;
                }

                _TCM_SessionUsedForContentsOfTabSessionInformation = theSelectedSession;
            }

            _TCM_UpdateCount--;
        }
コード例 #27
0
        public void AddSession(string theSessionFullFileName)
        {
            Dvtk.Sessions.Session theLoadedSession = LoadSession(theSessionFullFileName);

            if (theLoadedSession != null)
            {
                // Search the sessions loaded in project file for same ResultsRootDirectory
                foreach (SessionInformation theSessionInformation in _LoadedSessions)
                {
                    if (theSessionInformation.Session.ResultsRootDirectory == theLoadedSession.ResultsRootDirectory)
                    {
                        string msg =
                            string.Format(
                                "The {0} have the same results directory \n as session {1} in the project.",
                                theLoadedSession.SessionFileName, theSessionInformation.Session.SessionFileName);

                        MessageBox.Show(msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

//						this.display_message (msg);
//
//						// Open the browser dialog for changing the result directory
//						FolderBrowserDialog theFolderBrowserDialog = new FolderBrowserDialog();
//
//						theFolderBrowserDialog.Description = "Select or Create the new result directory";
//
//						// Show the browser dialog.
//						// If the user pressed the OK button...save the modified result directory
//						if (theFolderBrowserDialog.ShowDialog() == DialogResult.OK)
//						{
//							theLoadedSession.ResultsRootDirectory = theFolderBrowserDialog.SelectedPath;
//							if (theSessionInformation.Session.ResultsRootDirectory == theLoadedSession.ResultsRootDirectory)
//							{
//								msg =
//									string.Format(
//									"Failed to load session file: {0}.\n The result directory is not changed.",
//									theLoadedSession.SessionFileName);
//								this.display_message (msg);
//							}
//							else
//							{
//								SessionInformation theSessionInfo = new SessionInformation(theLoadedSession);
//								theSessionInfo.HasChanged = true;
//								_LoadedSessions.Add(theSessionInfo);
//								_HasProjectChanged = true;
//							}
//						}
//						else
//						{
//							msg =
//								string.Format(
//								"Failed to load session file: {0}.\n The result directory is not changed.",
//								theLoadedSession.SessionFileName);
//							this.display_message (msg);
//						}
//						return;
                    }
                }

                _LoadedSessions.Add(new SessionInformation(theLoadedSession));
                _HasProjectChanged = true;
            }
        }
コード例 #28
0
ファイル: TreeNodeTag.cs プロジェクト: ewcasas/DVTK
 public TreeNodeTag(Dvtk.Sessions.Session theSession)
 {
     _Session = theSession;
 }
コード例 #29
0
ファイル: ProjectForm2.cs プロジェクト: ewcasas/DVTK
        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 = GetSelectedSession() 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(GetSelectedSession(), SessionChange.SessionChangeSubTypEnum.OTHER);
                    Notify(theSessionChange);
                }
            }
        }
コード例 #30
0
ファイル: Project.cs プロジェクト: ewcasas/DVTK
 public SessionInformation(Dvtk.Sessions.Session theSession)
 {
     _Session = theSession;
 }
コード例 #31
0
ファイル: SopClassesManager.cs プロジェクト: ewcasas/DVTK
 public void SetSessionChanged(Dvtk.Sessions.Session theSession)
 {
     if (theSession == _SessionUsedForContentsOfTabSpecifySopClasses)
     {
         _SessionUsedForContentsOfTabSpecifySopClasses = null;
     }
 }
コード例 #32
0
 public SessionInformation(Dvtk.Sessions.Session theSession)
 {
     _Session = theSession;
 }
コード例 #33
0
 public EmulatorSessionTag(Dvtk.Sessions.Session theSession) : base(theSession)
 {
 }
コード例 #34
0
ファイル: ProjectForm2.cs プロジェクト: ewcasas/DVTK
        public void TCM_Update(object theSource, object theEvent)
        {
            _TCM_UpdateCount++;

            if (theEvent is UpdateAll)
            {
                // Don't do anything.
                // The Session tree view will be completely updated, and
                // as an indirect result, this tab control will be updated
                // (if another tree view node is selected).
            }

            if (theEvent is SessionTreeViewSelectionChange)
            {
                // Update the tab control only if this event is from the
                // associated tree view.
                if (theSource == this)
                {
                    _SopClassesManager.RemoveDynamicDataBinding();

                    TCM_UpdateTabsShown();

                    TCM_UpdateTabContents();
                }
            }

            if (theEvent is SessionChange)
            {
                SessionChange theSessionChange = (SessionChange)theEvent;

                // The contents of a text box or numeric control has changed directly by the user.
                if (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.OTHER)
                {
                    // Invalidate the session used for updating the Session Information tab only if
                    // this event is from another tab control.
                    if (theSource != this)
                    {
                        if (_TCM_SessionUsedForContentsOfTabSessionInformation == theSessionChange.Session)
                        {
                            // Invalidate this session, so the tab control will redraw when set as the active tab control.
                            _TCM_SessionUsedForContentsOfTabSessionInformation = null;
                        }
                    }
                }

                // The session has changed by something else then a direct contents change of a text box or numeric control.
                if ( (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.DESCRIPTION_DIR) ||
                    (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.RESULTS_DIR ) ||
                    (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.SCRIPTS_DIR ) )
                {
                    if (_TCM_SessionUsedForContentsOfTabSessionInformation == theSessionChange.Session)
                    {
                        // Invalidate this session, so the tab control will redraw when set as the active tab control.
                        _TCM_SessionUsedForContentsOfTabSessionInformation = null;
                    }
                }

                // The SOP classes manager is only interested in changes of SOP classes related settings.
                // This is not important for the other tabs.
                if (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_OTHER)
                {
                    _SopClassesManager.SetSessionChanged(theSessionChange.Session);
                }

                // The SOP classes manager is only interested in changes of SOP classes related settings.
                // This is not important for the other tabs.
                if (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_AE_TITLE_VERSION)
                {
                    if (theSource != this)
                    {
                        _SopClassesManager.SetSessionChanged(theSessionChange.Session);
                    }
                }

                // The SOP classes manager is only interested in changes of SOP classes related settings.
                // This is not important for the other tabs.
                if (theSessionChange.SessionChangeSubTyp == SessionChange.SessionChangeSubTypEnum.SOP_CLASSES_LOADED_STATE)
                {
                    if (theSource != this)
                    {
                        _SopClassesManager.SetSessionChanged(theSessionChange.Session);
                    }
                }

                // Update the current visible tab control, only if necessary.
                TCM_UpdateTabContents();
            }

            if (theEvent is StartExecution)
            {
                if (theSource == this)
                {
                    StartExecution theStartExecution = (StartExecution)theEvent;
                    TreeNodeTag theTreeNodeTag = (TreeNodeTag)theStartExecution.TreeNode.Tag;

                    TCM_ClearActivityLogging();

                    theTreeNodeTag._Session.ActivityReportEvent += _ActivityReportEventHandler;

                    // For some strange reason, if the session tree control is disabled and this statement
                    // is not present, switching to another application and back will result in a disabled
                    // application (when the StartEmulatorExecution is received).
                    TabControl.Focus();
                }
            }

            if (theEvent is EndExecution)
            {
                if (theSource == this)
                {
                    EndExecution theEndExecution = (EndExecution)theEvent;

                    theEndExecution._Tag._Session.ActivityReportEvent -= _ActivityReportEventHandler;
                }
            }

            if (theEvent is SessionRemovedEvent)
            {
                TCM_UpdateTabsShown();

                TCM_UpdateTabContents();
            }

            _TCM_UpdateCount--;
        }
コード例 #35
0
ファイル: EventType.cs プロジェクト: ewcasas/DVTK
 public SessionRemovedEvent(Dvtk.Sessions.Session theSession)
 {
     _Session = theSession;
 }
コード例 #36
0
ファイル: EventType.cs プロジェクト: ewcasas/DVTK
 public SessionReplaced(Dvtk.Sessions.Session theOldSession, Dvtk.Sessions.Session theNewSession)
 {
     _OldSession = theOldSession;
     _NewSession = theNewSession;
 }
コード例 #37
0
ファイル: WizardNew.cs プロジェクト: ewcasas/DVTK
        private void ButtonNext_Click(object sender, System.EventArgs e)
        {
            switch (this.current_page)
            {
                case 1:     // Create new Project or Session
                    if (this.RadioNewProject.Checked)
                    {
                        if (MessageBox.Show (this,
                            "The currently opened project will be closed. Are you sure you want to continue?",
                            "Replace currently opened project?",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Question,
                            MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            this.current_page = 2;
                            if (this.ProjectFileName.Text != "")
                                this.ButtonNext.Enabled = true;
                            else
                                this.ButtonNext.Enabled = false;
                            this.WizardPages.SelectedTab = this.Page2;
                            this.ButtonPrev.Enabled = true;
                        }
                    }
                    else
                    {
                        // User selected to create a new session.
                        this.current_page = 4;
                        if (this.SessionFileName.Text != "")
                            this.ButtonNext.Enabled = true;
                        else
                            this.ButtonNext.Enabled = false;
                        this.WizardPages.SelectedTab = this.Page4;
                        this.ButtonPrev.Enabled = true;
                    }
                    break;
                case 2:     // Create new Project file
                    // Next step is the Add Session Files wizard page
                    this.current_page = 3;
                    this.ButtonNext.Text = "Finish";
                    this.ButtonNext.Enabled = true;
                    this.ButtonPrev.Enabled = true;
                    if (this.ListBoxSessions.Items.Count == 0)
                        this.ButtonRemoveSession.Enabled = false;
                    this.WizardPages.SelectedTab = this.Page3;
                    break;
                case 3:     // Select Session Files
                    this.created_project = true;
                    this.Close();
                    break;
                case 4:     // Create new Session file
                    this.current_page = 5;
                    this.ComboBoxSessionType.SelectedIndex = 0;
                    this.WizardPages.SelectedTab = this.Page5;
                    this.ButtonPrev.Enabled = true;
                    break;
                case 5:     // Session properties
                    switch (this.ComboBoxSessionType.SelectedIndex)
                    {
                        case 0:     // Script
                            session = new Dvtk.Sessions.ScriptSession ();
                            this.current_page = 6;
                            this.WizardPages.SelectedTab = this.Page6;
                            break;
                        case 1:     // Media
                            session = new Dvtk.Sessions.MediaSession ();
                            this.current_page = 11;
                            this.WizardPages.SelectedTab = this.Page11;
                            break;
                        case 2:     // Emulator
                            session = new Dvtk.Sessions.EmulatorSession ();
                            this.current_page = 6;
                            this.WizardPages.SelectedTab = this.Page6;
                            break;
                    }
                    session.SessionTitle = this.TextBoxSessionTitle.Text;
                    session.TestedBy = this.TextBoxUserName.Text;
                   // session.Date = this.DateSession.Value;
                    session.LogLevelFlags = Dvtk.Sessions.LogLevelFlags.Error |
                        Dvtk.Sessions.LogLevelFlags.Warning |
                        Dvtk.Sessions.LogLevelFlags.Info;
                    session.StorageMode = Dvtk.Sessions.StorageMode.AsMedia;
                    session.AutoCreateDirectory = true;
                    session.ContinueOnError = true;

                    // Store the session filename which has been set in the previous
                    // step.
                    session.SessionFileName = this.SessionFileName.Text;
                    break;
                case 6:     // DVT Role settings
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // script session
                    {
                        ((Dvtk.Sessions.ScriptSession)session).DvtSystemSettings.AeTitle =               this.TextBoxDVTAeTitle.Text;
                        ((Dvtk.Sessions.ScriptSession)session).DvtSystemSettings.Port =                  (ushort)this.NumericDVTListenPort.Value;
                        ((Dvtk.Sessions.ScriptSession)session).DvtSystemSettings.SocketTimeout =         (ushort)this.NumericSocketTimeOut.Value;
                        ((Dvtk.Sessions.ScriptSession)session).DvtSystemSettings.MaximumLengthReceived = (uint)this.NumericDVTPDULength.Value;
                    }
                    else // emulator session
                    {
                        ((Dvtk.Sessions.EmulatorSession)session).DvtSystemSettings.AeTitle =               this.TextBoxDVTAeTitle.Text;
                        ((Dvtk.Sessions.EmulatorSession)session).DvtSystemSettings.Port =                  (ushort)this.NumericDVTListenPort.Value;
                        ((Dvtk.Sessions.EmulatorSession)session).DvtSystemSettings.SocketTimeout =         (ushort)this.NumericSocketTimeOut.Value;
                        ((Dvtk.Sessions.EmulatorSession)session).DvtSystemSettings.MaximumLengthReceived = (uint)this.NumericDVTPDULength.Value;
                    }
                    this.current_page = 7;
                    this.WizardPages.SelectedTab = this.Page7;
                    break;
                case 7:     // System Under Test settings
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // script session
                    {
                        ((Dvtk.Sessions.ScriptSession)session).SutSystemSettings.AeTitle =               this.TextBoxSUTAETitle.Text;
                        ((Dvtk.Sessions.ScriptSession)session).SutSystemSettings.Port =                  (ushort)this.NumericSUTListenPort.Value;
                        ((Dvtk.Sessions.ScriptSession)session).SutSystemSettings.HostName =              this.TextBoxTCPIP.Text;
                        ((Dvtk.Sessions.ScriptSession)session).SutSystemSettings.MaximumLengthReceived = (uint)this.NumericSUTPDULength.Value;
                        ((Dvtk.Sessions.ScriptSession)session).SecuritySettings.SecureSocketsEnabled =   this.CheckboxSecureConnection.Checked;
                    }
                    else // emulator session
                    {
                        ((Dvtk.Sessions.EmulatorSession)session).SutSystemSettings.AeTitle =               this.TextBoxSUTAETitle.Text;
                        ((Dvtk.Sessions.EmulatorSession)session).SutSystemSettings.Port =                  (ushort)this.NumericSUTListenPort.Value;
                        ((Dvtk.Sessions.EmulatorSession)session).SutSystemSettings.HostName =              this.TextBoxTCPIP.Text;
                        ((Dvtk.Sessions.EmulatorSession)session).SutSystemSettings.MaximumLengthReceived = (uint)this.NumericSUTPDULength.Value;
                        ((Dvtk.Sessions.EmulatorSession)session).SecuritySettings.SecureSocketsEnabled =   this.CheckboxSecureConnection.Checked;
                    }
                    if (this.CheckboxSecureConnection.Checked)
                    {
                        // Initialize the security settings panel
                        if (session is Dvtk.Sessions.ISecure)
                        {
                            Dvtk.Sessions.ISecuritySettings security_settings = null;

                            security_settings = (session as Dvtk.Sessions.ISecure).SecuritySettings;

                            if ((security_settings.TlsVersionFlags & Dvtk.Sessions.TlsVersionFlags.TLS_VERSION_TLSv1) != 0)
                                this.CheckBoxTLS.Checked = true;
                            if ((security_settings.TlsVersionFlags & Dvtk.Sessions.TlsVersionFlags.TLS_VERSION_SSLv3) != 0)
                                this.CheckBoxSSL.Checked = true;
                            this.CheckBoxCacheSecureSessions.Checked = security_settings.CacheTlsSessions;
                            this.CheckBoxCheckRemoteCertificates.Checked = security_settings.CheckRemoteCertificate;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_AUTHENICATION_METHOD_DSA) != 0)
                                this.CheckBoxAuthenticationDSA.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_AUTHENICATION_METHOD_RSA) != 0)
                                this.CheckBoxAuthenticationRSA.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_DATA_INTEGRITY_METHOD_MD5) != 0)
                                this.CheckBoxDataIntegrityMD5.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_DATA_INTEGRITY_METHOD_SHA1) != 0)
                                this.CheckBoxDataIntegritySHA.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_3DES) != 0)
                                this.CheckBoxEncryptionTripleDES.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_AES128) != 0)
                                this.CheckBoxEncryptionAES128.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_AES256) != 0)
                                this.CheckBoxEncryptionAES256.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_ENCRYPTION_METHOD_NONE) != 0)
                                this.CheckBoxEncryptionNone.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_KEY_EXCHANGE_METHOD_DH) != 0)
                                this.CheckBoxKeyExchangeDH.Checked = true;
                            if ((security_settings.CipherFlags & Dvtk.Sessions.CipherFlags.TLS_KEY_EXCHANGE_METHOD_RSA) != 0)
                                this.CheckBoxKeyExchangeRSA.Checked = true;
                        }

                        this.current_page = 8;
                        this.WizardPages.SelectedTab = this.Page8;
                    }
                    else
                    {
                        this.current_page = 11;
                        this.WizardPages.SelectedTab = this.Page11;
                    }
                    break;
                case 8:     // Security settings
                    // The settings need not be updated from the UI to the session settings.
                    // This has been done already when a checkbox has been checked/unchecked.
                    this.current_page = 9;
                    this.WizardPages.SelectedTab = this.Page9;
                    break;
                case 9:     // Add Credentials
                    // Still todo. Can be implemented when the credentials part is accessible from the component.
                    this.current_page = 10;
                    this.WizardPages.SelectedTab = this.Page10;
                    break;
                case 10:    // Add trusted certificates
                    // Still todo. Can be implemented when the credentials part is accessible from the component.
                    this.current_page = 11;
                    this.WizardPages.SelectedTab = this.Page11;
                    break;
                case 11:    // Environment settings
                    this.session.ResultsRootDirectory = this.TextBoxResultsRoot.Text;
                    this.session.DefinitionManagement.DefinitionFileRootDirectory = this.TextBoxDefinitionRoot.Text;
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // Script session
                        ((Dvtk.Sessions.ScriptSession)session).DicomScriptRootDirectory = this.TextBoxScriptRoot.Text;
                    this.current_page = 12;
                    this.ButtonNext.Text = "Finish";
                    this.WizardPages.SelectedTab = this.Page12;
                    break;
                case 12:    // Load definition files
                    foreach (string def_file in this.ListBoxDefinitionFiles.Items)
                    {
                        this.session.DefinitionManagement.LoadDefinitionFile (def_file);
                    }
                    session.SaveToFile ();
                    this.created_session = true;
                    this.Close();
                    break;
            }

            UpdateTab(current_page);
        }
コード例 #38
0
 public EmulatorTag(Dvtk.Sessions.Session theSession, EmulatorType theEmulatorType) : base(theSession)
 {
     _EmulatorType = theEmulatorType;
 }
コード例 #39
0
ファイル: EventType.cs プロジェクト: ewcasas/DVTK
 public SessionChange(Dvtk.Sessions.Session theSession, SessionChangeSubTypEnum theSessionChangeSubTyp)
 {
     _Session = theSession;
     _SessionChangeSubTyp = theSessionChangeSubTyp;
 }
コード例 #40
0
 public MediaSessionTag(Dvtk.Sessions.Session theSession) : base(theSession)
 {
 }
コード例 #41
0
ファイル: SOPClassUserControl.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Update the Specify SOP classes tab.
        /// </summary>
        public void UpdateDataGrid(Dvtk.Sessions.ScriptSession session)
        {
            theSession = session;

            Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

            // Update the definition file directories list box.
            ListBoxSpecifySopClassesDefinitionFileDirectories.Items.Clear();

            UpdateRemoveButton();

            foreach (string theDefinitionFileDirectory in theDefinitionFileDirectoryList)
            {
                ListBoxSpecifySopClassesDefinitionFileDirectories.Items.Add(theDefinitionFileDirectory);
            }

            // Update the SOP classes data grid.
            // For every definition file directory, use the .def files present in the directory.
            RichTextBoxSpecifySopClassesInfo.Clear();
            _DefinitionFilesInfoForDataGrid.Clear();

            // Add the correct information to the datagrid by inspecting the definition directory.
            // When doing this, also fill the combobox with available ae title - version combinations.
            AddSopClassesToDataGridFromDirectories();

            // Add the correct information to the datagrid by inspecting the loaded definitions.
            // When doing this, also fill the combobox with available ae title - version combinations.
            // Only add an entry if it does not already exist.
            AddSopClassesToDataGridFromLoadedDefinitions();

            // 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.
            DataGridSpecifySopClasses.SetDataBinding(null, "");

            // Actually refresh the data grid.
            DataGridSpecifySopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");
            //DataGridSpecifySopClasses.DataSource = _DefinitionFilesInfoForDataGrid;

            DataGridSpecifySopClasses.Refresh();
        }
コード例 #42
0
ファイル: SopClassesManager.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Update the Specify SOP classes tab.
        /// </summary>
        public void Update()
        {
            if (_SessionUsedForContentsOfTabSpecifySopClasses == GetSessionTreeViewManager().GetSelectedSession())
            {
                // No need to update, this tab already contains the correct session information.
                _DataGridSopClasses.SetDataBinding(_DefinitionFilesInfoForDataGrid, "");
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;

                Dvtk.Sessions.Session theSession = GetSessionTreeViewManager().GetSelectedSession();
                Dvtk.Sessions.DefinitionFileDirectoryList theDefinitionFileDirectoryList = theSession.DefinitionManagement.DefinitionFileDirectoryList;

                // Update the definition file directories list box.
                _ListBoxDefinitionFileDirectories.Items.Clear();

                UpdateRemoveButton();

                foreach(string theDefinitionFileDirectory in theDefinitionFileDirectoryList)
                {
                    _ListBoxDefinitionFileDirectories.Items.Add(theDefinitionFileDirectory);
                }

                // Update the SOP classes data grid.
                // For every definition file directory, use the .def files present in the directory.
                _RichTextBoxInfo.Clear();
                _ComboBoxAeTitle.Items.Clear();
                _ComboBoxAeTitle.Items.Add(_DefaultAeTitleVersion);
                _DefinitionFilesInfoForDataGrid.Clear();

                // Add the correct information to the datagrid by inspecting the definition directory.
                // When doing this, also fill the combobox with available ae title - version combinations.
                AddSopClassesToDataGridFromDirectories();

                // Add the correct information to the datagrid by inspecting the loaded definitions.
                // When doing this, also fill the combobox with available ae title - version combinations.
                // Only add an entry if it does not already exist.
                AddSopClassesToDataGridFromLoadedDefinitions();

                // Make the correct AE title - version in the combo box the current one.
                SetSelectedAeTitleVersion();

                // 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, "");
                //_DataGridSopClasses.DataSource = _DefinitionFilesInfoForDataGrid;

                _DataGridSopClasses.Refresh();

                _SessionUsedForContentsOfTabSpecifySopClasses = GetSessionTreeViewManager().GetSelectedSession();

                Cursor.Current = Cursors.Default;
            }
        }
コード例 #43
0
ファイル: ProjectForm.cs プロジェクト: ewcasas/DVTK
        private void ComboBoxSessionType_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if ((this.ComboBoxSessionType.SelectedItem.ToString() == "Script") &&
                !(this.selected_session is Dvtk.Sessions.ScriptSession))
            {
                // We only want to replace the selected session when the user
                // has changed the session type.
                Dvtk.Sessions.ScriptSession    session;
                session = new Dvtk.Sessions.ScriptSession();

                session.SessionFileName = this.selected_session.SessionFileName;

                session.SessionTitle = this.TextBoxSessionTitle.Text;
                session.SessionId = Convert.ToUInt16 (this.NumericSessonID.Value);
                session.TestedBy = this.TextBoxTestedBy.Text;
                session.Date = this.DateTested.Value;
                if (this.TextBoxResultsRoot.Text == "")
                    session.ResultsRootDirectory = ".";
                else
                    session.ResultsRootDirectory = this.TextBoxResultsRoot.Text;

                if (this.TextBoxScriptRoot.Text == "")
                    session.DicomScriptRootDirectory = ".";
                else
                    session.DicomScriptRootDirectory = this.TextBoxScriptRoot.Text;

                session.DvtSystemSettings.AeTitle = this.TextBoxDVTAETitle.Text;
                session.DvtSystemSettings.Port = (ushort)this.NumericDVTListenPort.Value;
                session.DvtSystemSettings.SocketTimeout = (ushort)this.NumericDVTTimeOut.Value;
                session.DvtSystemSettings.MaximumLengthReceived = (uint)this.NumericDVTMaxPDU.Value;

                session.SutSystemSettings.AeTitle = this.TextBoxSUTAETitle.Text;
                session.SutSystemSettings.Port = (ushort)this.NumericSUTListenPort.Value;
                session.SutSystemSettings.HostName = this.TextBoxSUTTCPIPAddress.Text;
                session.SutSystemSettings.MaximumLengthReceived = (uint)this.NumericSUTMaxPDU.Value;

                session.SecuritySettings.SecureSocketsEnabled = this.CheckBoxSecureConnection.Checked;
                if (this.CheckBoxSecureConnection.Checked)
                {
                    session.SecuritySettings.CacheTlsSessions = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CacheTlsSessions;
                    session.SecuritySettings.CertificateFileName = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CertificateFileName;
                    session.SecuritySettings.CheckRemoteCertificate = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CheckRemoteCertificate;
                    session.SecuritySettings.CipherFlags = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CipherFlags;
                    session.SecuritySettings.CredentialsFileName = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CredentialsFileName;
                    session.SecuritySettings.TlsCacheTimeout = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsCacheTimeout;
                    session.SecuritySettings.TlsPassword = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsPassword;
                    session.SecuritySettings.TlsVersionFlags = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsVersionFlags;
                }

                // Copy the definition settings (SOP Classes, AE title/version and definition dirs)
                session.DefinitionManagement.ApplicationEntityName = this.selected_session.DefinitionManagement.ApplicationEntityName;
                session.DefinitionManagement.ApplicationEntityVersion = this.selected_session.DefinitionManagement.ApplicationEntityVersion;
                session.DefinitionManagement.DefinitionFileDirectoryList.Clear ();
                foreach (string def_dir in this.selected_session.DefinitionManagement.DefinitionFileDirectoryList)
                    session.DefinitionManagement.DefinitionFileDirectoryList.Add (def_dir);
                session.DefinitionManagement.DefinitionFileRootDirectory = this.selected_session.DefinitionManagement.DefinitionFileRootDirectory;
                foreach (string def_file in this.selected_session.DefinitionManagement.LoadedDefinitionFileNames)
                    session.DefinitionManagement.LoadDefinitionFile (def_file);
                this.selected_session.DefinitionManagement.UnLoadDefinitionFiles ();

                //this.project.ReplaceSession (this.selected_session, session, this._activity_handler);
                foreach (TreeNode node in this.SessionBrowser.Nodes)
                {
                    // Clear the tree node representing the old session.
                    if (node.Text == session.SessionFileName)
                        node.Nodes.Clear ();
                }

                this.selected_session = session;
                this.UpdateSessionProperties ();
                ////////this.project.SetSessionChanged (session.SessionFileName, true);
                this.ResizeSessionPropertiesView ();
            }
            if ((this.ComboBoxSessionType.SelectedItem.ToString() == "Media") &&
                !(this.selected_session is Dvtk.Sessions.MediaSession))
            {
                // We only want to replace the selected session when the user
                // has changed the session type.
                Dvtk.Sessions.MediaSession  session;
                session = new Dvtk.Sessions.MediaSession ();

                session.SessionFileName = this.selected_session.SessionFileName;

                session.SessionTitle = this.TextBoxSessionTitle.Text;
                session.SessionId = Convert.ToUInt16 (this.NumericSessonID.Value);
                session.TestedBy = this.TextBoxTestedBy.Text;
                session.Date = this.DateTested.Value;
                if (this.TextBoxResultsRoot.Text == "")
                    session.ResultsRootDirectory = ".";
                else
                    session.ResultsRootDirectory = this.TextBoxResultsRoot.Text;

                // Copy the definition settings (SOP Classes, AE title/version and definition dirs)
                session.DefinitionManagement.ApplicationEntityName = this.selected_session.DefinitionManagement.ApplicationEntityName;
                session.DefinitionManagement.ApplicationEntityVersion = this.selected_session.DefinitionManagement.ApplicationEntityVersion;
                session.DefinitionManagement.DefinitionFileDirectoryList.Clear ();
                foreach (string def_dir in this.selected_session.DefinitionManagement.DefinitionFileDirectoryList)
                    session.DefinitionManagement.DefinitionFileDirectoryList.Add (def_dir);
                session.DefinitionManagement.DefinitionFileRootDirectory = this.selected_session.DefinitionManagement.DefinitionFileRootDirectory;
                foreach (string def_file in this.selected_session.DefinitionManagement.LoadedDefinitionFileNames)
                    session.DefinitionManagement.LoadDefinitionFile (def_file);
                this.selected_session.DefinitionManagement.UnLoadDefinitionFiles ();

                //this.project.ReplaceSession (this.selected_session, session, this._activity_handler);
                foreach (TreeNode node in this.SessionBrowser.Nodes)
                {
                    // Clear the tree node representing the old session.
                    if (node.Text == session.SessionFileName)
                        node.Nodes.Clear ();
                }

                this.selected_session = session;
                this.UpdateSessionProperties ();
                //////this.project.SetSessionChanged (session.SessionFileName, true);
                this.ResizeSessionPropertiesView ();
            }
            if ((this.ComboBoxSessionType.SelectedItem.ToString() == "Emulator") &&
                !(this.selected_session is Dvtk.Sessions.EmulatorSession))
            {
                // We only want to replace the selected session when the user
                // has changed the session type.
                Dvtk.Sessions.EmulatorSession   session;
                session = new Dvtk.Sessions.EmulatorSession ();

                session.SessionFileName = this.selected_session.SessionFileName;

                session.SessionTitle = this.TextBoxSessionTitle.Text;
                session.SessionId = Convert.ToUInt16 (this.NumericSessonID.Value);
                session.TestedBy = this.TextBoxTestedBy.Text;
                session.Date = this.DateTested.Value;
                if (this.TextBoxResultsRoot.Text == "")
                    session.ResultsRootDirectory = ".";
                else
                    session.ResultsRootDirectory = this.TextBoxResultsRoot.Text;

                session.DvtSystemSettings.AeTitle = this.TextBoxDVTAETitle.Text;
                session.DvtSystemSettings.Port = (ushort)this.NumericDVTListenPort.Value;
                session.DvtSystemSettings.SocketTimeout = (ushort)this.NumericDVTTimeOut.Value;
                session.DvtSystemSettings.MaximumLengthReceived = (uint)this.NumericDVTMaxPDU.Value;

                session.SutSystemSettings.AeTitle = this.TextBoxSUTAETitle.Text;
                session.SutSystemSettings.Port = (ushort)this.NumericSUTListenPort.Value;
                session.SutSystemSettings.HostName = this.TextBoxSUTTCPIPAddress.Text;
                session.SutSystemSettings.MaximumLengthReceived = (uint)this.NumericSUTMaxPDU.Value;

                session.SecuritySettings.SecureSocketsEnabled = this.CheckBoxSecureConnection.Checked;
                if (this.CheckBoxSecureConnection.Checked)
                {
                    session.SecuritySettings.CacheTlsSessions = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CacheTlsSessions;
                    session.SecuritySettings.CertificateFileName = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CertificateFileName;
                    session.SecuritySettings.CheckRemoteCertificate = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CheckRemoteCertificate;
                    session.SecuritySettings.CipherFlags = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CipherFlags;
                    session.SecuritySettings.CredentialsFileName = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.CredentialsFileName;
                    session.SecuritySettings.TlsCacheTimeout = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsCacheTimeout;
                    session.SecuritySettings.TlsPassword = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsPassword;
                    session.SecuritySettings.TlsVersionFlags = ((Dvtk.Sessions.ISecure)this.selected_session).SecuritySettings.TlsVersionFlags;
                }

                // Copy the definition settings (SOP Classes, AE title/version and definition dirs)
                session.DefinitionManagement.ApplicationEntityName = this.selected_session.DefinitionManagement.ApplicationEntityName;
                session.DefinitionManagement.ApplicationEntityVersion = this.selected_session.DefinitionManagement.ApplicationEntityVersion;
                session.DefinitionManagement.DefinitionFileDirectoryList.Clear ();
                foreach (string def_dir in this.selected_session.DefinitionManagement.DefinitionFileDirectoryList)
                    session.DefinitionManagement.DefinitionFileDirectoryList.Add (def_dir);
                session.DefinitionManagement.DefinitionFileRootDirectory = this.selected_session.DefinitionManagement.DefinitionFileRootDirectory;
                foreach (string def_file in this.selected_session.DefinitionManagement.LoadedDefinitionFileNames)
                    session.DefinitionManagement.LoadDefinitionFile (def_file);
                this.selected_session.DefinitionManagement.UnLoadDefinitionFiles ();

                //this.project.ReplaceSession (this.selected_session, session, this._activity_handler);
                foreach (TreeNode node in this.SessionBrowser.Nodes)
                {
                    // Clear the tree node representing the old session.
                    if (node.Text == session.SessionFileName)
                        node.Nodes.Clear ();
                }

                this.selected_session = session;
                this.UpdateSessionProperties ();
                //////this.project.SetSessionChanged (session.SessionFileName, true);
                this.ResizeSessionPropertiesView ();
            }

            // Update the session tree browser
            this.UpdateSessionTreeView ();

            // Update the mainform controls (menu, toolbar, title)
            ((MainForm)this.ParentForm).UpdateUIControls ();
        }