Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }