Exemple #1
0
        private void ButtonRuleCopy_Click(object sender, EventArgs e)
        {
            if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
            {
                tabdialog.Text = Properties.Resources.ButtonRuleCopy_ClickText1;
                if (tabdialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                string              tabname = ListTabs.SelectedItem.ToString();
                StringCollection    tabs    = tabdialog.SelectedTabNames;
                List <FiltersClass> filters = new List <FiltersClass>();

                foreach (int idx in ListFilters.SelectedIndices)
                {
                    filters.Add(_sts.Tabs[tabname].Filters[idx].CopyTo(new FiltersClass()));
                }
                foreach (string tb in tabs)
                {
                    if (tb != tabname)
                    {
                        foreach (FiltersClass flt in filters)
                        {
                            if (!_sts.Tabs[tb].Filters.Contains(flt))
                            {
                                _sts.Tabs[tb].AddFilter(flt.CopyTo(new FiltersClass()));
                            }
                        }
                    }
                }
                SetFilters(tabname);
            }
        }
Exemple #2
0
        private void ButtonRuleMove_Click(object sender, EventArgs e)
        {
            if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
            {
                TabClass[] selectedTabs;
                using (var dialog = new TabsDialog(_sts))
                {
                    dialog.MultiSelect = true;
                    dialog.Text        = Properties.Resources.ButtonRuleMove_ClickText1;

                    if (dialog.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }

                    selectedTabs = dialog.SelectedTabs;
                }
                string tabname = ListTabs.SelectedItem.ToString();
                List <PostFilterRule> filters = new List <PostFilterRule>();

                foreach (int idx in ListFilters.SelectedIndices)
                {
                    filters.Add(_sts.Tabs[tabname].FilterArray[idx].Clone());
                }
                if (selectedTabs.Length == 1 && selectedTabs[0].TabName == tabname)
                {
                    return;
                }
                foreach (var tb in selectedTabs)
                {
                    if (tb.TabName == tabname)
                    {
                        continue;
                    }

                    foreach (PostFilterRule flt in filters)
                    {
                        if (!tb.FilterArray.Contains(flt))
                        {
                            tb.AddFilter(flt.Clone());
                        }
                    }
                }
                for (int idx = ListFilters.Items.Count - 1; idx >= 0; idx--)
                {
                    if (ListFilters.GetSelected(idx))
                    {
                        _sts.Tabs[ListTabs.SelectedItem.ToString()].RemoveFilter((PostFilterRule)ListFilters.Items[idx]);
                        ListFilters.Items.RemoveAt(idx);
                    }
                }
                SetFilters(tabname);
            }
        }
        private void ButtonRuleCopy_Click(object sender, EventArgs e)
        {
            if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
            {
                TabClass[] selectedTabs;
                using (TabsDialog dialog = new TabsDialog(_sts))
                {
                    dialog.MultiSelect = true;
                    dialog.Text        = Properties.Resources.ButtonRuleCopy_ClickText1;

                    if (dialog.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }

                    selectedTabs = dialog.SelectedTabs;
                }

                string tabname = ListTabs.SelectedItem.ToString();
                List <FiltersClass> filters = new List <FiltersClass>();

                foreach (int idx in ListFilters.SelectedIndices)
                {
                    filters.Add(_sts.Tabs[tabname].Filters[idx].CopyTo(new FiltersClass()));
                }
                foreach (var tb in selectedTabs)
                {
                    if (tb.TabName == tabname)
                    {
                        continue;
                    }

                    foreach (FiltersClass flt in filters)
                    {
                        if (!tb.Filters.Contains(flt))
                        {
                            tb.AddFilter(flt.CopyTo(new FiltersClass()));
                        }
                    }
                }
                SetFilters(tabname);
            }
        }
Exemple #4
0
        private void ButtonRuleMove_Click(object sender, EventArgs e)
        {
            if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
            {
                TabClass[] selectedTabs;
                using (var dialog = new TabsDialog(_sts))
                {
                    dialog.MultiSelect = true;
                    dialog.Text = Properties.Resources.ButtonRuleMove_ClickText1;

                    if (dialog.ShowDialog(this) == DialogResult.Cancel) return;

                    selectedTabs = dialog.SelectedTabs;
                }
                string tabname = ListTabs.SelectedItem.ToString();
                List<PostFilterRule> filters = new List<PostFilterRule>();

                foreach (int idx in ListFilters.SelectedIndices)
                {
                    filters.Add(_sts.Tabs[tabname].Filters[idx].Clone());
                }
                if (selectedTabs.Length == 1 && selectedTabs[0].TabName == tabname) return;
                foreach (var tb in selectedTabs)
                {
                    if (tb.TabName == tabname) continue;

                    foreach (PostFilterRule flt in filters)
                    {
                        if (!tb.Filters.Contains(flt))
                            tb.AddFilter(flt.Clone());
                    }
                }
                for (int idx = ListFilters.Items.Count - 1; idx >= 0; idx--)
                {
                    if (ListFilters.GetSelected(idx))
                    {
                        _sts.Tabs[ListTabs.SelectedItem.ToString()].RemoveFilter((PostFilterRule)ListFilters.Items[idx]);
                        ListFilters.Items.RemoveAt(idx);
                    }
                }
                SetFilters(tabname);
            }
        }
Exemple #5
0
        private void ButtonRuleCopy_Click(object sender, EventArgs e)
        {
            if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
            {
                TabClass[] selectedTabs;
                using (TabsDialog dialog = new TabsDialog(_sts))
                {
                    dialog.MultiSelect = true;
                    dialog.Text = Properties.Resources.ButtonRuleCopy_ClickText1;

                    if (dialog.ShowDialog(this) == DialogResult.Cancel) return;

                    selectedTabs = dialog.SelectedTabs;
                }

                string tabname = ListTabs.SelectedItem.ToString();
                List<PostFilterRule> filters = new List<PostFilterRule>();

                foreach (int idx in ListFilters.SelectedIndices)
                {
                    filters.Add(_sts.Tabs[tabname].Filters[idx].Clone());
                }
                foreach (var tb in selectedTabs)
                {
                    if (tb.TabName == tabname) continue;

                    foreach (PostFilterRule flt in filters)
                    {
                        if (!tb.Filters.Contains(flt))
                            tb.AddFilter(flt.Clone());
                    }
                }
                SetFilters(tabname);
            }
        }
Exemple #6
0
        private bool SelectTab(out string tabName)
        {
            do
            {
                tabName = null;

                //振り分け先タブ選択
                using (var dialog = new TabsDialog(_statuses))
                {
                    if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;

                    var selectedTab = dialog.SelectedTab;
                    tabName = selectedTab == null ? null : selectedTab.TabName;
                }

                ListTab.SelectedTab.Focus();
                //新規タブを選択→タブ作成
                if (tabName == null)
                {
                    using (InputTabName inputName = new InputTabName())
                    {
                        inputName.TabName = _statuses.GetUniqueTabName();
                        inputName.ShowDialog();
                        if (inputName.DialogResult == DialogResult.Cancel) return false;
                        tabName = inputName.TabName;
                    }
                    this.TopMost = this._cfgCommon.AlwaysTop;
                    if (!string.IsNullOrEmpty(tabName))
                    {
                        if (!_statuses.AddTab(tabName, MyCommon.TabUsageType.UserDefined, null) || !AddNewTab(tabName, false, MyCommon.TabUsageType.UserDefined))
                        {
                            string tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
                            MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            //もう一度タブ名入力
                        }
                        else
                        {
                            return true;
                        }
                    }
                }
                else
                {
                    //既存タブを選択
                    return true;
                }
            }
            while (true);
        }