Example #1
0
 public BlogViewModel()
 {
     _service = AppRuntimeContext.Current.Resolve <Maincotech.Cms.Services.IUserService>();
     Load     = ReactiveCommand.CreateFromTask(LoadAll);
     Load.ThrownExceptions.Subscribe(exception =>
     {
         _Logger.Error("Unexpected error occurred.", exception);
     });
 }
Example #2
0
        public IndexViewModel()
        {
            _service = AppRuntimeContext.Current.Resolve <Maincotech.Cms.Services.IUserService>();
            Load     = ReactiveCommand.CreateFromTask(LoadAll);
            _items   = Load.ToProperty(this, x => x.Items, scheduler: RxApp.MainThreadScheduler);
            Load.ThrownExceptions.Subscribe(exception =>
            {
                _Logger.Error("Unexpected error occurred.", exception);
            });

            this.WhenAnyObservable(x => x.Load.IsExecuting).ToProperty(this, x => x.IsLoading, out _isLoading);

            LoadCategories = ReactiveCommand.CreateFromTask(LoadBlogCategories);
            _categories    = LoadCategories.ToProperty(this, x => x.Categories, scheduler: RxApp.MainThreadScheduler);
            LoadCategories.ThrownExceptions.Subscribe(exception =>
            {
                _Logger.Error("Unexpected error occurred.", exception);
            });

            this.WhenAnyObservable(x => x.LoadCategories.IsExecuting).ToProperty(this, x => x.IsLoadingCategories, out _IsLoadingCategories);
        }