Inheritance: System.Windows.Forms.Form
示例#1
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);
            }
        }
示例#2
0
        public void OKButtonEnabledTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                Assert.That(dialog.OK_Button.Enabled, Is.False);

                dialog.TabList.SelectedIndex = 0;

                Assert.That(dialog.OK_Button.Enabled, Is.True);
            }
        }
示例#3
0
        public void OKButtonEnabledTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                Assert.That(dialog.OK_Button.Enabled, Is.False);

                dialog.TabList.SelectedIndex = 0;

                Assert.That(dialog.OK_Button.Enabled, Is.True);
            }
        }
示例#4
0
        public void SelectedTabTest()
        {
            using var dialog   = new TabsDialog(this.tabinfo);
            dialog.MultiSelect = false;

            dialog.TabList.SelectedIndex = 0;
            Assert.Null(dialog.SelectedTab);

            dialog.TabList.SelectedIndex = 1;
            Assert.Equal(this.tabinfo.Tabs["Reply"], dialog.SelectedTab);
        }
        public void SelectedTabTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = false;

                dialog.TabList.SelectedIndex = 0;
                Assert.That(dialog.SelectedTab, Is.Null);

                dialog.TabList.SelectedIndex = 1;
                Assert.That(dialog.SelectedTab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));
            }
        }
示例#6
0
        public void OKButtonEnabledTest()
        {
            using var dialog = new TabsDialog(this.tabinfo);
            Assert.False(dialog.OK_Button.Enabled);

            dialog.TabList.SelectedIndex = 0;

            Assert.True(dialog.OK_Button.Enabled);

            dialog.TabList.SelectedIndex = -1;

            Assert.False(dialog.OK_Button.Enabled);
        }
示例#7
0
        public void DoubleClickTest()
        {
            using var dialog             = new TabsDialog(this.tabinfo);
            dialog.TabList.SelectedIndex = -1;
            TestUtils.FireEvent(dialog.TabList, "DoubleClick");

            Assert.Equal(DialogResult.None, dialog.DialogResult);
            Assert.False(dialog.IsDisposed);

            dialog.TabList.SelectedIndex = 1;
            TestUtils.FireEvent(dialog.TabList, "DoubleClick");

            Assert.Equal(DialogResult.OK, dialog.DialogResult);
            Assert.True(dialog.IsDisposed);
        }
示例#8
0
        public void SelectableTabTest()
        {
            using var dialog   = new TabsDialog(this.tabinfo);
            dialog.MultiSelect = false;

            var item = (TabsDialog.TabListItem)dialog.TabList.Items[0];

            Assert.Null(item.Tab);

            item = (TabsDialog.TabListItem)dialog.TabList.Items[1];
            Assert.Equal(this.tabinfo.Tabs["Reply"], item.Tab);

            item = (TabsDialog.TabListItem)dialog.TabList.Items[2];
            Assert.Equal(this.tabinfo.Tabs["MyTab1"], item.Tab);
        }
        public void SelectableTabTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = false;

                var item = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.Null);

                item = dialog.TabList.Items[1] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));

                item = dialog.TabList.Items[2] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["MyTab1"]));
            }
        }
示例#10
0
        public void SelectableTabTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = false;

                var item = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.Null);

                item = dialog.TabList.Items[1] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));

                item = dialog.TabList.Items[2] as TabsDialog.TabListItem;
                Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["MyTab1"]));
            }
        }
示例#11
0
        public void DoubleClickTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.TabList.SelectedIndex = -1;
                TestUtils.FireEvent(dialog.TabList, "DoubleClick");

                Assert.That(dialog.DialogResult, Is.EqualTo(DialogResult.None));
                Assert.That(dialog.IsDisposed, Is.False);

                dialog.TabList.SelectedIndex = 1;
                TestUtils.FireEvent(dialog.TabList, "DoubleClick");

                Assert.That(dialog.DialogResult, Is.EqualTo(DialogResult.OK));
                Assert.That(dialog.IsDisposed, Is.True);
            }
        }
        public void DoubleClickTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.TabList.SelectedIndex = -1;
                TestUtils.FireEvent(dialog.TabList, "DoubleClick");

                Assert.That(dialog.DialogResult, Is.EqualTo(DialogResult.None));
                Assert.That(dialog.IsDisposed, Is.False);

                dialog.TabList.SelectedIndex = 1;
                TestUtils.FireEvent(dialog.TabList, "DoubleClick");

                Assert.That(dialog.DialogResult, Is.EqualTo(DialogResult.OK));
                Assert.That(dialog.IsDisposed, Is.True);
            }
        }
