Beispiel #1
0
        private void editButton_Click(object sender, EventArgs e)
        {
            int index = comboBox1.SelectedIndex;

            if (index >= 0)
            {
                var config                = SelectedConfig;
                var filenameBeforeEdit    = config.Filename;
                var descriptionBeforeEdit = config.Description;
                var dialog                = new RulesEditor(config);
                var res = dialog.ShowDialog(ParentForm);
                if (res == DialogResult.OK)
                {
                    var newConfig = dialog.RulesConfig;
                    if (filenameBeforeEdit != null && descriptionBeforeEdit != null && newConfig.Description != descriptionBeforeEdit)
                    {
                        if (File.Exists(filenameBeforeEdit))
                        {
                            File.Delete(filenameBeforeEdit);
                        }
                    }
                    IOManager.WriteRulesConfig(newConfig);

                    updateButtons();
                }
            }
        }
Beispiel #2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            var dialog = new RulesEditor();
            var res    = dialog.ShowDialog(this.ParentForm);

            if (res == DialogResult.OK)
            {
                var config = dialog.RulesConfig;
                _list.Add(config);
                IOManager.WriteRulesConfig(config);
                comboBox1.SelectedIndex = _list.Count - 1;
                updateButtons();
            }
        }