Exemple #1
0
        private async void ChangeDisplayOfTimeline(TweetDisplayMode newValue)
        {
            if (Setting.TweetDisplayMode.Value == newValue)
            {
                RaisePropertyChanged();
                return;
            }
            var showDonationInfo = false;

            if (Setting.TweetDisplayMode.Value == Settings.TweetDisplayMode.Expanded &&
                (newValue == Settings.TweetDisplayMode.SingleLine || newValue == Settings.TweetDisplayMode.Mixed))
            {
                var resp = this.Messenger.GetResponse(new TaskDialogMessage(new TaskDialogOptions
                {
                    Title           = "一行表示モードの警告",
                    MainIcon        = VistaTaskDialogIcon.Warning,
                    MainInstruction = "一行表示モードを有効にしようとしています。",
                    Content         = "一行表示モードは複数行表示モードに比べ、リソースを大量に消費します。" + Environment.NewLine +
                                      "また、Krile StarryEyesは一行表示モードをベースとして設計されてはいないため、意図しない動作をする可能性があります。" +
                                      Environment.NewLine +
                                      "一行表示モードを本当に有効にしますか?",
                    CommonButtons = TaskDialogCommonButtons.YesNo
                }));
                if (resp.Response.Result == TaskDialogSimpleResult.No)
                {
                    this.TweetDisplayMode = (int)Settings.TweetDisplayMode.Expanded;
                    return;
                }
                showDonationInfo = true;
            }
            await DispatcherHolder.BeginInvoke(() =>
            {
                var ww = new WorkingWindow(
                    "changing timeline mode...", async() =>
                {
                    await Task.Run(() => Setting.TweetDisplayMode.Value = newValue);
                    RaisePropertyChanged(() => IsDonationVisible);
                    await DispatcherHolder.BeginInvoke(async() =>
                    {
                        await Dispatcher.Yield(DispatcherPriority.Background);
                    });
                });
                if (showDonationInfo && !ContributionService.IsContributor())
                {
                    ww.Closed += async(o, e) =>
                    {
                        await this.Messenger.RaiseAsync(new TaskDialogMessage(new TaskDialogOptions
                        {
                            Title           = "Krileの開発にご協力ください。",
                            MainIcon        = VistaTaskDialogIcon.Information,
                            MainInstruction = "Krileの開発にご協力ください。",
                            Content         = "多くのユーザーの補助によってKrileが開発されています。" + Environment.NewLine +
                                              "Krileの開発を継続するため、寄付にご協力ください。",
                            CustomButtons = new[] { "開発者に寄付" }
                        }));
                        BrowserHelper.Open(App.DonationUrl);
                    };
                }
                ww.ShowDialog();
            });
        }
 private async void ChangeDisplayOfTimeline(TweetDisplayMode newValue)
 {
     if (Setting.TweetDisplayMode.Value == newValue)
     {
         RaisePropertyChanged();
         return;
     }
     var showDonationInfo = false;
     if (Setting.TweetDisplayMode.Value == Settings.TweetDisplayMode.Expanded &&
         (newValue == Settings.TweetDisplayMode.SingleLine || newValue == Settings.TweetDisplayMode.Mixed))
     {
         var resp = this.Messenger.GetResponse(new TaskDialogMessage(new TaskDialogOptions
         {
             Title = "一行表示モードの警告",
             MainIcon = VistaTaskDialogIcon.Warning,
             MainInstruction = "一行表示モードを有効にしようとしています。",
             Content = "一行表示モードは複数行表示モードに比べ、リソースを大量に消費します。" + Environment.NewLine +
                       "また、Krile StarryEyesは一行表示モードをベースとして設計されてはいないため、意図しない動作をする可能性があります。" +
                       Environment.NewLine +
                       "一行表示モードを本当に有効にしますか?",
             CommonButtons = TaskDialogCommonButtons.YesNo
         }));
         if (resp.Response.Result == TaskDialogSimpleResult.No)
         {
             this.TweetDisplayMode = (int)Settings.TweetDisplayMode.Expanded;
             return;
         }
         showDonationInfo = true;
     }
     await DispatcherHolder.BeginInvoke(async () =>
     {
         var ww = new WorkingWindow(
             "changing timeline mode...", async () =>
             {
                 await Task.Run(() => Setting.TweetDisplayMode.Value = newValue);
                 RaisePropertyChanged(() => IsDonationVisible);
                 await DispatcherHolder.BeginInvoke(async () =>
                 {
                     await Dispatcher.Yield(DispatcherPriority.Background);
                 });
             });
         if (showDonationInfo && !ContributionService.IsContributor())
         {
             ww.Closed += async (o, e) =>
             {
                 await this.Messenger.RaiseAsync(new TaskDialogMessage(new TaskDialogOptions
                 {
                     Title = "Krileの開発にご協力ください。",
                     MainIcon = VistaTaskDialogIcon.Information,
                     MainInstruction = "Krileの開発にご協力ください。",
                     Content = "多くのユーザーの補助によってKrileが開発されています。" + Environment.NewLine +
                               "Krileの開発を継続するため、寄付にご協力ください。",
                     CustomButtons = new[] { "開発者に寄付" }
                 }));
                 BrowserHelper.Open(App.DonationUrl);
             };
         }
         ww.ShowDialog();
     });
 }
 private async void ChangeDisplayOfTimeline(TweetDisplayMode newValue)
 {
     if (Setting.TweetDisplayMode.Value == newValue)
     {
         RaisePropertyChanged();
         return;
     }
     if (Setting.TweetDisplayMode.Value == Settings.TweetDisplayMode.Expanded &&
         (newValue == Settings.TweetDisplayMode.SingleLine || newValue == Settings.TweetDisplayMode.Mixed))
     {
         var resp = this.Messenger.GetResponseSafe(() => new TaskDialogMessage(new TaskDialogOptions
         {
             Title = SettingFlipResources.TimelineSinglelineWarnTitle,
             MainIcon = VistaTaskDialogIcon.Warning,
             MainInstruction = SettingFlipResources.TimelineSingleLineWarnInst,
             Content = SettingFlipResources.TimelineSingleLineWarnContent,
             CommonButtons = TaskDialogCommonButtons.YesNo
         }));
         if (resp.Response.Result == TaskDialogSimpleResult.No)
         {
             this.TweetDisplayMode = (int)Settings.TweetDisplayMode.Expanded;
             return;
         }
     }
     await DispatcherHolder.BeginInvoke(() =>
     {
         var ww = new WorkingWindow(
             "changing timeline mode...", async () =>
             {
                 await Task.Run(() => Setting.TweetDisplayMode.Value = newValue);
                 RaisePropertyChanged(() => IsDonationVisible);
                 await DispatcherHolder.BeginInvoke(async () =>
                 {
                     await Dispatcher.Yield(DispatcherPriority.Background);
                 });
             });
         ww.ShowDialog();
     });
 }