private void btnExportNow_Click(object sender, RoutedEventArgs e) { CCBGameData gameData = new CCBGameData(); foreach (object oEntity in lbEntities.SelectedItems) { CCBGame selectedGame = (CCBGame)oEntity; if (null == selectedGame) { CCBGameTemplate gTemplate = (CCBGameTemplate)oEntity; if (null != gTemplate) { gameData.AddSafe(gTemplate); } } else { gameData.AddSafe(selectedGame); } } if (!gameData.SaveGames(tbTarget.Text)) { tStatus.Content = "Could not save to that file."; } }
void MainWindow_Closing(object sender, CancelEventArgs evtArgs) { m_timer.Stop(); m_timer.Close(); Save(); if (null != m_chatWnd) { m_chatWnd.Exit(); } try { //Save here always, in case there was some problem with the dirty logic. if (!m_games.SaveGames(m_config)) { MessageBoxResult mbr = System.Windows.MessageBox.Show("There was an error saving games. Do you still want to exit?", "Confirm Ceebeetle Exit", MessageBoxButton.YesNo); if (mbr == MessageBoxResult.No) { evtArgs.Cancel = true; } } if (!m_storeManager.SaveStores(m_config)) { CCBLogConfig.GetLogger().Log("Failed to write store file. Ignoring for now."); } CCBLogConfig.Close(); } catch (IOException iox) { CCBLogConfig.GetLogger().Log(iox.ToString()); evtArgs.Cancel = true; } }