Opc.Ua.Configuration.ManagedApplicationDlg.OkBTN_Click C# (CSharp) Метод

OkBTN_Click() приватный Метод

private OkBTN_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void OkBTN_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(ApplicationNameTB.Text))
                {
                    MessageBox.Show("Application Name must be specified.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // set source file.
                string filePath = null;

                if (m_application.SourceFile != null)
                {
                    filePath = m_application.SourceFile.FullName;
                }
                else
                {
                    filePath = Utils.GetAbsoluteDirectoryPath("%LocalApplicationData%\\OPC Foundation\\Applications\\", false, false, true);
                    filePath += ApplicationNameTB.Text;
                    filePath += ".xml";
                }

                // check if exists.
                if (File.Exists(filePath))
                {
                    if (MessageBox.Show("File exists. Overwrite?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                // save the file.
                m_application.DisplayName = ApplicationNameTB.Text;
                m_application.ExecutablePath = ExecutableFileTB.Text;
                m_application.ConfigurationPath = ConfigurationFileTB.Text;
                m_application.Certificate = m_certificate;
                m_application.TrustList = m_trustList;

                m_application.Save(filePath);
                
                DialogResult = DialogResult.OK;
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, System.Reflection.MethodBase.GetCurrentMethod(), exception);
            }
        }