Beispiel #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();
            }
        }
Beispiel #2
0
        private bool TryGetTabInfo(ref string name, ref TabUsageType usageType, string title = "", string desc = "", bool showusage = false)
        {
            using (var form = new InputTabName { TabName = name })
            {
                form.SetFormTitle(title);
                form.SetFormDescription(desc);
                form.SetIsShowUsage(showusage);
                var result = form.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return false;
                }

                name = form.TabName;
                if (showusage)
                {
                    usageType = form.Usage;
                }
            }

            return true;
        }
Beispiel #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();
            }
        }