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 async void RemoveProfile_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("settings_title_profileRemove"), Helper.FindString("settings_descr_profileRemove"), OsmoMessageBoxButton.YesNo); if (await DialogHelper.Instance.ShowDialog(msgBox) == OsmoMessageBoxResult.Yes) { App.ProfileManager.RemoveProfile((DataContext as SettingsViewModel).SelectedProfile.ProfileName); } }
private async void Settings_Loaded(object sender, RoutedEventArgs e) { bool exitAutoDetect; do { exitAutoDetect = true; SettingsViewModel vm = DataContext as SettingsViewModel; if (string.IsNullOrWhiteSpace(vm.OsuDirectory) || !Directory.Exists(vm.OsuDirectory)) { if (Helper.IsOsuInstalled()) { var msgBox = MaterialMessageBox.Show(Helper.FindString("settings_title_autodetectOsu"), Helper.FindString("settings_descr_autodetectOsu"), OsmoMessageBoxButton.YesNo); await DialogHelper.Instance.ShowDialog(msgBox); if (msgBox.Result == OsmoMessageBoxResult.Yes) { string osuPath = Helper.FindOsuInstallation(); if (!string.IsNullOrWhiteSpace(osuPath)) { vm.OsuDirectory = osuPath; } else { msgBox = MaterialMessageBox.Show(Helper.FindString("settings_title_autodetectFailed"), Helper.FindString("settings_descr_autodetectFailed"), OsmoMessageBoxButton.OKRetry); await DialogHelper.Instance.ShowDialog(msgBox); if (msgBox.Result == OsmoMessageBoxResult.Retry) { exitAutoDetect = false; } } } } else { var msgBox = MaterialMessageBox.Show(Helper.FindString("settings_title_autodetectNoOsuInstalled"), Helper.FindString("settings_descr_autodetectNoOsuInstalled"), OsmoMessageBoxButton.OKRetry); await DialogHelper.Instance.ShowDialog(msgBox); if (msgBox.Result == OsmoMessageBoxResult.Retry) { exitAutoDetect = false; } } } } while (!exitAutoDetect); }
private async void DeleteSkin(string name) { var msgBox = MaterialMessageBox.Show(Helper.FindString("skinSelect_deleteTitle"), Helper.FindString("skinSelect_deleteDescription"), OsmoMessageBoxButton.YesNo); await DialogHelper.Instance.ShowDialog(msgBox); if (msgBox.Result == OsmoMessageBoxResult.Yes) { (DataContext as SkinSelectViewModel).SkinManager.DeleteSkin(name); } }
private async void SkinDelete_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("skinSelect_deleteTitle"), Helper.FindString("skinSelect_deleteDescription"), MessageBoxButton.YesNo); await DialogHost.Show(msgBox); if (msgBox.Result == MessageBoxResult.Yes) { (DataContext as OsmoViewModel).SkinManager.DeleteSkin((sender as Button).Tag.ToString()); } }
private async void Erase_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("edit_eraseTitle"), Helper.FindString("edit_eraseDescription"), MessageBoxButton.YesNo); await DialogHost.Show(msgBox); string path = ((SkinViewModel)DataContext).SelectedElement.ReplaceBackup(null); if (msgBox.Result == MessageBoxResult.Yes) { SkinElement current = ((SkinViewModel)DataContext).SelectedElement; StopAudio(); ElementGenerator.Generate(current.ReplaceBackup(null), current.ElementDetails.IsSound); ((SkinViewModel)DataContext).RefreshImage(); ((SkinViewModel)DataContext).ResetEnabled = true; } }
private async void RevertSelected_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) { StopAudio(true); SkinMixerViewModel vm = (SkinMixerViewModel)DataContext; vm.SelectedElementLeft.Reset(); /*string path = AppConfiguration.GetInstance().BackupDirectory + "\\" + * vm.LoadedSkin.Name + "\\"; * File.Copy(path + vm.SelectedElement.Name, vm.SelectedElement.Path, true);*/ vm.RefreshImage(); } }
private async void Delete_Click(object sender, RoutedEventArgs e) { var msgBox = MaterialMessageBox.Show(Helper.FindString("edit_deleteTitle"), Helper.FindString("edit_deleteDescription"), MessageBoxButton.YesNo); await DialogHost.Show(msgBox); if (msgBox.Result == MessageBoxResult.Yes) { SkinElement element = ((SkinViewModel)DataContext).SelectedElement; if (lv_elements.SelectedIndex < lv_elements.Items.Count - 1) { lv_elements.SelectedIndex++; } else { lv_elements.SelectedIndex--; } element.Delete(); StopAudio(); ((SkinViewModel)DataContext).ResetEnabled = false; } }