Exemplo n.º 1
0
        public SearchViewModel(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog, ISearchService service,
                               ReactiveSingleSelectCollection<Entity> entityCollection,
                               ReactiveSingleSelectCollection<Dimension> dimensionCollection,
                               BindableCollection<string> logOutputCollection)
            : base(log, scheduler, standardDialog)
        {
            _service = service;

            Disposables.Add(service);

            Entity = entityCollection;
            Dimension = dimensionCollection;
            LogOutput = logOutputCollection;

            EntityEnterCommand = new ObservableCommand();
            DimensionEnterCommand = new ObservableCommand();

            EntitySetup();
            DimensionSetup();
        }
Exemplo n.º 2
0
        private void CreateSaveToolBar(IToolBarService toolBarService)
        {
            var saveCommand = new ObservableCommand(Model.IsValid);
            saveCommand.Executed
                       .ObserveOn(Scheduler.Task.RX)
                       .SelectMany(_ => _service.SaveAsync()
                                                .ToObservable()
                                                .TakeUntil(BusyViewModel.BusyLatch))
                       .TakeUntil(ClosingStrategy.Closed)
                       .Subscribe(_ => { });

            var saveToolBarItem = toolBarService.CreateToolBarButtonItem();
            saveToolBarItem.DisplayName = "Save";
            saveToolBarItem.ImageName = IconNames.SAVE;
            saveToolBarItem.Command = saveCommand;

            ToolBarItems.Add(saveToolBarItem);

            this.SyncToolBarItemWithViewModelActivationState(saveToolBarItem).AddDisposable(Disposables);
        }