Ejemplo n.º 1
0
        public void PopulateCommanders()
        {
            comboBoxCommander.Enabled = false;
            commanders = new List <EDCommander>();

            commanders.AddRange(EDCommander.GetList());

            comboBoxCommander.DataSource    = null;
            comboBoxCommander.DataSource    = commanders;
            comboBoxCommander.ValueMember   = "Nr";
            comboBoxCommander.DisplayMember = "Name";

            Application.DoEvents();

            if (_discoveryForm.history.CommanderId == -1)
            {
                comboBoxCommander.SelectedIndex = 0;
            }
            else
            {
                comboBoxCommander.SelectedItem = EDCommander.Current;
            }

            comboBoxCommander.Enabled = true;
        }
Ejemplo n.º 2
0
 public void PopulateCommanders()
 {
     comboBoxCommander.Enabled = false;      // in case its got a on selection item hook
     comboBoxCommander.Items.Clear();        // comboBox is nicer with items
     comboBoxCommander.Items.AddRange((from EDCommander c in EDCommander.GetList() select c.Name).ToList());
     comboBoxCommander.SelectedItem = EDCommander.Current.Name;
     comboBoxCommander.Enabled      = true;
 }
Ejemplo n.º 3
0
        private void buttonImport_Click(object sender, EventArgs e)
        {
            var itm = (from EDCommander c in EDCommander.GetList() where c.Name.Equals(comboBoxCommander.Text) select c).ToList();

            if (itm == null || itm.Count == 0)
            {
                ExtendedControls.MessageBoxTheme.Show("Code failure - cannot find selected commander", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            long cmdrID = itm[0].Nr;

            if (string.IsNullOrEmpty(importFile) || !File.Exists(importFile))
            {
                ExtendedControls.MessageBoxTheme.Show("An import file must be specified.", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string delim = radioButtonTab.Checked ? "\t" : textBoxDelimiter.Text;

            if (string.IsNullOrEmpty(delim))
            {
                ExtendedControls.MessageBoxTheme.Show("A delimiter must be defined.", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int?datecol = string.IsNullOrEmpty(textBoxArrivalDate.Text) ? null : (int?)int.Parse(textBoxArrivalDate.Text);
            int?timecol = string.IsNullOrEmpty(textBoxArrivalTime.Text) ? null : (int?)int.Parse(textBoxArrivalTime.Text);
            int?namecol = string.IsNullOrEmpty(textBoxSysName.Text) ? null : (int?)int.Parse(textBoxSysName.Text);
            int?notecol = string.IsNullOrEmpty(textBoxSysNotes.Text) ? null : (int?)int.Parse(textBoxSysNotes.Text);

            if (!namecol.HasValue)
            {
                ExtendedControls.MessageBoxTheme.Show("System Name column must be defined.", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!datecol.HasValue && !notecol.HasValue)
            {
                ExtendedControls.MessageBoxTheme.Show("At least one of arrival date and system note columns must be defined.", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            ImportHistory ih = new ImportHistory(importFile, delim, datecol, timecol, namecol, notecol, checkBoxImpHeader.Checked, cmdrID);
            string        result;

            if (ih.Import(out result))
            {
                ExtendedControls.MessageBoxTheme.Show("Import successful.", "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.None);
                _discoveryForm.RefreshHistoryAsync();
            }
            else
            {
                ExtendedControls.MessageBoxTheme.Show("Import failed: " + result, "EDD Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            ih = null;
        }
Ejemplo n.º 4
0
        public bool Init()
        {
            List <EDCommander> commanders = EDCommander.GetList();

            comboBoxCommanders.DisplayMember = "Name";
            comboBoxCommanders.ValueMember   = "Nr";
            comboBoxCommanders.DataSource    = commanders;

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            theme.ApplyToForm(this);

            return(true);
        }
Ejemplo n.º 5
0
        public override void InitialDisplay()
        {
            checkBoxEDSMLog.Checked              = EDDiscoveryForm.EDDConfig.EDSMLog;
            checkBoxOrderRowsInverted.Checked    = EDDiscoveryForm.EDDConfig.OrderRowsInverted;
            checkBoxMinimizeToNotifyIcon.Checked = EDDiscoveryForm.EDDConfig.MinimizeToNotifyIcon;
            checkBoxKeepOnTop.Checked            = EDDiscoveryForm.EDDConfig.KeepOnTop;
            checkBoxUseNotifyIcon.Checked        = EDDiscoveryForm.EDDConfig.UseNotifyIcon;
            checkBoxUTC.Checked          = EDDiscoveryForm.EDDConfig.DisplayUTC;
            checkBoxAutoLoad.Checked     = EDDiscoveryForm.EDDConfig.AutoLoadPopOuts;
            checkBoxAutoSave.Checked     = EDDiscoveryForm.EDDConfig.AutoSavePopOuts;
            checkBoxShowUIEvents.Checked = EDDiscoveryForm.EDDConfig.ShowUIEvents;

            checkBoxMinimizeToNotifyIcon.Enabled = EDDiscoveryForm.EDDConfig.UseNotifyIcon;

            textBoxHomeSystem.Text = EDDConfig.Instance.HomeSystem.Name;

            textBoxDefaultZoom.ValueNoChange = EDDConfig.Instance.MapZoom;

            bool selectionCentre = EDDConfig.Instance.MapCentreOnSelection;

            radioButtonHistorySelection.Checked = selectionCentre;
            radioButtonCentreHome.Checked       = !selectionCentre;

            dataGridViewCommanders.AutoGenerateColumns = false;             // BEFORE assigned to list..
            dataGridViewCommanders.DataSource          = EDCommander.GetList();

            panel_defaultmapcolor.BackColor = Color.FromArgb(EDDConfig.Instance.DefaultMapColour);

            this.comboBoxTheme.SelectedIndexChanged += this.comboBoxTheme_SelectedIndexChanged;    // now turn on the handler..

            checkBoxCustomRemoveOriginals.Checked   = discoveryform.screenshotconverter.RemoveOriginal;
            checkBoxCustomMarkHiRes.Checked         = discoveryform.screenshotconverter.MarkHiRes;
            checkBoxCustomEnableScreenshots.Checked = discoveryform.screenshotconverter.AutoConvert;
            checkBoxCustomCopyToClipboard.Checked   = discoveryform.screenshotconverter.CopyToClipboard;

            this.checkBoxCustomRemoveOriginals.CheckedChanged   += new System.EventHandler(this.checkBoxCustomRemoveOriginals_CheckedChanged);
            this.checkBoxCustomMarkHiRes.CheckedChanged         += new System.EventHandler(this.checkBoxCustomMarkHiRes_CheckedChanged);
            this.checkBoxCustomEnableScreenshots.CheckedChanged += new System.EventHandler(this.checkBoxCustomEnableScreenshots_CheckedChanged);
            this.checkBoxCustomCopyToClipboard.CheckedChanged   += new System.EventHandler(this.checkBoxCustomCopyToClipboard_CheckedChanged);

            checkBoxCustomEDSMEDDBDownload.Checked              = EDDConfig.Instance.EDSMEDDBDownload;
            this.checkBoxCustomEDSMEDDBDownload.CheckedChanged += new System.EventHandler(this.checkBoxCustomEDSMDownload_CheckedChanged);
        }
Ejemplo n.º 6
0
        public void ParseJournalFiles(Func <bool> cancelRequested, Action <int, string> updateProgress, bool forceReload = false)
        {
            List <EDCommander> listCommanders = EDCommander.GetList();

            if (frontierfolder != null && frontierfolder.Length != 0 && Directory.Exists(frontierfolder))
            {
                if (watchers.FindIndex(x => x.m_watcherfolder.Equals(frontierfolder)) < 0)
                {
                    System.Diagnostics.Trace.WriteLine(string.Format("New watch on {0}", frontierfolder));
                    MonitorWatcher mw = new MonitorWatcher(frontierfolder);
                    watchers.Add(mw);
                }
            }

            for (int i = 0; i < listCommanders.Count; i++)             // see if new watchers are needed
            {
                string datapath = GetWatchFolder(listCommanders[i].JournalDir);

                if (datapath == null || datapath.Length == 0 || !Directory.Exists(datapath))
                {
                    continue;
                }

                if (watchers.FindIndex(x => x.m_watcherfolder.Equals(datapath)) >= 0) // if we already have a watch on this folder..
                {
                    continue;                                                         // already done
                }
                System.Diagnostics.Trace.WriteLine(string.Format("New watch on {0}", datapath));
                MonitorWatcher mw = new MonitorWatcher(datapath);
                watchers.Add(mw);
            }

            List <int> tobedeleted = new List <int>();

            for (int i = 0; i < watchers.Count; i++)
            {
                bool found = false;
                for (int j = 0; j < listCommanders.Count; j++)          // all commanders, see if this watch folder is present
                {
                    found |= watchers[i].m_watcherfolder.Equals(GetWatchFolder(listCommanders[j].JournalDir));
                }

                if (!found)
                {
                    tobedeleted.Add(i);
                }
            }

            foreach (int i in tobedeleted)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("Delete watch on {0}", watchers[i].m_watcherfolder));
                MonitorWatcher mw = watchers[i];
                mw.StopMonitor();          // just in case
                watchers.Remove(mw);
            }

            for (int i = 0; i < watchers.Count; i++)                                         // parse files of all folders being watched
            {
                watchers[i].ParseJournalFiles(cancelRequested, updateProgress, forceReload); // may create new commanders at the end, but won't need any new watchers, because they will obv be in the same folder
            }
        }
Ejemplo n.º 7
0
 public void UpdateCommandersListBox()
 {
     dataGridViewCommanders.DataSource = null;
     dataGridViewCommanders.DataSource = EDCommander.GetList();
     dataGridViewCommanders.Update();
 }