private async void ChangeList_Revert_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("edit_revertTitle"), Helper.FindString("edit_revertDescription"), MessageBoxButton.YesNo); await DialogHost.Show(msgBox); if (msgBox.Result == MessageBoxResult.Yes) { SkinViewModel vm = (SkinViewModel)DataContext; SkinElement element = vm.LoadedSkin.Elements.FirstOrDefault(x => x.Name.Equals( (sender as Button).Tag)) ?? null; if (element != null) { element.Reset(); if (element.Equals(vm.SelectedElement)) { vm.RefreshImage(); vm.ResetEnabled = false; } } } }
private void Replace_Click(object sender, RoutedEventArgs e) { SkinViewModel vm = DataContext as SkinViewModel; OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = GetFileFilter(vm.SelectedElement.FileType), InitialDirectory = vm.LoadedSkin.Path, Title = Helper.FindString("edit_replaceTitle") }; if (!string.IsNullOrWhiteSpace(lastPath)) { openFileDialog.InitialDirectory = lastPath; } if (openFileDialog.ShowDialog() == true) { //File.Copy(openFileDialog.FileName, vm.SelectedElement.Path, true); vm.SelectedElement.ReplaceBackup(new FileInfo(openFileDialog.FileName)); StopAudio(); vm.RefreshImage(); //Save the last visited directory lastPath = Path.GetDirectoryName(openFileDialog.FileName); vm.ResetEnabled = true; } }
private async void Revert_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("edit_revertTitle"), Helper.FindString("edit_revertDescription"), MessageBoxButton.YesNo); await DialogHost.Show(msgBox); if (msgBox.Result == MessageBoxResult.Yes) { SkinViewModel vm = (SkinViewModel)DataContext; vm.SelectedElement.Reset(); /*string path = AppConfiguration.GetInstance().BackupDirectory + "\\" + * vm.LoadedSkin.Name + "\\"; * File.Copy(path + vm.SelectedElement.Name, vm.SelectedElement.Path, true);*/ StopAudio(); vm.RefreshImage(); vm.ResetEnabled = false; } }