示例#13
0
        public void SelectedTabsTest()
        {
            using var dialog   = new TabsDialog(this.tabinfo);
            dialog.MultiSelect = true;

            dialog.TabList.SelectedIndices.Clear();
            var selectedTabs = dialog.SelectedTabs;

            Assert.Empty(selectedTabs);

            dialog.TabList.SelectedIndices.Add(0);
            selectedTabs = dialog.SelectedTabs;
            Assert.Equal(new[] { this.tabinfo.Tabs["Reply"] }, selectedTabs);

            dialog.TabList.SelectedIndices.Add(1);
            selectedTabs = dialog.SelectedTabs;
            Assert.Equal(new[] { this.tabinfo.Tabs["Reply"], this.tabinfo.Tabs["MyTab1"] }, selectedTabs);
        }
示例#14
0
        public void MultiSelectTest()
        {
            using var dialog = new TabsDialog(this.tabinfo);
            // MultiSelect = false (default)
            var firstItem = (TabsDialog.TabListItem)dialog.TabList.Items[0];

            Assert.Null(firstItem.Tab); // 「(新規タブ)」
            Assert.Equal(SelectionMode.One, dialog.TabList.SelectionMode);

            dialog.MultiSelect = true;
            firstItem          = (TabsDialog.TabListItem)dialog.TabList.Items[0];
            Assert.NotNull(firstItem.Tab);
            Assert.Equal(SelectionMode.MultiExtended, dialog.TabList.SelectionMode);

            dialog.MultiSelect = false;
            firstItem          = (TabsDialog.TabListItem)dialog.TabList.Items[0];
            Assert.Null(firstItem.Tab);
            Assert.Equal(SelectionMode.One, dialog.TabList.SelectionMode);
        }
        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);
            }
        }
        public void SelectedTabsTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = true;

                dialog.TabList.SelectedIndices.Clear();
                var selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.Empty);

                dialog.TabList.SelectedIndices.Add(0);
                selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"] }));

                dialog.TabList.SelectedIndices.Add(1);
                selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"], this.tabinfo.Tabs["MyTab1"] }));
            }
        }
        public void MultiSelectTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                // MultiSelect = false (default)
                var firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Null); // 「(新規タブ)」
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));

                dialog.MultiSelect = true;
                firstItem          = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Not.Null);
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.MultiExtended));

                dialog.MultiSelect = false;
                firstItem          = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Null);
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));
            }
        }
示例#18
0
        public void MultiSelectTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                // MultiSelect = false (default)
                var firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Null); // 「(新規タブ)」
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));

                dialog.MultiSelect = true;
                firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Not.Null);
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.MultiExtended));

                dialog.MultiSelect = false;
                firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
                Assert.That(firstItem.Tab, Is.Null);
                Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));
            }
        }
示例#19
0
        public void SelectedTabsTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = true;

                dialog.TabList.SelectedIndices.Clear();
                var selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.Empty);

                dialog.TabList.SelectedIndices.Add(0);
                selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"] }));

                dialog.TabList.SelectedIndices.Add(1);
                selectedTabs = dialog.SelectedTabs;
                Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"], this.tabinfo.Tabs["MyTab1"] }));
            }
        }
示例#20
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);
        }
示例#21
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);
            }
        }
示例#22
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);
            }
        }
示例#23
0
        public void SelectedTabTest()
        {
            using (var dialog = new TabsDialog(this.tabinfo))
            {
                dialog.MultiSelect = false;

                dialog.TabList.SelectedIndex = 0;
                Assert.That(dialog.SelectedTab, Is.Null);

                dialog.TabList.SelectedIndex = 1;
                Assert.That(dialog.SelectedTab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));
            }
        }