コード例 #1
0
        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)
            }));
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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)
            });
        }
コード例 #5
0
        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();
            }
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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));
            });
        }
コード例 #8
0
 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);
     }
 }
コード例 #9
0
        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)
            });
        }
コード例 #10
0
 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();
     }
 }
コード例 #11
0
 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);
     }
 }
コード例 #12
0
 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);
 }
コード例 #13
0
ファイル: TaskDialog.cs プロジェクト: Robpol86/UnofficialDDNS
 private int SendMessageHelper( TaskDialogMessage message, int wparam, long lparam )
 {
     return (int) SendMessage( hWndDialog, (uint) message, (IntPtr) wparam, new IntPtr( lparam ) );
 }
コード例 #14
0
 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);
 }
コード例 #15
0
 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);
     }
 }
コード例 #16
0
ファイル: StatusViewModel.cs プロジェクト: ssk-uo/StarryEyes
 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);
 }
コード例 #17
0
 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)
     });
 }
コード例 #18
0
 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);
 }
コード例 #19
0
 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)
     });
 }
コード例 #20
0
ファイル: StatusViewModel.cs プロジェクト: ssk-uo/StarryEyes
 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)));
 }
コード例 #21
0
 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();
 }
コード例 #22
0
 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();
     */
 }
コード例 #23
0
 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);
 }
コード例 #24
0
 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));
                 });
 }
コード例 #25
0
 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();
 }
コード例 #26
0
 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)
     }));
 }
コード例 #27
0
 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();
     }
 }
コード例 #28
0
 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);
     }
 }
コード例 #29
0
 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));
                 });
 }
コード例 #30
0
 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();
     }
 }
コード例 #31
0
 private int SendMessageHelper(TaskDialogMessage message, int wparam, long lparam)
 {
     return((int)SendMessage(hWndDialog, (uint)message, (IntPtr)wparam, new IntPtr(lparam)));
 }