예제 #1
0
        private void addSslButton_Click(object sender, System.EventArgs e)
        {
            try
            {
                using (SslConfigForm editor = new SslConfigForm())
                {
                    if (editor.ShowDialog() == DialogResult.OK)
                    {
                        SslConfigItem newItem = editor.UpdatedItem;

                        newItem.Status = ModifiedStatus.Added;

                        if (_sslItems.Contains(newItem.Key))
                        {
                            if (((ConfigItem)_sslItems[newItem.Key]).Status != ModifiedStatus.Removed)
                            {
                                MessageBox.Show(this, "SSL is already configured for the address and port you entered.", "Invalid Input");
                            }
                            else
                            {
                                newItem.Status         = ModifiedStatus.Modified;
                                _sslItems[newItem.Key] = newItem;
                            }
                        }
                        else
                        {
                            _sslItems.Add(newItem.Key, newItem);

                            applyButton.Enabled = true;
                        }

                        PopulateConfigListView(_sslItems, sslListView);
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayError(ex);
            }
            finally
            {
                EnableSslButtons();
            }
        }
예제 #2
0
        private void EditSsl()
        {
            try
            {
                SslConfigItem selectedItem = (SslConfigItem)sslListView.SelectedItems[0];

                using (SslConfigForm editor = new SslConfigForm(selectedItem))
                {
                    if (editor.ShowDialog() == DialogResult.OK)
                    {
                        _sslItems[selectedItem.Key] = editor.UpdatedItem;

                        applyButton.Enabled = true;

                        PopulateConfigListView(_sslItems, sslListView);
                    }
                }
            }
            finally
            {
                EnableSslButtons();
            }
        }