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 void ApiInfoMenuItem_Click(object sender, EventArgs e) { ApiInfo info = new ApiInfo(); StringBuilder tmp = new StringBuilder(); GetApiInfoArgs args = new GetApiInfoArgs() {tw = tw, info = info}; using (FormInfo dlg = new FormInfo(this, Properties.Resources.ApiInfo6, GetApiInfo_Dowork, null, args)) { dlg.ShowDialog(); if ((bool)dlg.Result) { tmp.AppendLine(Properties.Resources.ApiInfo1 + args.info.MaxCount.ToString()); tmp.AppendLine(Properties.Resources.ApiInfo2 + args.info.RemainCount.ToString()); tmp.AppendLine(Properties.Resources.ApiInfo3 + args.info.ResetTime.ToString()); tmp.AppendLine(Properties.Resources.ApiInfo7 + (tw.UserStreamEnabled ? Properties.Resources.Enable : Properties.Resources.Disable).ToString()); tmp.AppendLine(); tmp.AppendLine(Properties.Resources.ApiInfo8 + args.info.AccessLevel.ToString()); SetStatusLabelUrl(); tmp.AppendLine(); tmp.AppendLine(Properties.Resources.ApiInfo9 + (args.info.MediaMaxCount < 0 ? Properties.Resources.ApiInfo91 : args.info.MediaMaxCount.ToString())); tmp.AppendLine(Properties.Resources.ApiInfo10 + (args.info.MediaRemainCount < 0 ? Properties.Resources.ApiInfo91 : args.info.MediaRemainCount.ToString())); tmp.AppendLine(Properties.Resources.ApiInfo11 + (args.info.MediaResetTime == new DateTime() ? Properties.Resources.ApiInfo91 : args.info.MediaResetTime.ToString())); } else { tmp.Append(Properties.Resources.ApiInfo5); } } MessageBox.Show(tmp.ToString(), Properties.Resources.ApiInfo4, MessageBoxButtons.OK, MessageBoxIcon.Information); }
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 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 void ShowFriendship(string[] ids) { foreach (string id in ids) { string ret = ""; ShowFriendshipArgs args = new ShowFriendshipArgs(); args.tw = tw; args.ids.Add(new ShowFriendshipArgs.FriendshipInfo(id.Trim())); using (FormInfo _info = new FormInfo(this, Properties.Resources.ShowFriendshipText1, ShowFriendship_DoWork, null, args)) { _info.ShowDialog(); ret = (string)_info.Result; } string result = ""; ShowFriendshipArgs.FriendshipInfo fInfo = args.ids[0]; string ff = ""; if (string.IsNullOrEmpty(ret)) { ff = " "; if (fInfo.isFollowing) { ff += Properties.Resources.GetFriendshipInfo1; } else { ff += Properties.Resources.GetFriendshipInfo2; } ff += System.Environment.NewLine + " "; if (fInfo.isFollowed) { ff += Properties.Resources.GetFriendshipInfo3; } else { ff += Properties.Resources.GetFriendshipInfo4; } result += fInfo.id + Properties.Resources.GetFriendshipInfo5 + System.Environment.NewLine + ff; if (fInfo.isFollowing) { if (MessageBox.Show( Properties.Resources.GetFriendshipInfo7 + System.Environment.NewLine + result, Properties.Resources.GetFriendshipInfo8, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { RemoveCommand(fInfo.id, true); } } else { MessageBox.Show(result); } } else { MessageBox.Show(ret); } } }
private void doChangeIcon(string filename) { string res = ""; UpdateProfileImageArgs arg = new UpdateProfileImageArgs () { tw = MyOwner.TwitterInstance, FileName = filename }; using (FormInfo dlg = new FormInfo(this, Properties.Resources.ChangeIconToolStripMenuItem_ClickText3, UpdateProfileImage_Dowork, UpdateProfileImage_RunWorkerCompleted, arg)) { dlg.ShowDialog(); res = dlg.Result as string; if ( !string.IsNullOrEmpty( res ) ) { // "Err:"が付いたエラーメッセージが返ってくる MessageBox.Show( res + "\r\n" + Properties.Resources.ChangeIconToolStripMenuItem_ClickText4 ); } else { MessageBox.Show( Properties.Resources.ChangeIconToolStripMenuItem_ClickText5 ); } } }
private void RtCountMenuItem_Click(object sender, EventArgs e) { if (this.ExistCurrentPost) { using (FormInfo _info = new FormInfo(this, Properties.Resources.RtCountMenuItem_ClickText1, GetRetweet_DoWork)) { int retweet_count = 0; // ダイアログ表示 _info.ShowDialog(); retweet_count = (int)_info.Result; if (retweet_count < 0) { MessageBox.Show(Properties.Resources.RtCountText2); } else { MessageBox.Show(retweet_count.ToString() + Properties.Resources.RtCountText1); } } } }
private void ButtonEdit_Click(object sender, EventArgs e) { // 自分以外のプロフィールは変更できない if ( MyOwner.TwitterInstance.Username != _info.ScreenName ) return; if ( !IsEditing ) { ButtonEditText = ButtonEdit.Text; ButtonEdit.Text = Properties.Resources.UserInfoButtonEdit_ClickText1; //座標初期化,プロパティ設定 TextBoxName.Location = LabelName.Location; TextBoxName.Height = LabelName.Height; TextBoxName.Width = LabelName.Width; TextBoxName.BackColor = MyOwner.InputBackColor; TextBoxName.MaxLength = 20; TextBoxName.Text = LabelName.Text; TextBoxName.TabStop = true; TextBoxName.Visible = true; LabelName.Visible = false; TextBoxLocation.Location = LabelLocation.Location; TextBoxLocation.Height = LabelLocation.Height; TextBoxLocation.Width = LabelLocation.Width; TextBoxLocation.BackColor = MyOwner.InputBackColor; TextBoxLocation.MaxLength = 30; TextBoxLocation.Text = LabelLocation.Text; TextBoxLocation.TabStop = true; TextBoxLocation.Visible = true; LabelLocation.Visible = false; TextBoxWeb.Location = LinkLabelWeb.Location; TextBoxWeb.Height = LinkLabelWeb.Height; TextBoxWeb.Width = LinkLabelWeb.Width; TextBoxWeb.BackColor = MyOwner.InputBackColor; TextBoxWeb.MaxLength = 100; TextBoxWeb.Text = _info.Url; TextBoxWeb.TabStop = true; TextBoxWeb.Visible = true; LinkLabelWeb.Visible = false; TextBoxDescription.Location = DescriptionBrowser.Location; TextBoxDescription.Height = DescriptionBrowser.Height; TextBoxDescription.Width = DescriptionBrowser.Width; TextBoxDescription.BackColor = MyOwner.InputBackColor; TextBoxDescription.MaxLength = 160; TextBoxDescription.Text = _info.Description; TextBoxDescription.Multiline = true; TextBoxDescription.ScrollBars = ScrollBars.Vertical; TextBoxDescription.TabStop = true; TextBoxDescription.Visible = true; DescriptionBrowser.Visible = false; TextBoxName.Focus(); TextBoxName.Select( TextBoxName.Text.Length, 0 ); IsEditing = true; } else { UpdateProfileArgs arg = new UpdateProfileArgs (); if ( TextBoxName.Modified || TextBoxLocation.Modified || TextBoxWeb.Modified || TextBoxDescription.Modified ) { arg.tw = MyOwner.TwitterInstance; arg.name = TextBoxName.Text.Trim(); arg.url = TextBoxWeb.Text.Trim(); arg.location = TextBoxLocation.Text.Trim(); arg.description = TextBoxDescription.Text.Trim(); using (FormInfo dlg = new FormInfo(this, Properties.Resources.UserInfoButtonEdit_ClickText2, UpdateProfile_Dowork, UpddateProfile_RunWorkerCompleted, arg)) { dlg.ShowDialog(); if ( !string.IsNullOrEmpty( dlg.Result.ToString() ) ) { return; } } } LabelName.Text = TextBoxName.Text; _info.Name = LabelName.Text; TextBoxName.TabStop = false; TextBoxName.Visible = false; LabelName.Visible = true; LabelLocation.Text = TextBoxLocation.Text; _info.Location = LabelLocation.Text; TextBoxLocation.TabStop = false; TextBoxLocation.Visible = false; LabelLocation.Visible = true; SetLinklabelWeb( TextBoxWeb.Text ); _info.Url = TextBoxWeb.Text; TextBoxWeb.TabStop = false; TextBoxWeb.Visible = false; LinkLabelWeb.Visible = true; DescriptionBrowser.DocumentText = MakeDescriptionBrowserText( TextBoxDescription.Text ); _info.Description = TextBoxDescription.Text; TextBoxDescription.TabStop = false; TextBoxDescription.Visible = false; DescriptionBrowser.Visible = true; ButtonEdit.Text = ButtonEditText; IsEditing = false; } }
private void ApiUsageInfoMenuItem_Click(object sender, EventArgs e) { StringBuilder tmp = new StringBuilder(); using (FormInfo dlg = new FormInfo(this, Properties.Resources.ApiInfo6, GetApiInfo_Dowork)) { dlg.ShowDialog(); var result = (TwitterApiStatus)dlg.Result; if (result == null) { var accessLevel = result.AccessLevel; var timelineLimit = result.AccessLimit["/statuses/home_timeline"]; var mediaLimit = result.MediaUploadLimit; tmp.AppendLine(Properties.Resources.ApiInfo1 + timelineLimit.AccessLimitCount); tmp.AppendLine(Properties.Resources.ApiInfo2 + timelineLimit.AccessLimitRemain); tmp.AppendLine(Properties.Resources.ApiInfo3 + timelineLimit.AccessLimitResetDate); tmp.AppendLine(Properties.Resources.ApiInfo7 + (tw.UserStreamEnabled ? Properties.Resources.Enable : Properties.Resources.Disable)); tmp.AppendLine(); tmp.AppendLine(Properties.Resources.ApiInfo8 + accessLevel); SetStatusLabelUrl(); tmp.AppendLine(); tmp.AppendLine(Properties.Resources.ApiInfo9 + (mediaLimit == null ? Properties.Resources.ApiInfo91 : mediaLimit.AccessLimitCount.ToString())); tmp.AppendLine(Properties.Resources.ApiInfo10 + (mediaLimit == null ? Properties.Resources.ApiInfo91 : mediaLimit.AccessLimitRemain.ToString())); tmp.AppendLine(Properties.Resources.ApiInfo11 + (mediaLimit == null ? Properties.Resources.ApiInfo91 : mediaLimit.AccessLimitResetDate.ToString())); } else { tmp.Append(Properties.Resources.ApiInfo5); } } MessageBox.Show(tmp.ToString(), Properties.Resources.ApiInfo4, MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void RefreshLists() { using (FormInfo dlg = new FormInfo(this, Properties.Resources.ListsGetting, RefreshLists_Dowork)) { dlg.ShowDialog(); if (!String.IsNullOrEmpty((string)dlg.Result)) { MessageBox.Show(String.Format(Properties.Resources.ListsDeleteFailed, (string)dlg.Result)); return; } } }
private void RefreshLists() { using (FormInfo dlg = new FormInfo(this, "Getting Lists...", RefreshLists_DoWork)) { dlg.ShowDialog(); if (!String.IsNullOrEmpty(dlg.Result as String)) { MessageBox.Show("Failed to get lists. (" + (String)dlg.Result + ")"); return; } } }
private void ButtonEdit_Click(object sender, EventArgs e) { // 自分以外のプロフィールは変更できない if (MyOwner.TwitterInstance.Username != _info.ScreenName) { return; } if (!IsEditing) { ButtonEditText = ButtonEdit.Text; ButtonEdit.Text = Properties.Resources.UserInfoButtonEdit_ClickText1; //座標初期化,プロパティ設定 TextBoxName.Location = LabelName.Location; TextBoxName.Height = LabelName.Height; TextBoxName.Width = LabelName.Width; TextBoxName.BackColor = MyOwner.InputBackColor; TextBoxName.MaxLength = 20; TextBoxName.Text = LabelName.Text; TextBoxName.TabStop = true; TextBoxName.Visible = true; LabelName.Visible = false; TextBoxLocation.Location = LabelLocation.Location; TextBoxLocation.Height = LabelLocation.Height; TextBoxLocation.Width = LabelLocation.Width; TextBoxLocation.BackColor = MyOwner.InputBackColor; TextBoxLocation.MaxLength = 30; TextBoxLocation.Text = LabelLocation.Text; TextBoxLocation.TabStop = true; TextBoxLocation.Visible = true; LabelLocation.Visible = false; TextBoxWeb.Location = LinkLabelWeb.Location; TextBoxWeb.Height = LinkLabelWeb.Height; TextBoxWeb.Width = LinkLabelWeb.Width; TextBoxWeb.BackColor = MyOwner.InputBackColor; TextBoxWeb.MaxLength = 100; TextBoxWeb.Text = _info.Url; TextBoxWeb.TabStop = true; TextBoxWeb.Visible = true; LinkLabelWeb.Visible = false; TextBoxDescription.Location = DescriptionBrowser.Location; TextBoxDescription.Height = DescriptionBrowser.Height; TextBoxDescription.Width = DescriptionBrowser.Width; TextBoxDescription.BackColor = MyOwner.InputBackColor; TextBoxDescription.MaxLength = 160; TextBoxDescription.Text = _info.Description; TextBoxDescription.Multiline = true; TextBoxDescription.ScrollBars = ScrollBars.Vertical; TextBoxDescription.TabStop = true; TextBoxDescription.Visible = true; DescriptionBrowser.Visible = false; TextBoxName.Focus(); TextBoxName.Select(TextBoxName.Text.Length, 0); IsEditing = true; } else { UpdateProfileArgs arg = new UpdateProfileArgs(); if (TextBoxName.Modified || TextBoxLocation.Modified || TextBoxWeb.Modified || TextBoxDescription.Modified) { arg.tw = MyOwner.TwitterInstance; arg.name = TextBoxName.Text.Trim(); arg.url = TextBoxWeb.Text.Trim(); arg.location = TextBoxLocation.Text.Trim(); arg.description = TextBoxDescription.Text.Trim(); using (FormInfo dlg = new FormInfo(this, Properties.Resources.UserInfoButtonEdit_ClickText2, UpdateProfile_Dowork, UpddateProfile_RunWorkerCompleted, arg)) { dlg.ShowDialog(); if (!string.IsNullOrEmpty(dlg.Result.ToString())) { return; } } } LabelName.Text = TextBoxName.Text; _info.Name = LabelName.Text; TextBoxName.TabStop = false; TextBoxName.Visible = false; LabelName.Visible = true; LabelLocation.Text = TextBoxLocation.Text; _info.Location = LabelLocation.Text; TextBoxLocation.TabStop = false; TextBoxLocation.Visible = false; LabelLocation.Visible = true; SetLinklabelWeb(TextBoxWeb.Text); _info.Url = TextBoxWeb.Text; TextBoxWeb.TabStop = false; TextBoxWeb.Visible = false; LinkLabelWeb.Visible = true; DescriptionBrowser.DocumentText = MakeDescriptionBrowserText(TextBoxDescription.Text); _info.Description = TextBoxDescription.Text; TextBoxDescription.TabStop = false; TextBoxDescription.Visible = false; DescriptionBrowser.Visible = true; ButtonEdit.Text = ButtonEditText; IsEditing = false; } }