当前位置: 首页>>代码示例>>C#>>正文


C# IDialogService.ShowException方法代码示例

本文整理汇总了C#中IDialogService.ShowException方法的典型用法代码示例。如果您正苦于以下问题:C# IDialogService.ShowException方法的具体用法?C# IDialogService.ShowException怎么用?C# IDialogService.ShowException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDialogService的用法示例。


在下文中一共展示了IDialogService.ShowException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestViewModel

        public TestViewModel(IDialogService dialogService)
        {
            _dialogService = dialogService;

            var changeTime = ReactiveCommand.CreateAsyncObservable(_ => Observable.Return(DateTime.UtcNow.ToLocalTime().ToString()));
            changeTime.Subscribe(s => Hello = s);

            var asyncHelloCommand = ReactiveCommand.CreateAsyncTask(_ =>
                                                                        Task.Run(() =>
                                                                                 {
                                                                                     Thread.Sleep(2000);
                                                                                     Debug.WriteLine(Thread.CurrentThread.IsThreadPoolThread);
                                                                                     return _random.NextDouble().ToString();
                                                                                 }
                                                                        ));

            asyncHelloCommand.Subscribe(s => Rando = s);

            _sayHelloCommand = ReactiveCommand.CreateCombined(new IReactiveCommand[]{changeTime, asyncHelloCommand});

            _showDialogCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.Hello, s => !string.IsNullOrWhiteSpace(s)));
            //
            //            var dialog2Command = ReactiveCommand.CreateAsyncObservable(o =>
            //                                                                       {
            //                                                                           if (o is Answer)
            //                                                                           {
            //                                                                               return Observable.Return((Answer)o);
            //                                                                           }
            //                                                                           return Observable.Empty<Answer>();
            //                                                                       });
            //
            //            dialog2Command
            //                .Where(a => a == Answer.Ok)
            //                .Subscribe(o =>
            //                           {
            //                               throw new Exception("AAAAAAAAA");
            //                           });

            //            _showDialogCommand.Subscribe(x =>
            //                                         {
            //                                             Hello = null;
            //                                         });

            var answer = new Subject<Answer>();
            answer.Subscribe(o => _dialogService.ShowInformation("Hello"));

            var b = true;

            _showDialogCommand.Subscribe(_ =>
                                         {
                                             var asyncCommand = ReactiveCommand.CreateAsyncObservable(o =>
                                                                                                      {
                                                                                                          Hello = null;
                                                                                                          b = !b;
                                                                                                          if (b)
                                                                                                          {
                                                                                                              throw (new InvalidOperationException("OOOOOOOO"));
                                                                                                          }
                                                                                                          answer.OnNext(
                                                                                                                        _dialogService.ShowQuestion(
                                                                                                                                                       "Do it to it", "NEWWW CAPRION", new[]{Answer.Abort, Answer.Cancel, Answer.No, Answer.Ok, Answer.Retry, Answer.Yes, }));
                                                                                                          return Observable.Return(Unit.Default);
                                                                                                      });
                                             asyncCommand.ExecuteAsync().Subscribe();
                                         });

            _showDialogCommand.ThrownExceptions
                              .Subscribe(ex => _dialogService.ShowException(ex, "message"));

            _counter = Observable.Generate(0, i => true, i => i + 1, i => i, i => TimeSpan.FromSeconds(.01))
                                 .ToProperty(this, t => t.Counter);
        }
开发者ID:jcomtois,项目名称:ReactiveDialog,代码行数:72,代码来源:TestViewModel.cs


注:本文中的IDialogService.ShowException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。