Пример #1
0
        public BookViewModel(ContextViewModel vm = null, RoutingState router = null)
        {
            _contextVm = vm ?? Locator.Current.GetService <ContextViewModel>();
            _router    = router ?? Locator.Current.GetService <RoutingState>(RoutedViewHosts.Library);

            GotoContext = ReactiveCommand.CreateFromTask(GotoContextImpl);
        }
Пример #2
0
        public MainViewModel(
            LibraryViewModel libraryVm = null,
            ContextViewModel contextVm = null,
            RoutingState router        = null)
        {
            _libraryVm = libraryVm ?? Locator.Current.GetService <LibraryViewModel>();

            Router = router ?? Locator.Current.GetService <RoutingState>(RoutedViewHosts.Main);

            GotoLibrary = ReactiveCommand.CreateFromObservable(() => Router.Navigate.Execute(_libraryVm));
            SendStatus  = ReactiveCommand.Create(() =>
            {
                var i = _random.Next(1, 256);
                MessageBus.Current.SendMessage(new UiStatus($"Hello world {i}"));
            });
        }