private void SelectNone() { SelectedFilesCollection.Clear(); RaiseCanExecuteChanged(); EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Resources.StatusBarSelectNone); }
private void StartGeneration() { if (SelectedVariantTab == 1) { SelectedFilesCollection.Clear(); SelectedFilesCollection.Add(new MatFileGenFiles { FullFilePath = SelectedPath + SolidColorName + EXTENSION.Substring(1), FileName = SolidColorName }); } var fg = new FileGeneration { FileCollection = FileCollection, GenerationFiles = SelectedFilesCollection, Extension = EXTENSION.Substring(1), SelectedPath = SelectedPath, SolidRgb = SolidRgb, IsFromJpg = SelectedVariantTab == 0 }; fg.DoGenerationAsync(); }
private void SelectAll() { SelectedFilesCollection.Clear(); foreach (var selectedFile in FileCollection) { selectedFile.IsSelected = true; SelectedFilesCollection.Add(selectedFile); } RaiseCanExecuteChanged(); EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Resources.StatusBarSelectAll); }
[ExcludeFromCodeCoverage] // TODO: could maybe remove after creating a test of this private async void StartGeneration() { var metroDialog = new MetroMessageDisplayService(Container); var controller = await metroDialog.ShowProgressAsync(infraProps.Resources.ProgressDialogTitle, infraProps.Resources.ProgressDialogPreviewContent); controller.SetIndeterminate(); controller.SetCancelable(true); int sumFiles = SelectedFilesCollection.Count; int curFile = 0; controller.Maximum = sumFiles; await Task.Delay(250); if (!Directory.Exists(PathNames.TempFolderPath)) { Directory.CreateDirectory(PathNames.TempFolderPath); } foreach (var file in SelectedFilesCollection.Where(file => File.Exists(file.FullFilePath))) { try { var tmpFile = PathNames.TempFolderPath + CharConverterService.ConvertCharsToAscii(file.FileName + EXTENSION); File.Copy(file.FullFilePath, tmpFile, true); await Task.Delay(50); ExternalProgramService.OpenThirdParty("fix3ds.exe", " -m \"" + tmpFile + "\"", PathNames.ThirdPartyPath); await Task.Delay(50); File.Delete(file.FullFilePath); File.Copy(tmpFile, SelectedPath + Path.GetFileName(tmpFile), true); File.SetCreationTime(SelectedPath + Path.GetFileName(tmpFile), DateTime.Now); await Task.Delay(50); controller.SetProgress(++curFile); controller.SetMessage(string.Format(infraProps.Resources.ProgressDialogRunningContent, curFile, sumFiles)); await Task.Delay(50); } catch (Exception ex) { var logMessage = $"[{GetType().Name}] Exception at generation: {ex}"; Container.Resolve <ILoggerFacade>().Log(logMessage, Category.Exception, Priority.High); DialogService.Exception(ex, DialogService.ExceptionType.Universal); } } await controller.CloseAsync(); GetFiles(); if (controller.IsCanceled) { await metroDialog.ShowMessageAsync(infraProps.Resources.MessageDialogCancelTitle, infraProps.Resources.MessageDialogCancelContent); return; } if (await metroDialog.ShowMessageAsync(infraProps.Resources.MessageDialogCompleteTitle, string.Format(infraProps.Resources.MessageDialogCompleteContent, "\n"), MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative) { ExternalProgramService.OpenExplorer(SelectedPath); } EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(string.Format(Resources.StatusBarFilesGenerated, sumFiles)); }