public static async Task <bool> ExecuteAsync(IShell shell)
        {
            if (shell.IsModified == true)
            {
                var result = await AppMessageBox.ConfirmSaveOnClosingAsync();

                if (result == true)
                {
                    if (shell.SettingsPath != string.Empty)
                    {
                        await shell.SaveSettingsAsync();
                    }
                    else if (SaveSettingsCommand.CanExecute(shell) == true)
                    {
                        if (await SaveSettingsCommand.ExecuteAsync(shell) == false)
                        {
                            return(false);
                        }
                    }
                }
                else if (result == null)
                {
                    return(false);
                }
            }
            await shell.CloseAsync();

            return(true);
        }
        public static async Task ExecuteAsync(IShell shell, string fontPath)
        {
            var settings = await GetSettingsAsync(fontPath);

            if (settings != null)
            {
                if (shell.IsOpened == true)
                {
                    await shell.CloseAsync();
                }
                await shell.OpenAsync(fontPath, settings.Size, settings.DPI, settings.FaceIndex);
            }
        }
Exemple #3
0
        public static async Task <bool> ExecuteAsync(IShell shell)
        {
            if (await ExecuteInternlAsync(shell) == false)
            {
                return(false);
            }
            if (shell.IsOpened == true)
            {
                await shell.CloseAsync();
            }
            await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => System.Windows.Application.Current.Shutdown());

            return(true);
        }