Exemplo n.º 1
0
        private void ButtonAddTab_ClickExtracted()
        {
            string       tabName;
            TabUsageType tabType;

            using (var inputName = new InputTabName())
            {
                inputName.TabName = _sts.GetUniqueTabName();
                inputName.SetIsShowUsage(true);
                inputName.ShowDialog();
                if (inputName.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                tabName = inputName.TabName;
                tabType = inputName.Usage;
            }

            if (!string.IsNullOrEmpty(tabName))
            {
                // List対応
                ListElement list = null;
                if (tabType == TabUsageType.Lists)
                {
                    string rslt = ((TweenMain)Owner).TwitterInstance.GetListsApi();
                    if (!string.IsNullOrEmpty(rslt))
                    {
                        MessageBox.Show("Failed to get lists. (" + rslt + ")");
                    }

                    using (var listAvail = new ListAvailable())
                    {
                        if (listAvail.ShowDialog(this) == DialogResult.Cancel)
                        {
                            return;
                        }

                        if (listAvail.SelectedList == null)
                        {
                            return;
                        }

                        list = listAvail.SelectedList;
                    }
                }

                if (!_sts.AddTab(tabName, tabType, list) || !((TweenMain)Owner).AddNewTab(tabName, false, tabType, list))
                {
                    string tmp = string.Format(R.AddTabMenuItem_ClickText1, tabName);
                    MessageBox.Show(tmp, R.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                // 成功
                ListTabs.Items.Add(tabName);
                SetTabnamesToDialog();
            }
        }
Exemplo n.º 2
0
        private void AddNewTab()
        {
            string tabName = _statuses.GetUniqueTabName();
            TabUsageType tabUsage = default(TabUsageType);
            if (!TryGetTabInfo(ref tabName, ref tabUsage, showusage: true))
            {
                return;
            }

            TopMost = _configs.AlwaysTop;
            if (string.IsNullOrEmpty(tabName))
            {
                return;
            }

            // List対応
            ListElement list = null;
            if (tabUsage == TabUsageType.Lists)
            {
                using (var listAvail = new ListAvailable())
                {
                    if (listAvail.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }

                    if (listAvail.SelectedList == null)
                    {
                        return;
                    }

                    list = listAvail.SelectedList;
                }
            }

            if (!_statuses.AddTab(tabName, tabUsage, list) || !AddNewTab(tabName, false, tabUsage, list))
            {
                string tmp = string.Format(R.AddTabMenuItem_ClickText1, tabName);
                MessageBox.Show(tmp, R.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // 成功
            SaveConfigsTabs();
            if (tabUsage == TabUsageType.PublicSearch)
            {
                ListTabSelect(ListTab.TabPages.Count - 1);
                ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus();
            }

            if (tabUsage == TabUsageType.Lists)
            {
                ListTabSelect(ListTab.TabPages.Count - 1);
                GetTimeline(WorkerType.List, 1, 0, tabName);
            }
        }
Exemplo n.º 3
0
        private void ButtonAddTab_ClickExtracted()
        {
            string tabName;
            TabUsageType tabType;
            using (var inputName = new InputTabName())
            {
                inputName.TabName = _sts.GetUniqueTabName();
                inputName.SetIsShowUsage(true);
                inputName.ShowDialog();
                if (inputName.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                tabName = inputName.TabName;
                tabType = inputName.Usage;
            }

            if (!string.IsNullOrEmpty(tabName))
            {
                // List対応
                ListElement list = null;
                if (tabType == TabUsageType.Lists)
                {
                    string rslt = ((TweenMain)Owner).TwitterInstance.GetListsApi();
                    if (!string.IsNullOrEmpty(rslt))
                    {
                        MessageBox.Show("Failed to get lists. (" + rslt + ")");
                    }

                    using (var listAvail = new ListAvailable())
                    {
                        if (listAvail.ShowDialog(this) == DialogResult.Cancel)
                        {
                            return;
                        }

                        if (listAvail.SelectedList == null)
                        {
                            return;
                        }

                        list = listAvail.SelectedList;
                    }
                }

                if (!_sts.AddTab(tabName, tabType, list) || !((TweenMain)Owner).AddNewTab(tabName, false, tabType, list))
                {
                    string tmp = string.Format(R.AddTabMenuItem_ClickText1, tabName);
                    MessageBox.Show(tmp, R.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                // 成功
                ListTabs.Items.Add(tabName);
                SetTabnamesToDialog();
            }
        }