public MainWindowViewModel() { _container = new UnityContainer(); _container.RegisterType <IUserService, UserService>(); _container.RegisterType <IWorkTimeDispatcherService, WorkTimeDispatcherService>(); _modelUserService = new ModelUserService(_container); _modelWorkTimeDispatcherService = new ModelWorkTimeDispatcherService(_container); Users = _modelUserService.GetUsers(); _workTimeDis = new WorkTimeDispatcherInfo(); ShowDialogCommand = new ShowDialogCommand(PostOpenDialog, PreOpenDialog); OpenWindowCommand = new OpenWindowCommand(); EnterLogin = new RelayCommand(OnEnterLogin); }
public MainWindow() { this.ViewModel = new MainViewModel(); InitializeComponent(); Observable.FromEventPattern(Save, nameof(Save.Click)) .Subscribe(x => { ShowDialogCommand.Execute().Subscribe(); ViewModel.DefaultCmd.Execute().Subscribe(); }); this.ShowDialogCommand = ReactiveCommand.CreateFromTask( () => this.ShowDialog(), this.WhenAnyValue(x => x.IsDialogOpen, (isopen) => !isopen)); }
public ContentViewModel(IDialogService _dialogService) { DialogService = _dialogService; RequestNavigateCommand .Subscribe(() => RegionNavigationService.RequestNavigate(nameof(CustomDialogView), new NavigationParameters { { "Input", Input.Value } })) .AddTo(DisposeCollection); ShowDialogCommand .Subscribe(() => { IDialogResult result = null; DialogService.ShowDialog(nameof(CustomDialogView), new DialogParameters { { "Input", Input.Value } }, ret => result = ret); if (result != null) { Input.Value = result.Parameters.GetValue <string>("Input"); } }).AddTo(DisposeCollection); ShowCommand .Subscribe(async() => { var trigger = new Subject <IDialogResult>(); var result = trigger.ToReadOnlyReactivePropertySlim(); DialogService.Show(nameof(CustomDialogView), new DialogParameters { { "Input", Input.Value } }, trigger.OnNext); await result; Input.Value = result.Value.Parameters.GetValue <string>("Input"); }).AddTo(DisposeCollection); }
public MainWindowViewModel() { OpenWindowCommand = new OpenWindowCommand(); ShowDialogCommand = new ShowDialogCommand(this); }
public MainWindowViewModel() { OpenWindowCommand = new OpenWindowCommand(); ShowDialogCommand = new ShowDialogCommand(PostOpenDialog, PreOpenDialog); }