Пример #1
0
        public ModeSelectionVM(MainWindowVM mainVM)
        {
            _mainVM = mainVM;

            InstallCommand = ReactiveCommand.Create(
                execute: () =>
            {
                var path = mainVM.Settings.Installer.LastInstalledListLocation;
                if (path == default || !path.Exists)
                {
                    path = UIUtils.OpenFileDialog($"*{Consts.ModListExtension}|*{Consts.ModListExtension}");
                }
                _mainVM.OpenInstaller(path);
            });

            CompileCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Compiler.Value));
            BrowseCommand  = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Gallery.Value));
        }
Пример #2
0
        public BackNavigatingVM(MainWindowVM mainWindowVM)
        {
            BackCommand = ReactiveCommand.Create(
                execute: () => Utils.CatchAndLog(() => mainWindowVM.NavigateTo(NavigateBackTarget)),
                canExecute: this.ConstructCanNavigateBack()
                .ObserveOnGuiThread());

            _IsActive = this.ConstructIsActive(mainWindowVM)
                        .ToGuiProperty(this, nameof(IsActive));
        }
Пример #3
0
        public ModeSelectionVM(MainWindowVM mainVM)
        {
            _mainVM = mainVM;

            InstallCommand = ReactiveCommand.Create(
                execute: () =>
            {
                var path = mainVM.Settings.Installer.LastInstalledListLocation;
                if (string.IsNullOrWhiteSpace(path) ||
                    !File.Exists(path))
                {
                    path = UIUtils.OpenFileDialog($"*{ExtensionManager.Extension}|*{ExtensionManager.Extension}");
                }
                _mainVM.OpenInstaller(path);
            });

            CompileCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Compiler.Value));
            BrowseCommand  = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Gallery.Value));
        }
Пример #4
0
        public BackNavigatingVM(MainWindowVM mainWindowVM)
        {
            IsBackEnabled = IsBackEnabledSubject.StartWith(true);
            BackCommand   = ReactiveCommand.Create(
                execute: () => Utils.CatchAndLog(() =>
            {
                mainWindowVM.NavigateTo(NavigateBackTarget);
                Unload();
            }),
                canExecute: this.ConstructCanNavigateBack()
                .ObserveOnGuiThread());

            _IsActive = this.ConstructIsActive(mainWindowVM)
                        .ToGuiProperty(this, nameof(IsActive));
        }