Beispiel #1
0
        public bool EditRules(List <Rule> rules)
        {
            RulesForm editForm = new RulesForm(_eventAggregator);

            editForm.DisplayRules(rules);
            bool isOk = editForm.ShowDialog() == DialogResult.OK;

            return(isOk);
        }
        // create a new rename rule, update UI state
        private void NewRuleButtonClick(object sender, EventArgs e)
        {
            RulesForm    rulesForm    = new RulesForm();
            DialogResult dialogResult = rulesForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                UpdateRulesListView();
                UpdateFileRenameListView();
            }
            RenameButton.Enabled = TorrentFileListTreeView.TotalFilesSelected > 0 && RulesListView.Items.Count > 0;
        }
        // edit selected rule from the list of rules, update UI state
        private void EditRuleButtonClick(object sender, EventArgs e)
        {
            IRenameRule  currentSelectedRule = (IRenameRule)RulesListView.SelectedItems[0].Tag;
            int          currentRuleIndex    = RulesListView.SelectedItems[0].Index;
            RulesForm    rulesForm           = new RulesForm(editMode: true, currentSelectedRule);
            DialogResult dialogResult        = rulesForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                UpdateRulesListView();
                UpdateFileRenameListView();
                RulesListView.Focus();
                RulesListView.Items[currentRuleIndex].Focused  = true;
                RulesListView.Items[currentRuleIndex].Selected = true;
            }
            RenameButton.Enabled = TorrentFileListTreeView.TotalFilesSelected > 0 && RulesListView.Items.Count > 0;
        }