Esempio n. 1
0
        public PassWordForm(DvtkApplicationLayer.Session session, bool pwdCalledFirst)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.PasswordTextBox.Text = "";
            this._session = session;

            if (pwdCalledFirst == true)
            {
                this.InvalidPasswordLabel.Text = "Password";
            }
            else
            {
                this.InvalidPasswordLabel.Text = "Invalid Password ";
            }
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Esempio n. 2
0
        public PassWordForm(DvtkApplicationLayer.Session session, bool pwdCalledFirst)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.PasswordTextBox.Text = "";
            this._session             = session;

            if (pwdCalledFirst == true)
            {
                this.InvalidPasswordLabel.Text = "Password";
            }
            else
            {
                this.InvalidPasswordLabel.Text = "Invalid Password ";
            }
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Esempio n. 3
0
 /// <summary>
 /// Constructor .
 /// </summary>
 /// <param name="session"> DvtkApplicationLayer.Sesion</param>
 public PartOfSession(Session session)
 {
     this.session = session;
 }
Esempio n. 4
0
        private void ButtonNext_Click(object sender, System.EventArgs e)
        {
            Assembly ThisAssembly = Assembly.GetExecutingAssembly();
            AssemblyName ThisAssemblyName = ThisAssembly.GetName();

            string dvtVersion =
                string.Format(
                "{0:D}.{1:D}.{2:D}" ,
                ThisAssemblyName.Version.Major,
                ThisAssemblyName.Version.Minor,
                ThisAssemblyName.Version.Build
                );

            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
                            sessionApp = new DvtkApplicationLayer.ScriptSession (this.SessionFileName.Text);
                            this.current_page = 6;
                            this.WizardPages.SelectedTab = this.Page6;
                            break;
                        case 1:     // Media
                            sessionApp = new DvtkApplicationLayer.MediaSession (this.SessionFileName.Text);
                            this.current_page = 11;
                            this.WizardPages.SelectedTab = this.Page11;
                            break;
                        case 2:     // Emulator
                            sessionApp = new DvtkApplicationLayer.EmulatorSession (this.SessionFileName.Text);
                            this.current_page = 6;
                            this.WizardPages.SelectedTab = this.Page6;
                            break;
                    }
                    sessionApp.SessionTitle = this.TextBoxSessionTitle.Text;
                    sessionApp.SoftwareVersions = dvtVersion;
                    sessionApp.TestedBy = this.TextBoxUserName.Text;
                    sessionApp.LogLevelMask = (int)(DvtkApplicationLayer.Session.LogLevelFlags.Error | DvtkApplicationLayer.Session.LogLevelFlags.Warning |
                    DvtkApplicationLayer.Session.LogLevelFlags.Info);
                    sessionApp.Mode = DvtkApplicationLayer.Session.StorageMode.AsMedia;
                    sessionApp.AutoCreateDirectory = true;
                    sessionApp.ContinueOnError = true;

                    // Store the session filename which has been set in the previous
                    // step.
                    sessionApp.SessionFileName = this.SessionFileName.Text;
                    break;
                case 6:     // DVT Role settings
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // script session
                    {
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).DvtAeTitle =               this.TextBoxDVTAeTitle.Text;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).DvtPort =                  (ushort)this.NumericDVTListenPort.Value;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).DvtSocketTimeout =         (ushort)this.NumericSocketTimeOut.Value;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).DvtMaximumLengthReceived = (uint)this.NumericDVTPDULength.Value;
                    }
                    else // emulator session
                    {
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtAeTitle =               this.TextBoxDVTAeTitle.Text;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtPort =                  (ushort)this.NumericDVTListenPort.Value;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtSocketTimeout =         (ushort)this.NumericSocketTimeOut.Value;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtMaximumLengthReceived = (uint)this.NumericDVTPDULength.Value;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtImplementationClassUid= "1.2.826.0.1.3680043.2.1545.1";
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).DvtImplementationVersionName= "dvt" + dvtVersion;
                    }
                    this.current_page = 7;
                    this.WizardPages.SelectedTab = this.Page7;
                    break;
                case 7:     // System Under Test settings
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // script session
                    {
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).SutAeTitle =               this.TextBoxSUTAETitle.Text;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).SutPort =                  (ushort)this.NumericSUTListenPort.Value;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).SutHostName =              this.TextBoxTCPIP.Text;
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).SutMaximumLengthReceived = (uint)this.NumericSUTPDULength.Value;
                        //((DvtkApplicationLayer.ScriptSession)sessionApp).SecureSocketsEnabled =   this.CheckboxSecureConnection.Checked;
                        ((Dvtk.Sessions.ScriptSession)sessionApp.Implementation).SecuritySettings.SecureSocketsEnabled = this.CheckboxSecureConnection.Checked;
                    }
                    else // emulator session
                    {
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).SutAeTitle =               this.TextBoxSUTAETitle.Text;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).SutPort =                  (ushort)this.NumericSUTListenPort.Value;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).SutHostName =              this.TextBoxTCPIP.Text;
                        ((DvtkApplicationLayer.EmulatorSession)sessionApp).SutMaximumLengthReceived = (uint)this.NumericSUTPDULength.Value;
                        //((DvtkApplicationLayer.EmulatorSession)sessionApp).SecureSocketsEnabled =   this.CheckboxSecureConnection.Checked;
                        ((Dvtk.Sessions.EmulatorSession)sessionApp.Implementation).SecuritySettings.SecureSocketsEnabled = this.CheckboxSecureConnection.Checked;
                    }
                    if (this.CheckboxSecureConnection.Checked)
                    {
                        // Initialize the security settings panel
                        if (sessionApp.Implementation is Dvtk.Sessions.ISecure)
                        {
                            Dvtk.Sessions.ISecuritySettings security_settings = null;

                            security_settings = (sessionApp.Implementation 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.sessionApp.ResultsRootDirectory = this.TextBoxResultsRoot.Text;
                    this.sessionApp.Implementation.DefinitionManagement.DefinitionFileRootDirectory = this.TextBoxDefinitionRoot.Text;
                    if (this.ComboBoxSessionType.SelectedIndex == 0) // Script session
                        ((DvtkApplicationLayer.ScriptSession)sessionApp).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.sessionApp.Implementation.DefinitionManagement.LoadDefinitionFile (def_file);
                    }
                    sessionApp.Save();
                    this.created_session = true;
                    this.Close();
                    break;
            }

            UpdateTab(current_page);
        }