public Main() { InitializeComponent(); //LogRichText("Initializing...", Color.DarkGreen); if (!File.Exists("eel.db")) { InitializeDb(); } BindStaticControls(); RefreshScannedObjectsList(); GetSettings(); if (_settings == null) { _settings = new Settings { Commander = "The Mule", LogPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Frontier_Developments\\Products\\elite-dangerous-64\\Logs" }; } RefreshSettings(); GetLogPath(); if (!string.IsNullOrWhiteSpace(_dataPath)) { LogWatcher.Path = _dataPath; LogWatcher.EnableRaisingEvents = true; } RefreshExpeditionDropDown(); //PopulateSystemGrid(); PopulateObjectTypes(); GetDistanceTravelled(); _logFileHandler = new LogFileHandler(_currentExpedition); LoadSystems(); }
public static Settings InsertSettings(Settings settings) { if (null == settings) throw new ArgumentNullException("settings"); using (var db = new EelContext()) { db.Settings.Add(settings); db.SaveChanges(); } return settings; }
public SettingsForm(Settings settings) { InitializeComponent(); Settings = settings; if (null != settings) { CommanderNameText.Text = settings.Commander; EdsmKeyText.Text = settings.EdsmKey; LogFilePathText.Text = settings.LogPath; } }
public AddExpedition(ExpeditionFormType formType, Settings settings) { if (null == settings) throw new ArgumentNullException("settings"); InitializeComponent(); _settings = settings; if (formType == ExpeditionFormType.Add) { this.Text = "Add Expedition"; } else { this.Text = "Edit Expedition"; } }
public static Settings UpdateSettings(Settings settings) { if (null == settings) throw new ArgumentNullException("expedition"); using (var db = new EelContext()) { if (db.Settings.Count() > 0) { db.Settings.Attach(settings); db.Entry(settings).State = Microsoft.Data.Entity.EntityState.Modified; } else { db.Settings.Add(settings); } db.SaveChanges(); } return settings; }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { var settingsForm = new SettingsForm(_settings); if (settingsForm.ShowDialog() == DialogResult.OK) { _settings = SettingsServices.UpdateSettings(settingsForm.Settings); RefreshSettings(); } }
private void GetSettings() { _settings = SettingsServices.GetSettings(); }