コード例 #1
0
        private RulesListView GetRulesListView()
        {
            RulesListView    view      = new RulesListView();
            CClientViewModel viewModel = new CClientViewModel(this, view);

            return(view);
        }
コード例 #2
0
        // move selected rule down in the RulesListView item order
        private void MoveRuleDownButtonClick(object sender, EventArgs e)
        {
            IRenameRule currentSelectedRule = (IRenameRule)RulesListView.SelectedItems[0].Tag;
            int         oldRuleIndex        = Globals.RenameRules.IndexOf(Globals.RenameRules.Find(rule => rule.Id == currentSelectedRule.Id));
            int         newRuleIndex        = oldRuleIndex + 1;

            Globals.RenameRules.RemoveAt(oldRuleIndex);
            Globals.RenameRules.Insert(newRuleIndex, currentSelectedRule);
            UpdateRulesListView();
            UpdateFileRenameListView();
            RulesListView.Focus();
            RulesListView.Items[newRuleIndex].Focused  = true;
            RulesListView.Items[newRuleIndex].Selected = true;
        }
コード例 #3
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;
        }
コード例 #4
0
        // remove selected rule from the list of rules, update UI state
        private void DeleteRuleButtonClick(object sender, EventArgs e)
        {
            IRenameRule currentSelectedRule = (IRenameRule)RulesListView.SelectedItems[0].Tag;
            int         ruleIndex           = Globals.RenameRules.IndexOf(Globals.RenameRules.Find(rule => rule.Id == currentSelectedRule.Id));

            Globals.RenameRules.RemoveAt(ruleIndex);
            UpdateRulesListView();
            UpdateFileRenameListView();
            RulesListView.Focus();
            if (RulesListView.Items.Count != 0)
            {
                RulesListView.Items[RulesListView.Items.Count - 1].Focused  = true;
                RulesListView.Items[RulesListView.Items.Count - 1].Selected = true;
            }
            else
            {
                DeleteRuleButton.Enabled = false;
                EditRuleButton.Enabled   = false;
                RenameButton.Enabled     = false;
            }
            UpdateRuleButtonStates(null, null);
        }
コード例 #5
0
        // update the RulesListView rename rule items
        private void UpdateRulesListView()
        {
            RulesListView.Items.Clear();
            for (int i = 0; i < Globals.RenameRules.Count; i++)
            {
                IRenameRule  rule       = Globals.RenameRules[i];
                ListViewItem ruleLVItem = new ListViewItem
                {
                    Text = (i + 1).ToString()
                };
                ruleLVItem.Checked = rule.Enabled;

                ruleLVItem.SubItems.Add(rule.Name);
                ruleLVItem.SubItems.Add(rule.Description);
                ruleLVItem.Tag = rule;
                RulesListView.Items.Add(ruleLVItem);
            }
            if (RulesListView.Items.Count > 0)
            {
                RulesListView.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
            }
            ResetOldNewFileNameValues();
        }
コード例 #6
0
        private void ShowViewRulesList()
        {
            RulesListView view = GetRulesListView();

            view.Show();
        }