private void SaveButtom_Click(object sender, RoutedEventArgs e) { if (NameOfSaveBox.Text == String.Empty && ListOfSaves.SelectedItem == null) { MessageBox.Show("Напишите имя сохранения или укажите сохранение для перезаписи"); } if (ListOfSaves.SelectedItem != null) { SavePresentation result = (SavePresentation)ListOfSaves.SelectedItem; if (result != null) { SelectedSaveGuid = result.GuidOfSave; NameOfGame = result.NameOfSave; } } else if (NameOfSaveBox.Text != String.Empty) { SelectedSaveGuid = Guid.Empty; NameOfGame = NameOfSaveBox.Text; } if (SelectedSaveGuid != Guid.Empty || !String.IsNullOrEmpty(NameOfGame)) { GameController.FetchGameController.SaveGame(SelectedSaveGuid, NameOfGame); } }
private void Delete_OnClick_Click(object sender, RoutedEventArgs e) { Guid idOfSaveToDelete; if (ListOfSaves.SelectedItems.Count > 0) { SavePresentation result = (SavePresentation)ListOfSaves.SelectedItems[0]; if (result != null) { idOfSaveToDelete = result.GuidOfSave; GameController.DeleteSave(idOfSaveToDelete); } } Update(); }
private void Load_Click(object sender, RoutedEventArgs e) { if (ListOfSaves.SelectedItems.Count > 0) { SavePresentation result = (SavePresentation)ListOfSaves.SelectedItems[0]; if (result != null) { SelectedSaveGuid = result.GuidOfSave; } if (SelectedSaveGuid != Guid.Empty) { GameController.FetchGameController.LoadGame(SelectedSaveGuid); } } }