예제 #1
0
 private void DeleteHero(object hero)
 {
     if (hero == null)
     {
         return;
     }
     try
     {
         using (SQLiteDatabaseFunction DatabaseRequest = new SQLiteDatabaseFunction())
         {
             DatabaseRequest.DeleteHero((Hero)hero);
         }
         ListHeroes.Remove((Hero)hero);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Error when loading hero data : " + ex);
     }
 }
예제 #2
0
        public void HandleDeath(Story story)
        {
            MessageBox.Show(GlobalTranslator.Instance.Translator.ProvideValue("YouDied"));
            try
            {
                using (SQLiteDatabaseFunction DatabaseRequest = new SQLiteDatabaseFunction())
                {
                    DatabaseRequest.DeleteHero(story.PlayerHero);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error when deleting hero data : " + ex);
            }
            MenuLoad LoadMenu = new MenuLoad()
            {
                DataContext = new MenuLoadViewModel()
            };

            LoadMenu.Show();
            CloseWindow();
        }