Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public SettingsForm(Settings settings)
 {
     InitializeComponent();
     Settings = settings;
     if (null != settings) {
         CommanderNameText.Text = settings.Commander;
         EdsmKeyText.Text = settings.EdsmKey;
         LogFilePathText.Text = settings.LogPath;
     }
 }
Exemplo n.º 4
0
 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";
     }
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var settingsForm = new SettingsForm(_settings);
     if (settingsForm.ShowDialog() == DialogResult.OK) {
         _settings = SettingsServices.UpdateSettings(settingsForm.Settings);
         RefreshSettings();
     }
 }
Exemplo n.º 7
0
 private void GetSettings()
 {
     _settings = SettingsServices.GetSettings();
 }