private void ButtonAddTab_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabType; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _sts.GetUniqueTabName(); inputName.IsShowUsage = 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 == MyCommon.TabUsageType.Lists) { string rslt = ((TweenMain)this.Owner).TwitterInstance.GetListsApi(); if (!string.IsNullOrEmpty(rslt)) { MessageBox.Show("Failed to get lists. (" + rslt + ")"); } using (ListAvailable 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)this.Owner).AddNewTab(tabName, false, tabType, list)) { string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { //成功 ListTabs.Items.Add(tabName); SetTabnamesToDialog(); } } }
private bool SelectTab(ref string tabName) { do { //振り分け先タブ選択 if (TabDialog.ShowDialog() == DialogResult.Cancel) { this.TopMost = SettingDialog.AlwaysTop; return false; } this.TopMost = SettingDialog.AlwaysTop; tabName = TabDialog.SelectedTabName; ListTab.SelectedTab.Focus(); //新規タブを選択→タブ作成 if (tabName == Properties.Resources.IDRuleMenuItem_ClickText1) { using (InputTabName inputName = new InputTabName()) { inputName.TabName = _statuses.GetUniqueTabName(); inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return false; tabName = inputName.TabName; } this.TopMost = SettingDialog.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); }
public bool TabRename(ref string tabName) { //タブ名変更 string newTabText = null; using (InputTabName inputName = new InputTabName()) { inputName.TabName = tabName; inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return false; newTabText = inputName.TabName; } this.TopMost = SettingDialog.AlwaysTop; if (!string.IsNullOrEmpty(newTabText)) { //新タブ名存在チェック for (int i = 0; i < ListTab.TabCount; i++) { if (ListTab.TabPages[i].Text == newTabText) { string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabText); MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } } //タブ名のリスト作り直し(デフォルトタブ以外は再作成) for (int i = 0; i < ListTab.TabCount; i++) { if (_statuses.IsDistributableTab(ListTab.TabPages[i].Text)) { TabDialog.RemoveTab(ListTab.TabPages[i].Text); } if (ListTab.TabPages[i].Text == tabName) { ListTab.TabPages[i].Text = newTabText; } } _statuses.RenameTab(tabName, newTabText); for (int i = 0; i < ListTab.TabCount; i++) { if (_statuses.IsDistributableTab(ListTab.TabPages[i].Text)) { if (ListTab.TabPages[i].Text == tabName) { ListTab.TabPages[i].Text = newTabText; } TabDialog.AddTab(ListTab.TabPages[i].Text); } } SaveConfigsCommon(); SaveConfigsTabs(); _rclickTabName = newTabText; tabName = newTabText; return true; } else { return false; } }
private void ButtonAddTab_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabType; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _sts.GetUniqueTabName(); inputName.IsShowUsage = 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 == MyCommon.TabUsageType.Lists) { string rslt = ((TweenMain)this.Owner).TwitterInstance.GetListsApi(); if (!string.IsNullOrEmpty(rslt)) { MessageBox.Show("Failed to get lists. (" + rslt + ")"); } using (ListAvailable 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)this.Owner).AddNewTab(tabName, false, tabType, list)) { string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { //成功 ListTabs.Items.Add(tabName); SetTabnamesToDialog(); } } }
internal async Task RemoveCommand(string id, bool skipInput) { if (!skipInput) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Unfollow"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } } using (var dialog = new WaitingDialog(Properties.Resources.RemoveCommandText1)) { try { var task = this.twitterApi.FriendshipsDestroy(id); await dialog.WaitForAsync(this, task); } catch (WebApiException ex) { MessageBox.Show(Properties.Resources.FRMessage2 + ex.Message); return; } } MessageBox.Show(Properties.Resources.FRMessage3); }
private void AddTabMenuItem_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabUsage; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _statuses.GetUniqueTabName(); inputName.IsShowUsage = true; inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return; tabName = inputName.TabName; tabUsage = inputName.Usage; } this.TopMost = SettingDialog.AlwaysTop; if (!string.IsNullOrEmpty(tabName)) { //List対応 ListElement list = null; if (tabUsage == MyCommon.TabUsageType.Lists) { using (ListAvailable 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(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { //成功 SaveConfigsTabs(); if (tabUsage == MyCommon.TabUsageType.PublicSearch) { ListTab.SelectedIndex = ListTab.TabPages.Count - 1; ListTabSelect(ListTab.TabPages[ListTab.TabPages.Count - 1]); ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus(); } if (tabUsage == MyCommon.TabUsageType.Lists) { ListTab.SelectedIndex = ListTab.TabPages.Count - 1; ListTabSelect(ListTab.TabPages[ListTab.TabPages.Count - 1]); GetTimeline(MyCommon.WORKERTYPE.List, 1, 0, tabName); } } } }
private string GetUserIdFromCurPostOrInput(string caption) { string id = ""; if (_curPost != null) { id = _curPost.ScreenName; } using (InputTabName inputName = new InputTabName()) { inputName.FormTitle = caption; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(inputName.TabName.Trim())) { id = inputName.TabName.Trim(); } else { id = ""; } } return id; }
private async Task RemoveCommand(string id, bool skipInput) { if (!skipInput) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Unfollow"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } } using (var dialog = new WaitingDialog(Properties.Resources.RemoveCommandText1)) { var task = Task.Run(() => this.tw.PostRemoveCommand(id)); var err = await dialog.WaitForAsync(this, task); if (!string.IsNullOrEmpty(err)) { MessageBox.Show(Properties.Resources.FRMessage2 + err); return; } } MessageBox.Show(Properties.Resources.FRMessage3); }
private async Task ShowFriendship(string id) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Show Friendships"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } var isFollowing = false; var isFollowed = false; using (var dialog = new WaitingDialog(Properties.Resources.ShowFriendshipText1)) { var cancellationToken = dialog.EnableCancellation(); var task = Task.Run(() => this.tw.GetFriendshipInfo(id, ref isFollowing, ref isFollowed)); var err = await dialog.WaitForAsync(this, task); if (cancellationToken.IsCancellationRequested) return; if (!string.IsNullOrEmpty(err)) { MessageBox.Show(err); return; } } string result = ""; if (isFollowing) { result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine; } else { result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine; } if (isFollowed) { result += Properties.Resources.GetFriendshipInfo3; } else { result += Properties.Resources.GetFriendshipInfo4; } result = id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result; MessageBox.Show(result); }
private void AddTabMenuItem_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabUsage; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _statuses.MakeTabName("MyTab"); inputName.IsShowUsage = true; inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return; tabName = inputName.TabName; tabUsage = inputName.Usage; } this.TopMost = this._cfgCommon.AlwaysTop; if (!string.IsNullOrEmpty(tabName)) { //List対応 ListElement list = null; if (tabUsage == MyCommon.TabUsageType.Lists) { using (ListAvailable listAvail = new ListAvailable()) { if (listAvail.ShowDialog(this) == DialogResult.Cancel) return; if (listAvail.SelectedList == null) return; list = listAvail.SelectedList; } } TabModel tab; switch (tabUsage) { case MyCommon.TabUsageType.UserDefined: tab = new FilterTabModel(tabName); break; case MyCommon.TabUsageType.PublicSearch: tab = new PublicSearchTabModel(tabName); break; case MyCommon.TabUsageType.Lists: tab = new ListTimelineTabModel(tabName, list); break; default: return; } if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false)) { string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { //成功 SaveConfigsTabs(); if (tabUsage == MyCommon.TabUsageType.PublicSearch) { ListTab.SelectedIndex = ListTab.TabPages.Count - 1; ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus(); } if (tabUsage == MyCommon.TabUsageType.Lists) { ListTab.SelectedIndex = ListTab.TabPages.Count - 1; var listTab = (ListTimelineTabModel)this._statuses.Tabs[this._curTab.Text]; this.GetListTimelineAsync(listTab); } } } }
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.MakeTabName("MyTab"); inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return false; tabName = inputName.TabName; } this.TopMost = this._cfgCommon.AlwaysTop; if (!string.IsNullOrEmpty(tabName)) { var tab = new FilterTabModel(tabName); if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false)) { 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); }
public bool TabRename(string origTabName, out string newTabName) { //タブ名変更 newTabName = null; using (InputTabName inputName = new InputTabName()) { inputName.TabName = origTabName; inputName.ShowDialog(); if (inputName.DialogResult == DialogResult.Cancel) return false; newTabName = inputName.TabName; } this.TopMost = this._cfgCommon.AlwaysTop; if (!string.IsNullOrEmpty(newTabName)) { //新タブ名存在チェック for (int i = 0; i < ListTab.TabCount; i++) { if (ListTab.TabPages[i].Text == newTabName) { string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabName); MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } } var tabPage = this.ListTab.TabPages.Cast<TabPage>() .FirstOrDefault(x => x.Text == origTabName); // タブ名を変更 if (tabPage != null) tabPage.Text = newTabName; _statuses.RenameTab(origTabName, newTabName); SaveConfigsCommon(); SaveConfigsTabs(); _rclickTabName = newTabName; return true; } else { return false; } }
private async Task doShowUserStatus(string id, bool ShowInputDialog) { TwitterUser user = null; if (ShowInputDialog) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Show UserStatus"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } } using (var dialog = new WaitingDialog(Properties.Resources.doShowUserStatusText1)) { var cancellationToken = dialog.EnableCancellation(); try { var task = this.twitterApi.UsersShow(id); user = await dialog.WaitForAsync(this, task); } catch (WebApiException ex) { if (!cancellationToken.IsCancellationRequested) MessageBox.Show($"Err:{ex.Message}(UsersShow)"); return; } if (cancellationToken.IsCancellationRequested) return; } await this.doShowUserStatus(user); }
internal async Task ShowFriendship(string id) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Show Friendships"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } bool isFollowing, isFollowed; using (var dialog = new WaitingDialog(Properties.Resources.ShowFriendshipText1)) { var cancellationToken = dialog.EnableCancellation(); try { var task = this.twitterApi.FriendshipsShow(this.twitterApi.CurrentScreenName, id); var friendship = await dialog.WaitForAsync(this, task); isFollowing = friendship.Relationship.Source.Following; isFollowed = friendship.Relationship.Source.FollowedBy; } catch (WebApiException ex) { if (!cancellationToken.IsCancellationRequested) MessageBox.Show($"Err:{ex.Message}(FriendshipsShow)"); return; } if (cancellationToken.IsCancellationRequested) return; } string result = ""; if (isFollowing) { result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine; } else { result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine; } if (isFollowed) { result += Properties.Resources.GetFriendshipInfo3; } else { result += Properties.Resources.GetFriendshipInfo4; } result = id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result; MessageBox.Show(result); }
private void ShowFriendship(string id) { ShowFriendshipArgs args = new ShowFriendshipArgs(); args.tw = tw; using (InputTabName inputName = new InputTabName()) { inputName.FormTitle = "Show Friendships"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(inputName.TabName.Trim())) { string ret = ""; args.ids.Add(new ShowFriendshipArgs.FriendshipInfo(inputName.TabName.Trim())); using (FormInfo _info = new FormInfo(this, Properties.Resources.ShowFriendshipText1, ShowFriendship_DoWork, null, args)) { _info.ShowDialog(); ret = (string)_info.Result; } string result = ""; if (string.IsNullOrEmpty(ret)) { if (args.ids[0].isFollowing) { result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine; } else { result = Properties.Resources.GetFriendshipInfo2 + System.Environment.NewLine; } if (args.ids[0].isFollowed) { result += Properties.Resources.GetFriendshipInfo3; } else { result += Properties.Resources.GetFriendshipInfo4; } result = args.ids[0].id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result; } else { result = ret; } MessageBox.Show(result); } } }
private async Task doShowUserStatus(string id, bool ShowInputDialog) { TwitterUser user = null; if (ShowInputDialog) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Show UserStatus"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } } using (var dialog = new WaitingDialog(Properties.Resources.doShowUserStatusText1)) { var cancellationToken = dialog.EnableCancellation(); var task = Task.Run(() => this.tw.GetUserInfo(id, ref user)); var err = await dialog.WaitForAsync(this, task); if (cancellationToken.IsCancellationRequested) return; if (!string.IsNullOrEmpty(err)) { MessageBox.Show(err); return; } } await this.doShowUserStatus(user); }
private void TrackToolStripMenuItem_Click(object sender, EventArgs e) { if (TrackToolStripMenuItem.Checked) { using (InputTabName inputForm = new InputTabName()) { inputForm.TabName = inputTrack; inputForm.FormTitle = "Input track word"; inputForm.FormDescription = "Track word"; if (inputForm.ShowDialog() != DialogResult.OK) { TrackToolStripMenuItem.Checked = false; return; } inputTrack = inputForm.TabName.Trim(); } if (!inputTrack.Equals(tw.TrackWord)) { tw.TrackWord = inputTrack; this._modifySettingCommon = true; TrackToolStripMenuItem.Checked = !string.IsNullOrEmpty(inputTrack); tw.ReconnectUserStream(); } } else { tw.TrackWord = ""; tw.ReconnectUserStream(); } this._modifySettingCommon = true; }
private async void ButtonAddTab_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabType; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _sts.MakeTabName("MyTab"); inputName.IsShowUsage = 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 == MyCommon.TabUsageType.Lists) { try { using (var dialog = new WaitingDialog(Properties.Resources.ListsGetting)) { var cancellationToken = dialog.EnableCancellation(); var task = ((TweenMain)this.Owner).TwitterInstance.GetListsApi(); await dialog.WaitForAsync(this, task); cancellationToken.ThrowIfCancellationRequested(); } } catch (OperationCanceledException) { return; } catch (WebApiException ex) { MessageBox.Show("Failed to get lists. (" + ex.Message + ")"); } using (ListAvailable listAvail = new ListAvailable()) { if (listAvail.ShowDialog(this) == DialogResult.Cancel) return; if (listAvail.SelectedList == null) return; list = listAvail.SelectedList; } } TabModel tab; switch (tabType) { case MyCommon.TabUsageType.UserDefined: tab = new FilterTabModel(tabName); break; case MyCommon.TabUsageType.PublicSearch: tab = new PublicSearchTabModel(tabName); break; case MyCommon.TabUsageType.Lists: tab = new ListTimelineTabModel(tabName, list); break; default: return; } if (!_sts.AddTab(tab) || !((TweenMain)this.Owner).AddNewTab(tab, startup: false)) { string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { // タブ作成成功 // 末尾のタブを取得する var lastIdx = this.ListTabs.Items.Count - 1; var lastTab = lastIdx != -1 ? this._sts.Tabs[(string)this.ListTabs.Items[lastIdx]] : null; // 末尾がミュートタブであればその手前に追加する if (lastTab != null && lastTab.TabType == MyCommon.TabUsageType.Mute) this.ListTabs.Items.Insert(lastIdx, tabName); else this.ListTabs.Items.Add(tabName); } } }
private void doShowUserStatus(string id, bool ShowInputDialog) { TwitterDataModel.User user = null; GetUserInfoArgs args = new GetUserInfoArgs(); if (ShowInputDialog) { using (InputTabName inputName = new InputTabName()) { inputName.FormTitle = "Show UserStatus"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(inputName.TabName.Trim())) { id = inputName.TabName.Trim(); args.tw = tw; args.id = id; args.user = user; using (FormInfo _info = new FormInfo(this, Properties.Resources.doShowUserStatusText1, GetUserInfo_DoWork, null, args)) { _info.ShowDialog(); string ret = (string)_info.Result; if (string.IsNullOrEmpty(ret)) doShowUserStatus(args.user); else MessageBox.Show(ret); } } } } else { args.tw = tw; args.id = id; args.user = user; using (FormInfo _info = new FormInfo(this, Properties.Resources.doShowUserStatusText1, GetUserInfo_DoWork, null, args)) { _info.ShowDialog(); string ret = (string)_info.Result; if (string.IsNullOrEmpty(ret)) { doShowUserStatus(args.user); } else { MessageBox.Show(ret); } } } }
private void ButtonAddTab_Click(object sender, EventArgs e) { string tabName = null; MyCommon.TabUsageType tabType; using (InputTabName inputName = new InputTabName()) { inputName.TabName = _sts.MakeTabName("MyTab"); inputName.IsShowUsage = 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 == MyCommon.TabUsageType.Lists) { try { ((TweenMain)this.Owner).TwitterInstance.GetListsApi(); } catch (WebApiException ex) { MessageBox.Show("Failed to get lists. (" + ex.Message + ")"); } using (ListAvailable 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)this.Owner).AddNewTab(tabName, false, tabType, list)) { string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName); MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { // タブ作成成功 // 末尾のタブを取得する var lastIdx = this.ListTabs.Items.Count - 1; var lastTab = lastIdx != -1 ? this._sts.Tabs[(string)this.ListTabs.Items[lastIdx]] : null; // 末尾がミュートタブであればその手前に追加する if (lastTab != null && lastTab.TabType == MyCommon.TabUsageType.Mute) this.ListTabs.Items.Insert(lastIdx, tabName); else this.ListTabs.Items.Add(tabName); } } }
private void RemoveCommand(string id, bool skipInput) { FollowRemoveCommandArgs arg = new FollowRemoveCommandArgs(); arg.tw = tw; arg.id = id; if (!skipInput) { using (InputTabName inputName = new InputTabName()) { inputName.FormTitle = "Unfollow"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(inputName.TabName.Trim())) { arg.tw = tw; arg.id = inputName.TabName.Trim(); } else { return; } } } using (FormInfo _info = new FormInfo(this, Properties.Resources.RemoveCommandText1, RemoveCommand_DoWork, null, arg)) { _info.ShowDialog(); string ret = (string)_info.Result; if (!string.IsNullOrEmpty(ret)) MessageBox.Show(Properties.Resources.FRMessage2 + ret); else MessageBox.Show(Properties.Resources.FRMessage3); } }
private async Task FollowCommand(string id) { using (var inputName = new InputTabName()) { inputName.FormTitle = "Follow"; inputName.FormDescription = Properties.Resources.FRMessage1; inputName.TabName = id; if (inputName.ShowDialog(this) != DialogResult.OK) return; if (string.IsNullOrWhiteSpace(inputName.TabName)) return; id = inputName.TabName.Trim(); } using (var dialog = new WaitingDialog(Properties.Resources.FollowCommandText1)) { try { var task = Task.Run(() => this.tw.PostFollowCommand(id)); await dialog.WaitForAsync(this, task); } catch (WebApiException ex) { MessageBox.Show(Properties.Resources.FRMessage2 + ex.Message); return; } } MessageBox.Show(Properties.Resources.FRMessage3); }