Пример #1
0
        private void btnFileEncodingEdit_Click(object sender, EventArgs e)
        {
            if (lstFiles.SelectedItems.Count > 0)
            {
                // get currently selected exclusion
                var item = lstFiles.SelectedItems[0].Tag as FileEncoding;
                item.Enabled = lstFiles.SelectedItems[0].Checked;

                var dialog = new frmAddEditFileEncoding();
                dialog.SelectedFileEncoding = item;
                if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    item = dialog.SelectedFileEncoding;
                    var listItem = GetFileEncodingListViewItem(item);
                    lstFiles.SelectedItems[0].Checked = item.Enabled;
                    lstFiles.SelectedItems[0].Tag     = item;

                    lstFiles.SelectedItems[0].SubItems[1].Text = listItem.SubItems[1].Text;
                    lstFiles.SelectedItems[0].SubItems[2].Text = listItem.SubItems[2].Text;

                    SetFileEncodingButtonState();
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.None;
        }
Пример #2
0
        private void btnFileEncodingAdd_Click(object sender, EventArgs e)
        {
            var dialog = new frmAddEditFileEncoding();

            if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                lstFiles.Items.Add(GetFileEncodingListViewItem(dialog.SelectedFileEncoding));

                SetFileEncodingButtonState();
            }

            this.DialogResult = System.Windows.Forms.DialogResult.None;
        }