예제 #1
0
        /// <summary>
        /// Saves the configuration.
        /// </summary>
        private void SaveConfig()
        {
            try
            {
                if (mainViewModel == null)
                {
                    return;
                }

                string selectedQuest = mainViewModel.SelectedQuest?.ThreadName ?? "";

                NetTallyConfig.Save(mainViewModel.QuestList, selectedQuest, AdvancedOptions.Instance);
            }
            catch (Exception ex)
            {
                SaveExceptionAndNotifyUser(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// When the program closes, save the current list of quests.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            try
            {
                if (ViewModelService.MainViewModel == null)
                {
                    return;
                }

                string selectedQuest = ViewModelService.MainViewModel.SelectedQuest?.ThreadName ?? "";

                QuestCollectionWrapper wrapper = new QuestCollectionWrapper(ViewModelService.MainViewModel.QuestList, selectedQuest);
                NetTallyConfig.Save(wrapper);
            }
            catch (Exception ex)
            {
                string file = ErrorLog.Log(ex);
                MessageBox.Show($"Error log saved to:\n{file ?? "(unable to write log file)"}", "Error in shutdown", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #3
0
        /// <summary>
        /// Saves the configuration.
        /// </summary>
        private void SaveConfig()
        {
            try
            {
                if (mainViewModel == null)
                {
                    return;
                }

                string selectedQuest = mainViewModel.SelectedQuest?.ThreadName ?? "";

                NetTallyConfig.Save(mainViewModel.QuestList, selectedQuest, AdvancedOptions.Instance);

                logger.LogDebug("Configuration saved.");
            }
            catch (Exception ex)
            {
                logger.LogWarning(ex, "Failed to save configuration.");
                ShowWarning("The program failed to save configuration data.", "Failed to save configuration");
            }
        }