private void StoreSystemNote() { string txt; try { EDSMClass edsm = new EDSMClass(); SQLiteDBClass db = new SQLiteDBClass(); edsm.apiKey = EDDiscoveryForm.EDDConfig.CurrentCommander.APIKey; edsm.commanderName = EDDiscoveryForm.EDDConfig.CurrentCommander.Name; if (currentSysPos == null || currentSysPos.curSystem == null) { return; } txt = richTextBoxNote.Text; if (currentSysPos.curSystem.Note == null) { currentSysPos.curSystem.Note = ""; } if (currentSysPos != null && !txt.Equals(currentSysPos.curSystem.Note)) { SystemNoteClass sn; List <SystemClass> systems = new List <SystemClass>(); if (SQLiteDBClass.globalSystemNotes.ContainsKey(currentSysPos.curSystem.SearchName)) { sn = SQLiteDBClass.globalSystemNotes[currentSysPos.curSystem.SearchName]; sn.Note = txt; sn.Time = DateTime.Now; sn.Update(); } else { sn = new SystemNoteClass(); sn.Name = currentSysPos.curSystem.name; sn.Note = txt; sn.Time = DateTime.Now; sn.Add(); } currentSysPos.curSystem.Note = txt; if (dataGridViewTravel.SelectedCells.Count > 0) // if we have selected (we should!) { dataGridViewTravel.Rows[dataGridViewTravel.SelectedCells[0].OwningRow.Index].Cells[3].Value = txt; } if (edsm.commanderName == null || edsm.apiKey == null) { return; } if (edsm.commanderName.Length > 1 && edsm.apiKey.Length > 1) { edsm.SetComment(sn); } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("Exception : " + ex.Message); System.Diagnostics.Trace.WriteLine(ex.StackTrace); LogTextHighlight("Exception : " + ex.Message); LogTextHighlight(ex.StackTrace); } }
private void StoreSystemNote() { string txt; try { EDSMClass edsm = new EDSMClass(); SQLiteDBClass db = new SQLiteDBClass(); edsm.apiKey = EDDiscoveryForm.EDDConfig.CurrentCommander.APIKey; edsm.commanderName = EDDiscoveryForm.EDDConfig.CurrentCommander.Name; if (currentSysPos == null || currentSysPos.curSystem == null) { return; } //SystemPosition sp = (SystemPosition)dataGridView1.Rows[lastRowIndex].Cells[1].Tag; txt = richTextBoxNote.Text; if (currentSysPos.curSystem.Note == null) { currentSysPos.curSystem.Note = ""; } if (currentSysPos != null && !txt.Equals(currentSysPos.curSystem.Note)) { SystemNoteClass sn; List <SystemClass> systems = new List <SystemClass>(); if (SQLiteDBClass.globalSystemNotes.ContainsKey(currentSysPos.curSystem.SearchName)) { sn = SQLiteDBClass.globalSystemNotes[currentSysPos.curSystem.SearchName]; sn.Note = txt; sn.Time = DateTime.Now; sn.Update(); } else { sn = new SystemNoteClass(); sn.Name = currentSysPos.curSystem.name; sn.Note = txt; sn.Time = DateTime.Now; sn.Add(); } currentSysPos.curSystem.Note = txt; dataGridView1.Rows[lastRowIndex].Cells[3].Value = txt; if (edsm.commanderName == null || edsm.apiKey == null) { return; } if (edsm.commanderName.Length > 1 && edsm.apiKey.Length > 1) { edsm.SetComment(sn); } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("Exception : " + ex.Message); System.Diagnostics.Trace.WriteLine(ex.StackTrace); LogText("Exception : " + ex.Message, Color.Red); LogText(ex.StackTrace, Color.Red); } }