private async Task <StorageFolder> SelectFolder(Models.EDirectoryType directoryType) { StorageFolder folder; try { folder = await this.FileIO.SelectFolder(directoryType); } catch (ArgumentException) { folder = null; } if (folder == null) { Log.Warning("フォルダーが見つかりません。正しいフォルダーを選択してください。"); DialogError dialogError = new DialogError(this.ThemeController.NowTheme, "フォルダーが見つかりません。\r\n\r\n正しいフォルダーを選択してください。"); await dialogError.ShowAsync( ); } return(folder); }
/// <summary>変換ボタンを押したとき。</summary> private async void ButtonRunClick(object sender, RoutedEventArgs e) { this.ButtonRun.IsEnabled = false; Log.Information("ButtonRunClick"); Window.Current.CoreWindow.PointerCursor = this.CursorRunning; Models.MeConverter meConverter = new Models.MeConverter( ); Models.MouthConverter mouthConverter = new Models.MouthConverter( ); Models.OtherConverters otherConverters = new Models.OtherConverters( ); try { this.CheckDirectory( ); meConverter.CheckDirectory(this.DirectoryInput); await this.FileIO.CopyDirectory(this.DirectoryInput, this.DirectoryOutput); await Task.WhenAll(meConverter.Convert(this.DirectoryInput, this.DirectoryOutput), mouthConverter.Convert(this.DirectoryInput, this.DirectoryOutput), otherConverters.Convert(this.DirectoryInput, this.DirectoryOutput)); } catch (Exception exception) when(exception is ArgumentException || exception is NullReferenceException) { Log.Warning(exception.Message.Replace("\r\n", " ")); Window.Current.CoreWindow.PointerCursor = this.CursorDefault; DialogError dialogError = new DialogError(this.ThemeController.NowTheme, exception.Message); await dialogError.ShowAsync( ); this.ButtonRun.IsEnabled = true; return; } catch (Exception exception) { Log.Warning("想定外のエラー:" + exception.ToString( )); Window.Current.CoreWindow.PointerCursor = this.CursorDefault; DialogError dialogError = new DialogError(this.ThemeController.NowTheme, "想定外のエラーが発生しました。開発者に↓を伝えると修正してくれるかもしれません。\r\n\r\n" + exception.ToString( )); await dialogError.ShowAsync( ); this.ButtonRun.IsEnabled = true; return; } this.Finish( ); this.ButtonRun.IsEnabled = true; }