private string? _SelectedLanguage; public string SelectedLanguage { get => _SelectedLanguage!; set { if (_SelectedLanguage != value) { _SelectedLanguage = value; StartCommand.RaiseCanExecuteChanged(); } } } private bool _IsBusy; public bool IsBusy { get { return _IsBusy; } set { if (_IsBusy != value) { _IsBusy = value; StartCommand.RaiseCanExecuteChanged(); } } } public AudioPageViewModel() { InitListLanguages(); CanBePressed = true; AzureTranscription = new AzureTranscriptionService(); DialogHelper = new DialogHelper(); FolderHelper = new FolderHelper(); AudioHelper = new AudioHelper(); ProcessMsgVisibility = Visibility.Hidden; MicrosofWordPathVisibility = Visibility.Hidden; PickFileCommad = new Command(PickFileAction); StartCommand = new AsyncCommand(StartAction, CanStartAction); CopyDocumentPathCommand = new Command(CopyDocumentPathAction); } private void CopyDocumentPathAction() { Clipboard.SetText(MicrosofWordtDocumentPath); } private async Task StartAction() { IsBusy = true; ProcessMsgVisibility = Visibility.Visible; MicrosofWordPathVisibility = Visibility.Hidden; CanBePressed = false; var FileWithoutExtension = Path.GetFileNameWithoutExtension (FilePath); var AudioPath = FolderHelper.CreateFolder(ConstantsHelpers.AUDIO); var DocumentPath = FolderHelper.CreateFolder(); var AudioFileNamePath = Path.Combine(AudioPath, $"{FileWithoutExtension}{ConstantsHelpers.WAV}"); var ConvertedAudioPath = AudioHelper.Converter(FilePath!, AudioFileNamePath); var DocumentName = Path.Combine(DocumentPath, $"{FileWithoutExtension}{ConstantsHelpers.DOCX}"); var str = await AzureTranscription.ConvertToTextAsync(ConvertedAudioPath, FileWithoutExtension!, SelectedLanguage); IsBusy = false; ProcessMsgVisibility = Visibility.Hidden; CanBePressed = true; MicrosofWordPathVisibility = Visibility.Visible; MicrosofWordtDocumentPath = DocumentName; } private bool CanStartAction(object arg) { return !string.IsNullOrEmpty(SelectedLanguage) && !string.IsNullOrEmpty(FilePath) && !IsBusy; } private void PickFileAction() { var FullPath = DialogHelper.GetFilePath(ConstantsHelpers.AUDIO); FilePath = FullPath; StartCommand?.RaiseCanExecuteChanged(); } private void InitListLanguages() { LanguagesDictionary = new Dictionary() { {1, new Languages { Name = "Spanish", Code = "es"} }, {2, new Languages { Name = "English", Code = "en"} } }; } UI