Пример #1
0
        /// <inheritdoc />
        protected override async Task ExecuteAsync(MainWindowDialogModel?viewModel, object?parameter)
        {
            if (viewModel == null)
            {
                return;
            }

            var dialogModel = _viewModelService.CreateViewModel <ApplicationDialogModel>(viewModel);

            do
            {
                if (_dialogService.ShowDialog(dialogModel) != true)
                {
                    return;
                }

                if (!dialogModel.IsValid)
                {
                    _dialogService.ShowErrorDialog(Strings.DialogInputNotValid, Strings.Error);
                }
            } while (!dialogModel.IsValid);

            await _viewModelService.SaveViewModelAsync(dialogModel);

            await _viewModelService.UpdateViewModelAsync(viewModel);
        }
Пример #2
0
        /// <inheritdoc />
        protected override async Task ExecuteAsync(ApplicationViewModel?viewModel, object?parameter)
        {
            if (viewModel == null)
            {
                return;
            }

            var dialogModel = _viewModelService.CreateViewModel <ApplicationDialogModel>(viewModel);

            if (_dialogService.ShowDialog(dialogModel) != true)
            {
                return;
            }

            await _viewModelService.SaveViewModelAsync(dialogModel);

            await _viewModelService.UpdateViewModelAsync(viewModel);
        }
Пример #3
0
        /// <inheritdoc />
        protected override async Task ExecuteAsync(MainWindowDialogModel?viewModel, object?parameter)
        {
            if (viewModel == null)
            {
                return;
            }

            if (parameter is string parameterAsString)
            {
                viewModel.CurrentTheme = (Theme)Enum.Parse(typeof(Theme), parameterAsString);
            }
            else
            {
                viewModel.CurrentTheme = viewModel.CurrentTheme switch
                {
                    Theme.Light => Theme.Dark,
                    Theme.Dark => Theme.Light,
                    _ => Theme.Light,
                };
            }

            await _viewModelService.SaveViewModelAsync(viewModel);
        }