private void EditFont(object sender, RoutedEventArgs e) { if (viewmodel.SelectedFont == null) { return; } string oldName = viewmodel.SelectedFont.Name; string oldImported = viewmodel.SelectedFont.ImportedFilename; ImportFont import = new ImportFont(); import.setAsset(viewmodel.SelectedFont); import.isEditMode = true; var result = import.ShowDialog(); if (result == true) { if (oldName != import.asset.Name) { var newName = import.asset.Name; import.asset.Name = oldName; //we changed the name, delete the old asset then create a new one System.IO.File.Delete(oldImported); import.asset.Name = newName; } } }
private void ImportFont(object sender, RoutedEventArgs e) { ImportFont import = new ImportFont(); var result = import.ShowDialog(); if (result == true) { viewmodel.Fonts.Add(import.asset); } }