public void Init() { if (!Debugger.IsAttached || EDDConfig.Options.TraceLog) { TraceLog.LogFileWriterException += ex => { LogLineHighlight($"Log Writer Exception: {ex}"); }; } backgroundWorker = new Thread(BackgroundWorkerThread); backgroundWorker.IsBackground = true; backgroundWorker.Name = "Background Worker Thread"; backgroundWorker.Start(); galacticMapping = new GalacticMapping(); EdsmSync = new EDSMSync(this); EdsmLogFetcher = new EDSMLogFetcher(EDCommander.CurrentCmdrID, LogLine); EdsmLogFetcher.OnDownloadedSystems += () => RefreshHistoryAsync(); journalmonitor = new EliteDangerous.EDJournalClass(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += NewEntry; history.CommanderId = EDCommander.CurrentCmdrID; }
public void Init() // ED Discovery calls this during its init { if (!Debugger.IsAttached || EDDOptions.Instance.TraceLog) { TraceLog.LogFileWriterException += ex => { LogLineHighlight($"Log Writer Exception: {ex}"); }; } backgroundWorker = new Thread(BackgroundWorkerThread); backgroundWorker.IsBackground = true; backgroundWorker.Name = "Background Worker Thread"; backgroundWorker.Start(); galacticMapping = new GalacticMapping(); EdsmSync = new EDSMSync(Logger); EdsmLogFetcher = new EDSMLogFetcher(LogLine); EdsmLogFetcher.OnDownloadedSystems += () => RefreshHistoryAsync(); journalmonitor = new EDJournalClass(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += NewEntry; }
public EDDiscoveryForm() { InitializeComponent(); EDDConfig = new EDDConfig(); //_fileTgcSystems = Path.Combine(Tools.GetAppDataDirectory(), "tgcsystems.json"); _fileEDSMDistances = Path.Combine(Tools.GetAppDataDirectory(), "EDSMDistances.json"); string logpath = ""; try { logpath = Path.Combine(Tools.GetAppDataDirectory(), "Log"); if (!Directory.Exists(logpath)) { Directory.CreateDirectory(logpath); } } catch (Exception ex) { Trace.WriteLine($"Unable to create the folder '{logpath}'"); Trace.WriteLine($"Exception: {ex.Message}"); } _edsmSync = new EDSMSync(this); trilaterationControl.InitControl(this); travelHistoryControl1.InitControl(this); imageHandler1.InitControl(this); SystemNames = new AutoCompleteStringCollection(); Map = new EDDiscovery2._3DMap.MapManager(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; sync = new EDSMSync(_discoveryForm); var db = new SQLiteDBClass(); defaultColour = db.GetSettingInt("DefaultMap", Color.Red.ToArgb()); EDSMPushOnly = db.GetSettingBool("EDSMPushOnly", false); optPushOnly.Checked = EDSMPushOnly; optFullSync.Checked = !EDSMPushOnly; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; sync = new EDSMSync(_discoveryForm); var db = new SQLiteDBClass(); defaultMapColour = db.GetSettingInt("DefaultMap", Color.Red.ToArgb()); EDSMSyncTo = db.GetSettingBool("EDSMSyncTo", true); EDSMSyncFrom = db.GetSettingBool("EDSMSyncFrom", true); checkBoxEDSMSyncTo.Checked = EDSMSyncTo; checkBoxEDSMSyncFrom.Checked = EDSMSyncFrom; }
private void StoreUncommittedNote() { if (_uncommittedNoteHistoryEntry != null) { _uncommittedNoteHistoryEntry.CommitSystemNote(); if (EDCommander.Current.SyncToEdsm && _uncommittedNoteHistoryEntry.IsFSDJump) // only send on FSD jumps { EDSMSync.SendComments(_uncommittedNoteHistoryEntry.snc.Name, _uncommittedNoteHistoryEntry.snc.Note, _uncommittedNoteHistoryEntry.snc.EdsmId); } _uncommittedNoteHistoryEntry = null; } }
public void SetJournalSystemNoteText(string text, bool commit, bool sendtoedsm) { if (snc == null || snc.Journalid == 0) // if no system note, or its one on a system, from now on we assign journal system notes only from this IF { snc = SystemNoteClass.MakeSystemNote("", DateTime.Now, System.name, Journalid, System.id_edsm, IsFSDJump); } snc = snc.UpdateNote(text, commit, DateTime.Now, snc.EdsmId, IsFSDJump); // and update info, and update our ref in case it has changed or gone null // remember for EDSM send purposes if its an FSD entry if (snc != null && commit && sendtoedsm && snc.FSDEntry) // if still have a note, and commiting, and send to esdm, and FSD jump { EDSMSync.SendComments(snc.SystemName, snc.Note, snc.EdsmId); } }
// main travel grid has a new entry due to onNewEntry public void UpdatedWithAddNewEntry(HistoryEntry he, HistoryList hl, bool accepted) { try { // try is a bit old, probably do not need it. if (he.IsFSDJump) { int count = _discoveryForm.history.GetVisitsCount(he.System.name); _discoveryForm.LogLine(string.Format("Arrived at system {0} Visit No. {1}", he.System.name, count)); System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.name + " " + count + ":th visit."); if (EDCommander.Current.SyncToEdsm == true) { EDSMSync.SendTravelLog(he); _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEDSMSync); } } hl.SendEDSMStatusInfo(he, true); if (he.ISEDDNMessage && he.AgeOfEntry() < TimeSpan.FromDays(1.0)) { if (EDCommander.Current.SyncToEddn == true) { EDDNSync.SendEDDNEvents(_discoveryForm.LogLine, he); _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEDDNSync); } } if (he.EntryType == JournalTypeEnum.Scan) { if (EDCommander.Current.SyncToEGO) { EDDiscoveryCore.EGO.EGOSync.SendEGOEvents(_discoveryForm.LogLine, he); _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEGOSync); } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("Exception NewPosition: " + ex.Message); System.Diagnostics.Trace.WriteLine("Trace: " + ex.StackTrace); } }
public void UpdatedWithAddNewEntry(HistoryEntry he, HistoryList hl, bool accepted) // main travel grid calls after getting a new entry { try { // try is a bit old, probably do not need it. if (he.IsFSDJump) { int count = _discoveryForm.history.GetVisitsCount(he.System.name); _discoveryForm.LogLine(string.Format("Arrived at system {0} Visit No. {1}", he.System.name, count)); System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.name + " " + count + ":th visit."); if (EDCommander.Current.SyncToEdsm == true) { EDSMSync.SendTravelLog(he); } } if (he.ISEDDNMessage) { if (EDCommander.Current.SyncToEddn == true) { EDDNSync.SendEDDNEvents(_discoveryForm, he); } } if (accepted) // if accepted it on main grid.. { RefreshTargetDisplay(); // tell the target system its changed the latest system if (EDDiscoveryForm.EDDConfig.FocusOnNewSystem) // Move focus to new row { userControlTravelGrid.SelectTopRow(); ShowSystemInformation(userControlTravelGrid.GetCurrentRow); UpdateDependentsWithSelection(); } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("Exception NewPosition: " + ex.Message); System.Diagnostics.Trace.WriteLine("Trace: " + ex.StackTrace); } }
public EDDiscoveryForm() { InitializeComponent(); panel_close.Enabled = false; // no closing until we are ready for it.. tabControl1.Enabled = false; EDDConfig = new EDDConfig(); //_fileTgcSystems = Path.Combine(Tools.GetAppDataDirectory(), "tgcsystems.json"); _fileEDSMDistances = Path.Combine(Tools.GetAppDataDirectory(), "EDSMDistances.json"); string logpath = ""; try { logpath = Path.Combine(Tools.GetAppDataDirectory(), "Log"); if (!Directory.Exists(logpath)) { Directory.CreateDirectory(logpath); } } catch (Exception ex) { Trace.WriteLine($"Unable to create the folder '{logpath}'"); Trace.WriteLine($"Exception: {ex.Message}"); } _edsmSync = new EDSMSync(this); ToolStripManager.Renderer = theme.toolstripRenderer; theme.LoadThemes(); // default themes and ones on disk loaded theme.RestoreSettings(); // theme, remember your saved settings trilaterationControl.InitControl(this); travelHistoryControl1.InitControl(this); imageHandler1.InitControl(this); settings.InitControl(this); routeControl1.InitControl(this); SystemNames = new AutoCompleteStringCollection(); Map = new EDDiscovery2._3DMap.MapManager(); ApplyTheme(false); }