public void MuteUser() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をミュートしますか?", Content = "このユーザーのツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) { return; } System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.User.ScreenName); Setting.Muteds.AddPredicate(new FilterOperatorEquals { LeftValue = new UserId(), RightValue = new NumericValue(this.Status.User.Id) }.Or(new FilterOperatorEquals { LeftValue = new RetweeterId(), RightValue = new NumericValue(this.Status.User.Id) })); }
public void FavoriteSelecteds() { var accounts = CurrentAccounts .Select(Setting.Accounts.Get) .Where(a => a != null) .ToArray(); if (accounts.Length == 0) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgQuickActionFailedTitle, MainIcon = VistaTaskDialogIcon.Error, MainInstruction = MainAreaTimelineResources.MsgFavoriteFailedInst, Content = MainAreaTimelineResources.MsgQuickActionAccountIsNotSelected, CommonButtons = TaskDialogCommonButtons.Close, }); this.Messenger.Raise(msg); return; } SelectedStatuses .Where(s => s.CanFavorite && !s.IsFavorited) .ForEach(s => s.Favorite(accounts, true)); DeselectAll(); }
public void FavoriteSelecteds() { var accounts = CurrentAccounts .Select(Setting.Accounts.Get) .Where(a => a != null) .ToArray(); if (accounts.Length == 0) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "クイックアクション エラー", MainIcon = VistaTaskDialogIcon.Error, MainInstruction = "ツイートをお気に入り登録できません。", Content = "アカウントが選択されていません。", CommonButtons = TaskDialogCommonButtons.Close, }); this.Messenger.Raise(msg); return; } SelectedStatuses .Where(s => s.CanFavorite && !s.IsFavorited) .ForEach(s => s.Favorite(accounts, true)); DeselectAll(); }
public void MuteClient() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "クライアントのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "クライアント " + this.SourceText + " をミュートしますか?", Content = "このクライアントからのツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) { return; } System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.Source); Setting.Muteds.AddPredicate(new FilterOperatorContains { LeftValue = new StatusSource(), RightValue = new StringValue(this.SourceText) }); }
public void ConfirmDelete() { var footer = "直近一件のツイートの訂正は投稿欄から行えます。"; var amendkey = KeyAssignManager.CurrentProfile .FindAssignFromActionName("Amend", KeyAssignGroup.Input) .FirstOrDefault(); if (amendkey != null) { footer = "直近一件のツイートの訂正は、投稿欄で" + amendkey.GetKeyDescribeString() + "キーを押すと行えます。"; } var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ツイートの削除", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ツイートを削除しますか?", Content = "削除したツイートはもとに戻せません。", CustomButtons = new[] { "削除", "キャンセル" }, AllowDialogCancellation = true, FooterIcon = VistaTaskDialogIcon.Information, FooterText = footer, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult == 0) { this.Delete(); } }
private void NotifyQuickActionFailed(string main, string body) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "クイックアクション エラー", MainIcon = VistaTaskDialogIcon.Error, MainInstruction = main, Content = body, CommonButtons = TaskDialogCommonButtons.Close, }); this.Parent.Messenger.Raise(msg); }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーをスパムとして報告", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をスパム報告しますか?", Content = "全てのアカウントからブロックし、代表のアカウントからスパム報告します。", CustomButtons = new[] { "スパム報告", "キャンセル" }, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) { return; } // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) { return; } var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var tid = this.Status.User.Id; var tidstr = tid.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses( s => s.User.Id == tid || (s.RetweetedOriginal != null && s.RetweetedOriginal.User.Id == tid), "UserId = " + tidstr + " OR BaseUserId = " + tidstr) .Subscribe(s => StatusInbox.EnqueueRemoval(s.Id)); }); }
private void SetClipboard(string value) { try { Clipboard.SetText(value); } catch (Exception ex) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "クリップボード エラー", MainIcon = VistaTaskDialogIcon.Error, MainInstruction = "コピーを行えませんでした。", Content = ex.Message, CommonButtons = TaskDialogCommonButtons.Close, }); this.Parent.Messenger.Raise(msg); } }
public void MuteKeyword() { if (String.IsNullOrWhiteSpace(this.SelectedText)) { this.Parent.Messenger.Raise(new TaskDialogMessage(new TaskDialogOptions { Title = "キーワードのミュート", MainIcon = VistaTaskDialogIcon.Information, MainInstruction = "キーワードを選択してください。", Content = "ミュートしたいキーワードをドラッグで選択できます。", CommonButtons = TaskDialogCommonButtons.Close, })); return; } var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "キーワードのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "キーワード " + this.SelectedText + " をミュートしますか?", Content = "このキーワードを含むツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) { return; } System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.User.ScreenName); Setting.Muteds.AddPredicate(new FilterOperatorContains { LeftValue = new StatusText(), RightValue = new StringValue(this.SelectedText) }); }
public void ConfirmDelete() { var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CustomButtons = new[] { "削除", "キャンセル" }, Content = "削除したツイートはもとに戻せません。", FooterIcon = VistaTaskDialogIcon.Information, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ツイートを削除しますか?", FooterText = "直近一件のツイートの訂正は、投稿欄で↑キーを押すと行えます。", Title = "ツイートの削除", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult == 0) { this.Delete(); } }
public void MuteClient() { var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CommonButtons = TaskDialogCommonButtons.OKCancel, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "クライアント " + this.SourceText + " をミュートしますか?", Content = "このクライアントからのツイートが全てのタブから除外されるようになります。", FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", Title = "クライアントのミュート", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.Result == TaskDialogSimpleResult.Ok) { // report as a spam System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.Source); } }
public void MuteUser() { var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CustomButtons = new[] { "ミュート", "キャンセル" }, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をミュートしますか?", Content = "このユーザーのツイートが全てのタブから除外されるようになります。", FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", Title = "ユーザーのミュート", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // TODO: Mute System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.User.ScreenName); }
private int SendMessageHelper( TaskDialogMessage message, int wparam, long lparam ) { return (int) SendMessage( hWndDialog, (uint) message, (IntPtr) wparam, new IntPtr( lparam ) ); }
private void NotifyQuickActionFailed(string main, string body) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgQuickActionFailedTitle, MainIcon = VistaTaskDialogIcon.Error, MainInstruction = main, Content = body, CommonButtons = TaskDialogCommonButtons.Close, }); this.Parent.Messenger.Raise(msg); }
private void SetClipboard(string value) { try { Clipboard.SetText(value); } catch (Exception ex) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgClipboardErrorTitle, MainIcon = VistaTaskDialogIcon.Error, MainInstruction = MainAreaTimelineResources.MsgClipboardErrorInst, Content = ex.Message, CommonButtons = TaskDialogCommonButtons.Close, }); this.Parent.Messenger.Raise(msg); } }
public void MuteKeyword() { if (String.IsNullOrWhiteSpace(SelectedText)) { this.Parent.Messenger.Raise(new TaskDialogMessage(new TaskDialogOptions { CommonButtons = TaskDialogCommonButtons.Close, MainIcon = VistaTaskDialogIcon.Information, MainInstruction = "キーワードを選択してください。", Content = "ミュートしたいキーワードをドラッグで選択できます。", Title = "キーワードのミュート", })); } // TODO var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CustomButtons = new[] { "ミュート", "キャンセル" }, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "キーワード " + SelectedText + " をミュートしますか?", Content = "このキーワードを含むツイートが全てのタブから除外されるようになります。", FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", Title = "キーワードミュート", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // TODO: Mute System.Diagnostics.Debug.WriteLine("Mute: " + Status.User.ScreenName); }
public void MuteClient() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "クライアントのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "クライアント " + this.SourceText + " をミュートしますか?", Content = "このクライアントからのツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.Source); Setting.Muteds.AddPredicate(new FilterOperatorContains { LeftValue = new StatusSource(), RightValue = new StringValue(this.SourceText) }); }
public void MuteKeyword() { if (String.IsNullOrWhiteSpace(this.SelectedText)) { this.Parent.Messenger.Raise(new TaskDialogMessage(new TaskDialogOptions { Title = "キーワードのミュート", MainIcon = VistaTaskDialogIcon.Information, MainInstruction = "キーワードを選択してください。", Content = "ミュートしたいキーワードをドラッグで選択できます。", CommonButtons = TaskDialogCommonButtons.Close, })); return; } var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "キーワードのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "キーワード " + this.SelectedText + " をミュートしますか?", Content = "このキーワードを含むツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.User.ScreenName); Setting.Muteds.AddPredicate(new FilterOperatorContains { LeftValue = new StatusText(), RightValue = new StringValue(this.SelectedText) }); }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CustomButtons = new[] { "スパム報告", "キャンセル" }, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + Status.User.ScreenName + " をスパム報告しますか?", Content = "全てのアカウントからブロックし、代表のアカウントからスパム報告します。", Title = "ユーザーをスパムとして報告", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // report as a spam var accounts = AccountsStore.Accounts.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) return; accounts.Select(a => a.AuthenticateInfo) .Select(a => new UpdateRelationOperation(a, this.Status.User, RelationKind.Block)) .Append(new UpdateRelationOperation(reporter.AuthenticateInfo, this.Status.User, RelationKind.ReportAsSpam)) .ToObservable() .SelectMany( o => o.Run() .Do( r => BackstageModel.RegisterEvent(new BlockedEvent(o.Info.UserInfo, o.Target)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => StatusStore.Find( s => s.User.Id == this.Status.User.Id || (s.RetweetedOriginal != null && s.RetweetedOriginal.User.Id == this.Status.User.Id)) .Subscribe(s => StatusStore.Remove(s.Id))); }
public void GiveFavstarTrophy() { if (!this.AssertQuickActionEnabled()) return; if (Setting.FavstarApiKey.Value == null) { this.Parent.Messenger.Raise(new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CommonButtons = TaskDialogCommonButtons.Close, MainIcon = VistaTaskDialogIcon.Error, MainInstruction = "この操作にはFavstar APIキーが必要です。", Content = "Favstar APIキーを取得し、設定画面で登録してください。", FooterIcon = VistaTaskDialogIcon.Information, FooterText = "FavstarのProメンバーのみこの操作を行えます。", Title = "ツイート賞の授与", })); return; } var msg = new TaskDialogMessage(new TaskDialogOptions { AllowDialogCancellation = true, CommonButtons = TaskDialogCommonButtons.OKCancel, MainIcon = VistaTaskDialogIcon.Information, MainInstruction = "このツイートに今日のツイート賞を与えますか?", Content = this.Status.ToString(), FooterIcon = VistaTaskDialogIcon.Information, FooterText = "FavstarのProメンバーのみこの操作を行えます。", Title = "Favstar ツイート賞の授与", }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.Result != TaskDialogSimpleResult.Ok) return; var accounts = this.GetImmediateAccounts() .ToObservable(); /* accounts.SelectMany(a => new FavstarTrophyOperation(a, this.Status).Run()) .Do(_ => this.RaisePropertyChanged(() => this.IsFavorited)) .Subscribe(); */ }
private TaskDialogMessage QueryMuteMessage(string title, string inst, string content) { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = title, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = inst, Content = content, CustomButtons = new[] { MainAreaTimelineResources.MsgMuteCmdMute, Resources.MsgButtonCancel }, DefaultButtonIndex = 0, FooterIcon = VistaTaskDialogIcon.Information, FooterText = MainAreaTimelineResources.MsgMuteFooter, AllowDialogCancellation = true, }); return this.Parent.Messenger.GetResponse(msg); }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーをスパムとして報告", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をスパム報告しますか?", Content = "全てのアカウントからブロックし、代表のアカウントからスパム報告します。", CustomButtons = new[] { "スパム報告", "キャンセル" }, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) return; var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var targetId = this.Status.User.Id.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses("UserId = " + targetId + " OR BaseUserId = " + targetId) .Subscribe(s => StatusInbox.QueueRemoval(s.Id)); }); }
public void MuteUser() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーのミュート", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をミュートしますか?", Content = "このユーザーのツイートが全てのタブから除外されるようになります。", CustomButtons = new[] { "ミュート", "キャンセル" }, FooterIcon = VistaTaskDialogIcon.Information, FooterText = "ミュートの解除は設定画面から行えます。", AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; System.Diagnostics.Debug.WriteLine("Mute: " + this.Status.User.ScreenName); Setting.Muteds.AddPredicate(new FilterOperatorEquals { LeftValue = new UserId(), RightValue = new NumericValue(this.Status.User.Id) }.Or(new FilterOperatorEquals { LeftValue = new RetweeterId(), RightValue = new NumericValue(this.Status.User.Id) })); }
public void ConfirmDelete() { var footer = MainAreaTimelineResources.MsgDeleteFooter; var amendkey = KeyAssignManager.CurrentProfile .FindAssignFromActionName("Amend", KeyAssignGroup.Input) .FirstOrDefault(); if (amendkey != null) { footer = String.Format( MainAreaTimelineResources.MsgDeleteFooterWithKey, amendkey.GetKeyDescribeString()); } var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgDeleteTitle, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = MainAreaTimelineResources.MsgDeleteInst, Content = MainAreaTimelineResources.MsgDeleteContent, CustomButtons = new[] { MainAreaTimelineResources.MsgDeleteCmdDelete, Resources.MsgButtonCancel }, AllowDialogCancellation = true, DefaultButtonIndex = 0, FooterIcon = VistaTaskDialogIcon.Information, FooterText = footer }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult == 0) { this.Delete(); } }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgReportAsSpamTitle, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = String.Format(MainAreaTimelineResources.MsgReportAsSpamInst, "@" + this.Status.User.ScreenName), Content = MainAreaTimelineResources.MsgReportAsSpamContent, CustomButtons = new[] { MainAreaTimelineResources.MsgReportAsSpamCmdReportAsSpam, Resources.MsgButtonCancel }, DefaultButtonIndex = 0, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) return; var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var tid = this.Status.User.Id; var tidstr = tid.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses( s => s.User.Id == tid || (s.RetweetedOriginal != null && s.RetweetedOriginal.User.Id == tid), "UserId = " + tidstr + " OR BaseUserId = " + tidstr) .Subscribe(s => StatusInbox.EnqueueRemoval(s.Id)); }); }
private int SendMessageHelper(TaskDialogMessage message, int wparam, long lparam) { return((int)SendMessage(hWndDialog, (uint)message, (IntPtr)wparam, new IntPtr(lparam))); }