예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ApplicationSettingsForm form = new ApplicationSettingsForm();

            form.LoadData(applicationSettings);
            if (form.ShowDialog() == DialogResult.OK)
            {
                applicationSettings = form.ToData();
            }
        }
예제 #2
0
        private void EnsureApplicationSettings()
        {
            string settingsFilePath = Path.Combine(Directory.GetCurrentDirectory(), "settings.json");

            if (File.Exists(settingsFilePath))
            {
                using (StreamReader reader = new StreamReader(settingsFilePath))
                {
                    applicationSettings = JsonConvert.DeserializeObject <Data.AplicationSettingsData>(reader.ReadToEnd());
                }
            }
            else
            {
                ApplicationSettingsForm form = new ApplicationSettingsForm();
                form.DataDirectory = Directory.GetCurrentDirectory();
                do
                {
                    MessageBox.Show("Initial configuration needed, please provide the following information.", "Setup needed.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                } while (form.ShowDialog() != DialogResult.OK);
                applicationSettings = form.ToData();
            }
        }