public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; sync = new EDSMSync(_discoveryForm); var db = new SQLiteDBClass(); defaultColour = db.GetSettingInt("DefaultMap", Color.Red.ToArgb()); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; db = new SQLiteDBClass(); string ScreenshotsDirdefault = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\Frontier Developments\\Elite Dangerous"; string OutputDirdefault = ScreenshotsDirdefault + "\\Converted"; try { comboBoxFormat.SelectedIndex = db.GetSettingInt("ImageHandlerFormatNr", 0); } catch { } try { comboBoxFileNameFormat.SelectedIndex = db.GetSettingInt("comboBoxFileNameFormat", 0); } catch {} textBoxFileNameExample.Text = CreateFileName("Sol", "Screenshot_0000.bmp"); checkBoxAutoConvert.Checked = db.GetSettingBool("ImageHandlerAutoconvert", false); checkBoxRemove.Checked = db.GetSettingBool("checkBoxRemove", false); textBoxOutputDir.Text = db.GetSettingString("ImageHandlerOutputDir", OutputDirdefault); textBoxScreenshotsDir.Text = db.GetSettingString("ImageHandlerScreenshotsDir", ScreenshotsDirdefault); }
public FormSagCarinaMission(EDDiscoveryForm frm) { _eddiscoveryForm = frm; InitializeComponent(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; string ScreenshotsDirdefault = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Frontier Developments", "Elite Dangerous"); string OutputDirdefault = Path.Combine(ScreenshotsDirdefault, "Converted"); try { comboBoxFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("ImageHandlerFormatNr", 0); } catch { } try { comboBoxFileNameFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxFileNameFormat", 0); } catch { } try { comboBoxSubFolder.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxSubFolder", 0); } catch { } try { comboBoxScanFor.Enabled = false; // to prevent the select change from actually doing any work here comboBoxScanFor.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxScanFor", 0); comboBoxScanFor.Enabled = true; } catch { } checkBoxAutoConvert.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerAutoconvert", false); checkBoxRemove.Checked = SQLiteDBClass.GetSettingBool("checkBoxRemove", false); checkBoxHires.Checked = SQLiteDBClass.GetSettingBool("checkBoxHires", false); textBoxOutputDir.Text = SQLiteDBClass.GetSettingString("ImageHandlerOutputDir", OutputDirdefault); textBoxScreenshotsDir.Text = SQLiteDBClass.GetSettingString("ImageHandlerScreenshotsDir", ScreenshotsDirdefault); checkBoxCopyClipboard.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerClipboard", false); checkBoxPreview.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerPreview", false); checkBoxCropImage.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerCropImage", false); // fires the checked handler which sets the readonly mode of the controls numericUpDownTop.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropTop", 0); numericUpDownLeft.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropLeft", 0); numericUpDownWidth.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropWidth", 0); numericUpDownHeight.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropHeight", 0); textBoxFileNameExample.Text = CreateFileName("Sol", "HighResScreenshot_0000.bmp", comboBoxFileNameFormat.SelectedIndex, checkBoxHires.Checked); numericUpDownTop.Enabled = numericUpDownWidth.Enabled = numericUpDownLeft.Enabled = numericUpDownHeight.Enabled = checkBoxCropImage.Checked; this.initialized = true; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; dataGridViewJournal.MakeDoubleBuffered(); dataGridViewJournal.DefaultCellStyle.WrapMode = DataGridViewTriState.True; //does not seem to work well - keep for ref. dataGridViewJournal.Columns[JournalHistoryColumns.Text].DefaultCellStyle.WrapMode = DataGridViewTriState.True; //dataGridViewJournal.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; cfs.Changed += EventFilterChanged; TravelHistoryFilter.InitaliseComboBox(comboBoxJournalWindow, "JournalTimeHistory"); }
public GameSettings(EDDiscoveryForm parent) { _parent = parent; //Load AppConfig LoadAppConfig(); //Set up some filewatchers, If user changes config its reflected here WatcherAppDataSettings(); //Currently disabled as we only check Verbose logging and that cant be changed from the game //Check and Request for Verbose Logging CheckAndRequestVerboseLogging(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; fromupdatetimer = new System.Windows.Forms.Timer(); fromupdatetimer.Interval = 500; fromupdatetimer.Tick += FromUpdateTick; toupdatetimer = new System.Windows.Forms.Timer(); toupdatetimer.Interval = 500; toupdatetimer.Tick += ToUpdateTick; textBox_From.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete); textBox_To.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete); }
public void InitForm(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; comboBox_TextBorder.DataSource = EDDTheme.TextboxBorderStyles; comboBox_ButtonStyle.DataSource = EDDTheme.ButtonStyles; SetPanel(panel_theme1, "Form Back Colour", EDDTheme.Settings.CI.form); // using tag, and tool tips, hook up patches to enum SetPanel(panel_theme2, "Text box Back Colour", EDDTheme.Settings.CI.textbox_back); SetPanel(panel_theme3, "Text box Text Colour", EDDTheme.Settings.CI.textbox_fore); SetPanel(panel_theme4, "Text box Highlight Colour", EDDTheme.Settings.CI.textbox_highlight); SetPanel(panel_theme15, "Text box Success Colour", EDDTheme.Settings.CI.textbox_success); SetPanel(panel_theme5, "Button Back Colour", EDDTheme.Settings.CI.button_back); SetPanel(panel_theme6, "Button Text Colour", EDDTheme.Settings.CI.button_text); SetPanel(panel_theme7, "Grid Border Back Colour", EDDTheme.Settings.CI.grid_borderback); SetPanel(panel_theme8, "Grid Border Text Colour", EDDTheme.Settings.CI.grid_bordertext); SetPanel(panel_theme9, "Grid Cell Back Colour", EDDTheme.Settings.CI.grid_cellbackground); SetPanel(panel_theme10, "Grid Cell Text Colour", EDDTheme.Settings.CI.grid_celltext); SetPanel(panel_theme11, "Menu Back Colour", EDDTheme.Settings.CI.menu_back); SetPanel(panel_theme12, "Menu Text Colour", EDDTheme.Settings.CI.menu_fore); SetPanel(panel_theme13, "Visited system without known position", EDDTheme.Settings.CI.travelgrid_nonvisted); SetPanel(panel_theme14, "Visited system with coordinates", EDDTheme.Settings.CI.travelgrid_visited); SetPanel(panel_theme16, "Check Box Text Colour", EDDTheme.Settings.CI.checkbox); SetPanel(panel_theme17, "Label Text Colour", EDDTheme.Settings.CI.label); SetPanel(panel_theme18, "Group box Back Colour", EDDTheme.Settings.CI.group_back); SetPanel(panel_theme19, "Group box Text Colour", EDDTheme.Settings.CI.group_text); SetPanel(panel_theme30, "Text Box Border Colour", EDDTheme.Settings.CI.textbox_border); SetPanel(panel_theme31, "Button Border Colour", EDDTheme.Settings.CI.button_border); SetPanel(panel_theme32, "Grid Border Line Colour", EDDTheme.Settings.CI.grid_borderlines); SetPanel(panel_theme33, "Group box Border Line Colour", EDDTheme.Settings.CI.group_borderlines); SetPanel(panel_theme35, "Tab Control Border Line Colour", EDDTheme.Settings.CI.tabcontrol_borderlines); SetPanel(panel_theme40, "Text Box Scroll Bar Slider Colour", EDDTheme.Settings.CI.textbox_sliderback); SetPanel(panel_theme41, "Text Box Scroll Bar Arrow Colour", EDDTheme.Settings.CI.textbox_scrollarrow); SetPanel(panel_theme42, "Text Box Scroll Bar Button Colour", EDDTheme.Settings.CI.textbox_scrollbutton); SetPanel(panel_theme43, "Grid Scroll Bar Slider Colour", EDDTheme.Settings.CI.grid_sliderback); SetPanel(panel_theme44, "Grid Scroll Bar Arrow Colour", EDDTheme.Settings.CI.grid_scrollarrow); SetPanel(panel_theme45, "Grid Scroll Bar Button Colour", EDDTheme.Settings.CI.grid_scrollbutton); SetPanel(panel_theme50, "Menu Dropdown Back Colour", EDDTheme.Settings.CI.menu_dropdownback); SetPanel(panel_theme51, "Menu Dropdown Text Colour", EDDTheme.Settings.CI.menu_dropdownfore); SetPanel(panel_theme60, "Tool Strip Back Colour", EDDTheme.Settings.CI.toolstrip_back); SetPanel(panel_theme61, "Tool Strip Border Colour", EDDTheme.Settings.CI.toolstrip_border); SetPanel(panel_theme62, "Tool Strip Checked Colour", EDDTheme.Settings.CI.toolstrip_buttonchecked); SetPanel(panel_theme70, "Check Box Tick Color", EDDTheme.Settings.CI.checkbox_tick ); SetPanel(panel_theme71, "S-Panel Text Colour", EDDTheme.Settings.CI.s_panel); UpdatePatchesEtc(); trackBar_theme_opacity.Value = (int)_discoveryForm.theme.Opacity; comboBox_TextBorder.SelectedItem = _discoveryForm.theme.TextBlockBorderStyle; comboBox_ButtonStyle.SelectedItem = _discoveryForm.theme.ButtonStyle; }
static void Run() { using (EDDiscoveryForm mainform = new EDDiscoveryForm()) { using (SplashForm splash = new SplashForm(mainform)) { using (ApplicationContext context = new ApplicationContext(splash)) { splash.Context = context; splash.Init(); Application.Run(context); } } } }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; db = new SQLiteDBClass(); string ScreenshotsDirdefault = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\Frontier Developments\\Elite Dangerous"; string OutputDirdefault = ScreenshotsDirdefault + "\\Converted"; comboBoxFormat.SelectedIndex = db.GetSettingInt("ImageHandlerFormatNr", 0); checkBoxAutoConvert.Checked = db.GetSettingBool("ImageHandlerAutoconvert", false); textBoxOutputDir.Text = db.GetSettingString("ImageHandlerOutputDir", OutputDirdefault); textBoxScreenshotsDir.Text = db.GetSettingString("ImageHandlerScreenshotsDir", ScreenshotsDirdefault); StartWatcher(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; userControlTravelGrid.Init(_discoveryForm, userControlTravelGrid, 0); // primary first instance - this registers with events in discoveryform to get info // then this display, to update its own controls.. userControlTravelGrid.OnChangedSelection += ChangedSelection; // and if the user clicks on something userControlTravelGrid.OnPopOut += () => { _discoveryForm.PopOuts.PopOut(PopOutControl.PopOuts.TravelGrid); }; userControlTravelGrid.OnKeyDownInCell += OnKeyDownInCell; userControlTravelGrid.ExtraIcons(true, true); TabConfigure(tabStripBottom, "Bottom", 1000); // codes are used to save info, 0 = primary (journal/travelgrid), 1..N are popups, these are embedded UCs TabConfigure(tabStripBottomRight, "Bottom-Right", 1001); TabConfigure(tabStripMiddleRight, "Middle-Right", 1002); TabConfigure(tabStripTopRight, "Top-Right", 1003); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; ResetThemeList(); SetEntryThemeComboBox(); textBoxHomeSystem.SetAutoCompletor(SystemClassDB.ReturnSystemListForAutoComplete); comboBoxTheme.ItemHeight = 20; btnDeleteCommander.Enabled = EDCommander.NumberOfCommanders > 1; comboBoxClickThruKey.Items = KeyObjectExtensions.KeyListString(inclshifts: true); comboBoxClickThruKey.SelectedItem = EDDConfig.Instance.ClickThruKey.VKeyToString(); comboBoxClickThruKey.SelectedIndexChanged += comboBoxClickThruKey_SelectedIndexChanged; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; _savedRoutes = SavedRouteClass.GetAllSavedRoutes(); foreach (var initroute in InitialRoutes) { if (!_savedRoutes.Any(r => r.Name == initroute.Name)) { initroute.Add(); _savedRoutes.Add(initroute); } } UpdateComboBox(); _currentRoute = new SavedRouteClass(""); edsm = new EDSMClass(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; _savedRoutes = SavedRouteClass.GetAllSavedRoutes(); foreach (var initroute in InitialRoutes) { if (!_savedRoutes.Any(r => r.Name == initroute.Name || r.Name == "\x7F" + initroute.Name)) { initroute.Add(); _savedRoutes.Add(initroute); } } _savedRoutes = _savedRoutes.Where(r => !r.Name.StartsWith("\x7F")).ToList(); UpdateComboBox(); _currentRoute = new SavedRouteClass(""); edsm = new EDSMClass(); }
public static bool SendEDDNEvents(EDDiscoveryForm frm, IEnumerable<HistoryEntry> helist) { foreach (HistoryEntry he in helist) { hlscanunsyncedlist.Enqueue(he); } hlscanevent.Set(); // Start the sync thread if it's not already running if (Interlocked.CompareExchange(ref _running, 1, 0) == 0) { Exit = false; mainForm = frm; ThreadEDDNSync = new System.Threading.Thread(new System.Threading.ThreadStart(SyncThread)); ThreadEDDNSync.Name = "EDDN Sync"; ThreadEDDNSync.IsBackground = true; ThreadEDDNSync.Start(); } return true; }
public SystemViewForm(EDDiscoveryForm frm) { _eddiscoveryForm = frm; _systemNames = frm.SystemNames; InitializeComponent(); }
public EDSMSync(EDDiscoveryForm frm) { mainForm = frm; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; FreezeTrilaterationUI(); edsm = new EDSMClass(); edsm.apiKey = EDDiscoveryForm.EDDConfig.CurrentCommander.APIKey; edsm.commanderName = EDDiscoveryForm.EDDConfig.CurrentCommander.Name; SetTriStatus("Press Start New"); }
internal long GetNewSystems(EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress) { string lstsyst; DateTime lstsystdate; // First system in EDSM is from 2015-05-01 00:39:40 DateTime gammadate = new DateTime(2015, 5, 1, 0, 0, 0, DateTimeKind.Utc); bool outoforder = SQLiteConnectionSystem.GetSettingBool("EDSMSystemsOutOfOrder", true); if (SystemClass.IsSystemsTableEmpty()) { lstsystdate = gammadate; } else { // Get the most recent modify time returned from EDSM DateTime lastmod = outoforder ? SystemClass.GetLastSystemModifiedTime() : SystemClass.GetLastSystemModifiedTimeFast(); lstsystdate = lastmod - TimeSpan.FromSeconds(1); if (lstsystdate < gammadate) { lstsystdate = gammadate; } } lstsyst = lstsystdate.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); Console.WriteLine("EDSM Check date: " + lstsyst); long updates = 0; while (lstsystdate < DateTime.UtcNow) { if (cancelRequested()) return updates; DateTime enddate = lstsystdate + TimeSpan.FromHours(12); if (enddate > DateTime.UtcNow) { enddate = DateTime.UtcNow; } discoveryform.LogLine($"Downloading systems from {lstsystdate.ToLocalTime().ToString()} to {enddate.ToLocalTime().ToString()}"); reportProgress(-1, "Requesting systems from EDSM"); string json = null; try { json = RequestSystems(lstsystdate, enddate); } catch (WebException ex) { reportProgress(-1, $"EDSM request failed"); if (ex.Status == WebExceptionStatus.ProtocolError && ex.Response != null && ex.Response is HttpWebResponse) { string status = ((HttpWebResponse)ex.Response).StatusDescription; discoveryform.LogLine($"Download of EDSM systems from the server failed ({status}), will try next time program is run"); } else { discoveryform.LogLine($"Download of EDSM systems from the server failed ({ex.Status.ToString()}), will try next time program is run"); } break; } catch (Exception ex) { reportProgress(-1, $"EDSM request failed"); discoveryform.LogLine($"Download of EDSM systems from the server failed ({ex.Message}), will try next time program is run"); break; } if (json == null) { reportProgress(-1, "EDSM request failed"); discoveryform.LogLine("Download of EDSM systems from the server failed (no data returned), will try next time program is run"); break; } updates += SystemClass.ParseEDSMUpdateSystemsString(json, ref lstsyst, ref outoforder, false, discoveryform, cancelRequested, reportProgress, false); lstsystdate += TimeSpan.FromHours(12); } discoveryform.LogLine($"System download complete"); return updates; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; edsc = new EDSCClass(); // Init here to avoid UI editor errors. }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; ResetThemeList(); SetEntryThemeComboBox(); textBoxHomeSystem.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; FreezeTrilaterationUI(); edsm = new EDSMClass(); var db = new SQLiteDBClass(); edsm.apiKey = db.GetSettingString("EDSMApiKey", ""); edsm.commanderName = db.GetSettingString("CommanderName", ""); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; _discoveryForm.OnNewTarget += RefreshTargetDisplay; usercontrolsforms = new UserControlFormList(); richTextBoxNote.TextBoxChanged += richTextBoxNote_TextChanged; LoadCommandersListBox(); comboBoxCustomPopOut.Enabled = false; comboBoxCustomPopOut.Items.AddRange(popoutbuttonlist); comboBoxCustomPopOut.SelectedIndex = 0; comboBoxCustomPopOut.Enabled = true; userControlTravelGrid.Init(_discoveryForm, 0); // primary first instance - this registers with events in discoveryform to get info // then this display, to update its own controls.. userControlTravelGrid.OnRedisplay += UpdatedDisplay; // call back when you've added a new entry.. userControlTravelGrid.OnAddedNewEntry += UpdatedWithAddNewEntry; // call back when you've added a new entry.. userControlTravelGrid.OnChangedSelection += ChangedSelection; // and if the user clicks on something userControlTravelGrid.OnResort += Resort; // and if he or she resorts userControlTravelGrid.OnPopOut += TGPopOut; TabConfigure(tabStripBottom,1000); // codes are used to save info, 0 = primary (journal/travelgrid), 1..N are popups, these are embedded UCs TabConfigure(tabStripBottomRight,1001); TabConfigure(tabStripMiddleRight,1002); csd.Init(_discoveryForm); csd.OnOtherStarDistances += OtherStarDistances; csd.OnNewStarList += NewStarListComputed; textBoxTarget.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete); buttonSync.Enabled = EDDiscoveryForm.EDDConfig.CurrentCommander.SyncToEdsm | EDDiscoveryForm.EDDConfig.CurrentCommander.SyncFromEdsm; }
public static bool SendEDDNEvents(EDDiscoveryForm frm, params HistoryEntry[] helist) { return SendEDDNEvents(frm, (IEnumerable<HistoryEntry>)helist); }
public static bool SendEDDNEvent(EDDiscoveryForm frm, HistoryEntry helist) { return SendEDDNEvents(frm, new[] { helist }); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; edsm = new EDSMClass(); _currentRoute = new SavedRouteClass(""); _savedRoutes = new List<SavedRouteClass>(); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; }
public static void showBookmarkForm( EDDiscoveryForm discoveryForm, ISystem cursystem, BookmarkClass curbookmark, bool notedsystem) { // try and find the associated bookmark.. BookmarkClass bkmark = (curbookmark != null) ? curbookmark : BookmarkClass.bookmarks.Find(x => x.StarName != null && x.StarName.Equals(cursystem.name)); SystemNoteClass sn = (cursystem != null) ? SystemNoteClass.GetNoteOnSystem(cursystem.name, cursystem.id_edsm) : null; string note = (sn != null) ? sn.Note : ""; BookmarkForm frm = new BookmarkForm(); if (notedsystem && bkmark == null) // note on a system { long targetid = TargetClass.GetTargetNotedSystem(); // who is the target of a noted system (0=none) long noteid = sn.id; frm.InitialisePos(cursystem.x, cursystem.y, cursystem.z); frm.NotedSystem(cursystem.name, note, noteid == targetid); // note may be passed in null frm.ShowDialog(); if ((frm.IsTarget && targetid != noteid) || (!frm.IsTarget && targetid == noteid)) // changed.. { if (frm.IsTarget) { TargetClass.SetTargetNotedSystem(cursystem.name, noteid, cursystem.x, cursystem.y, cursystem.z); } else { TargetClass.ClearTarget(); } } } else { bool regionmarker = false; DateTime tme; long targetid = TargetClass.GetTargetBookmark(); // who is the target of a bookmark (0=none) if (bkmark == null) // new bookmark { frm.InitialisePos(cursystem.x, cursystem.y, cursystem.z); tme = DateTime.Now; frm.NewSystemBookmark(cursystem.name, note, tme.ToString()); } else // update bookmark { frm.InitialisePos(bkmark.x, bkmark.y, bkmark.z); regionmarker = bkmark.isRegion; tme = bkmark.Time; frm.Update(regionmarker ? bkmark.Heading : bkmark.StarName, note, bkmark.Note, tme.ToString(), regionmarker, targetid == bkmark.id); } DialogResult res = frm.ShowDialog(); if (res == DialogResult.OK) { BookmarkClass newcls = new BookmarkClass(); if (regionmarker) { newcls.Heading = frm.StarHeading; } else { newcls.StarName = frm.StarHeading; } newcls.x = double.Parse(frm.x); newcls.y = double.Parse(frm.y); newcls.z = double.Parse(frm.z); newcls.Time = tme; newcls.Note = frm.Notes; if (bkmark != null) { newcls.id = bkmark.id; newcls.Update(); } else { newcls.Add(); } if ((frm.IsTarget && targetid != newcls.id) || (!frm.IsTarget && targetid == newcls.id)) // changed.. { if (frm.IsTarget) { TargetClass.SetTargetBookmark(regionmarker ? ("RM:" + newcls.Heading) : newcls.StarName, newcls.id, newcls.x, newcls.y, newcls.z); } else { TargetClass.ClearTarget(); } } } else if (res == DialogResult.Abort && bkmark != null) { if (targetid == bkmark.id) { TargetClass.ClearTarget(); } bkmark.Delete(); } } discoveryForm.NewTargetSet(); }
public void InitForm(EDDiscoveryForm frm) { edForm = frm; }
public static void setTargetSystem(EDDiscoveryForm _discoveryForm, String sn) { setTargetSystem(_discoveryForm, sn, true); }
public static void setTargetSystem(EDDiscoveryForm _discoveryForm, String sn, Boolean prompt) { if (string.IsNullOrWhiteSpace(sn)) { return; } ISystem sc = _discoveryForm.history.FindSystem(sn); string msgboxtext = null; if (sc != null && sc.HasCoordinate) { SystemNoteClass nc = SystemNoteClass.GetNoteOnSystem(sc.name, sc.id_edsm); // has it got a note? if (nc != null) { TargetClass.SetTargetNotedSystem(sc.name, nc.id, sc.x, sc.y, sc.z); msgboxtext = "Target set on system with note " + sc.name; } else { BookmarkClass bk = BookmarkClass.FindBookmarkOnSystem(sn); // has it been bookmarked? if (bk != null) { TargetClass.SetTargetBookmark(sc.name, bk.id, bk.x, bk.y, bk.z); msgboxtext = "Target set on booked marked system " + sc.name; } else { bool createbookmark = false; if ((prompt && ExtendedControls.MessageBoxTheme.Show("Make a bookmark on " + sc.name + " and set as target?", "Make Bookmark", MessageBoxButtons.OKCancel) == DialogResult.OK) || !prompt) { createbookmark = true; } if (createbookmark) { BookmarkClass newbk = new BookmarkClass(); newbk.StarName = sn; newbk.x = sc.x; newbk.y = sc.y; newbk.z = sc.z; newbk.Time = DateTime.Now; newbk.Note = ""; newbk.Add(); TargetClass.SetTargetBookmark(sc.name, newbk.id, newbk.x, newbk.y, newbk.z); } } } } else { if (sn.Length > 2 && sn.Substring(0, 2).Equals("G:")) { sn = sn.Substring(2, sn.Length - 2); } GalacticMapObject gmo = _discoveryForm.galacticMapping.Find(sn, true, true); // ignore if its off, find any part of string, find if disabled if (gmo != null) { TargetClass.SetTargetGMO("G:" + gmo.name, gmo.id, gmo.points[0].X, gmo.points[0].Y, gmo.points[0].Z); msgboxtext = "Target set on galaxy object " + gmo.name; } else { msgboxtext = "Unknown system, system is without co-ordinates or galaxy object not found"; } } _discoveryForm.NewTargetSet(); // tells everyone who cares a new target was set if (msgboxtext != null && prompt) { ExtendedControls.MessageBoxTheme.Show(msgboxtext, "Create a target", MessageBoxButtons.OK); } }
public NetLogClass(EDDiscoveryForm ds) { }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; fromupdatetimer = new System.Windows.Forms.Timer(); fromupdatetimer.Interval = 500; fromupdatetimer.Tick += FromUpdateTick; toupdatetimer = new System.Windows.Forms.Timer(); toupdatetimer.Interval = 500; toupdatetimer.Tick += ToUpdateTick; }
// Initialize everything on the UI thread, and report+die for any problems or SwitchContext from SplashForm to EDDiscoveryForm. private void InitialiseEDD(object sender, EventArgs e) { var tim = (Timer)sender; tim?.Stop(); var launchArg = ((EDDFormLaunchArgs)tim?.Tag)?.Clone() ?? new EDDFormLaunchArgs(); tim?.Dispose(); EDDiscoveryForm EDDMainForm = null; try { System.Threading.Thread.CurrentThread.Name = "EDD Main Thread"; EDDMainForm = new EDDiscoveryForm(); SetLoadingMsg("Initialising Databases"); UserDatabase.Instance.Name = "UserDB"; UserDatabase.Instance.MinThreads = 1; UserDatabase.Instance.MaxThreads = 2; UserDatabase.Instance.MultiThreaded = true; // starts up the threads SystemsDatabase.Instance.Name = "SystemDB"; SystemsDatabase.Instance.MinThreads = 1; SystemsDatabase.Instance.MaxThreads = 8; SystemsDatabase.Instance.MultiThreaded = true; // starts up the threads try { UserDatabase.Instance.Initialize(); } catch (Exception ex) { EliteDangerousCore.DB.UserDatabase.Instance.ClearDown(); // need everything closed down System.Windows.Forms.MessageBox.Show("Error: User DB is corrupt at " + EliteDangerousCore.EliteConfigInstance.InstanceOptions.UserDatabasePath + Environment.NewLine + Environment.NewLine + "Database is unusable. Use safe mode to remove it and start again. All user settings will be lost" + Environment.NewLine + Environment.NewLine + ex.Message.ToString(), "User DB corrupt", System.Windows.Forms.MessageBoxButtons.OK); SwitchContext(new SafeModeForm(false)); return; } try { SystemsDatabase.Instance.Initialize(); } catch (Exception ex) { EliteDangerousCore.DB.UserDatabase.Instance.ClearDown(); // need everything closed down EliteDangerousCore.DB.SystemsDatabase.Instance.ClearDown(); System.Windows.Forms.MessageBox.Show("Error: System DB is corrupt at " + EliteDangerousCore.EliteConfigInstance.InstanceOptions.SystemDatabasePath + Environment.NewLine + Environment.NewLine + "Database is unusable. Use safe mode to remove it and start again. User settings will be retained" + Environment.NewLine + Environment.NewLine + ex.Message.ToString(), "System DB corrupt", System.Windows.Forms.MessageBoxButtons.OK); SwitchContext(new SafeModeForm(false)); return; } EDDOptions.Instance.NoWindowReposition |= launchArg.PositionReset; EDDOptions.Instance.NoTheme |= launchArg.ThemeReset; EDDOptions.Instance.TabsReset |= launchArg.TabsReset; EDDOptions.Instance.ResetLanguage |= launchArg.ResetLang; SetLoadingMsg("Starting EDD"); EDDMainForm.Init(SetLoadingMsg); // call the init function, which will initialize the eddiscovery system if (Environment.OSVersion.Platform == PlatformID.Win32NT) { NativeMethods.STARTUPINFO_I si = new NativeMethods.STARTUPINFO_I(); UnsafeNativeMethods.GetStartupInfo(si); // duplicate of form.cs WmCreate check of code. if ((si.dwFlags & NativeMethods.STARTF_USESHOWWINDOW) != 0) { if (si.wShowWindow == NativeMethods.SW_MINIMIZE || si.wShowWindow == NativeMethods.SW_SHOWMINNOACTIVE) { EDDOptions.Instance.MinimiseOnOpen = true; } else if (si.wShowWindow == NativeMethods.SW_SHOWMAXIMIZED || si.wShowWindow == NativeMethods.SW_MAXIMIZE) { EDDOptions.Instance.MaximiseOnOpen = true; } } } SetLoadingMsg("Starting Program"); SwitchContext(EDDMainForm); // Ignition, and liftoff! } catch (Exception ex) { // There's so many ways that things could go wrong during init; let's fail for everything! BaseUtils.ExceptionForm.ShowException(ex, "A fatal exception was encountered while initializing EDDiscovery.", Properties.Resources.URLProjectFeedback, isFatal: true, parent: MainForm); EDDMainForm?.Dispose(); } }
//EDDiscovery Init calls this public void CreateTabs(EDDiscoveryForm edf) { eddiscovery = edf; string majortabs = SQLiteConnectionUser.GetSettingString("MajorTabControlList", ""); string[] majortabnames = null; int[] tabctrl; if (!majortabs.RestoreArrayFromString(out tabctrl) || tabctrl.Length == 0 || (tabctrl.Length % 2) != 1) // need it odd as we have an index tab as first { tabctrl = new int[] { 0, -1, 0, // reset.. (int)PanelInformation.PanelIDs.Route, 0, (int)PanelInformation.PanelIDs.Expedition, 0, (int)PanelInformation.PanelIDs.Settings, 0, (int)PanelInformation.PanelIDs.PanelSelector, 0 }; } else { majortabnames = SQLiteConnectionUser.GetSettingString("MajorTabControlName", "").Replace("!error!", "+").Split(';'); // if its okay, load the name list } TabPage history = TabPages[0]; // remember history page, remove TabPages.Clear(); UserControls.UserControlHistory uch = history.Controls[0] as UserControls.UserControlHistory; travelgrid = uch.GetTravelGrid; // remember travel grid globally for later bool donehistory = false; for (int i = 1; i < tabctrl.Length; i += 2) { int nameindex = (i - 1) / 2; string name = majortabnames != null && nameindex < majortabnames.Length && majortabnames[nameindex].Length > 0 ? majortabnames[nameindex] : null; if (tabctrl[i] != -1) // this means UserControlHistory, which is a special one { try { PanelInformation.PanelIDs p = (PanelInformation.PanelIDs)tabctrl[i]; CreateTab(p, name, tabctrl[i + 1], TabPages.Count, false); // no need the theme, will be themed as part of overall load // may fail if p is crap, then just ignore } catch { } // paranoia in case tabctrl number is crappy. } else if (!donehistory) // just double check for repeats { if (name != null) // set name. if set. { history.Text = name; } TabPages.Add(history); // add back in right place donehistory = true; } } if (!donehistory) // just in case its missing.. be something up if it is. { TabPages.Add(history); // add back in right place } uch.Dock = System.Windows.Forms.DockStyle.Fill; // Crucial ! uccb has to be fill, even though the VS designer does not indicate you need to set it.. copied from designer code uch.Location = new System.Drawing.Point(3, 3); uch.Init(eddiscovery, null, UserControls.UserControlCommonBase.DisplayNumberHistoryGrid); // and init at this point with 0 as dn EnsureMajorTabIsPresent(PanelInformation.PanelIDs.PanelSelector, true); // just in case it disappears due to weirdness or debugging if (tabctrl.Length > 0 && tabctrl[0] >= 0 && tabctrl[0] < TabPages.Count) // make sure external data does not crash us { SelectedIndex = tabctrl[0]; } }
public void InitControl(EDDiscoveryForm ed, int displaynumber) { discoveryForm = ed; userControlContainerGrid.Init(ed, ed.TravelControl.GetTravelGrid, displaynumber); // pass in the default TG }
public void InitControl(EDDiscoveryForm discoveryForm, UserControls.UserControlCursorType uctg, int displaynumber) { userControlTrilateration.Init(discoveryForm, uctg, displaynumber); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; FreezeTrilaterationUI(); }
//EDDiscovery Init calls this public void CreateTabs(EDDiscoveryForm edf, bool resettabs, string resetsettings) { eddiscovery = edf; int[] panelids; int[] displaynumbers; int currentlyselectedtab = 0; string majortabs = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(EDDProfiles.Instance.UserControlsPrefix + "MajorTabControlList", ""); string[] majortabnames = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(EDDProfiles.Instance.UserControlsPrefix + "MajorTabControlName", "").Replace("!error!", "+").Split(';'); // if its okay, load the name list while (true) { int[] rawtabctrl; majortabs.RestoreArrayFromString(out rawtabctrl); // string is : selectedtab, [ <PanelID>, <displayno> ].. panelids = rawtabctrl.Where((value, index) => index % 2 != 0).ToArray(); displaynumbers = rawtabctrl.Where((value, index) => index > 0 && index % 2 == 0).ToArray(); if (resettabs || panelids.Length == 0 || panelids.Length != displaynumbers.Length || !panelids.Contains(-1) || !panelids.Contains((int)PanelInformation.PanelIDs.PanelSelector)) { majortabs = resetsettings; majortabnames = null; resettabs = false; } else { if (rawtabctrl[0] > 0 && rawtabctrl[0] < panelids.Length) { currentlyselectedtab = rawtabctrl[0]; } break; } } for (int i = 0; i < panelids.Length; i++) { string name = majortabnames != null && i < majortabnames.Length && majortabnames[i].Length > 0 ? majortabnames[i] : null; try { if (panelids[i] == -1) // marker indicating the special history tab { TabPage p = CreateTab(PanelInformation.PanelIDs.SplitterControl, name ?? "History", displaynumbers[i], TabPages.Count); p.Tag = true; // this marks it as the primary tab.. } else { PanelInformation.PanelIDs p = (PanelInformation.PanelIDs)panelids[i]; CreateTab(p, name, displaynumbers[i], TabPages.Count); // no need the theme, will be themed as part of overall load } } catch (Exception ex) // paranoia in case something crashes it, unlikely, but we want maximum chance the history tab will show { System.Diagnostics.Trace.WriteLine($"Exception caught creating tab {i} ({name}): {ex.ToString()}"); MessageBox.Show($"Report to EDD team - Exception caught creating tab {i} ({name}): {ex.ToString()}"); } } SelectedIndex = currentlyselectedtab; }
internal long GetNewSystems(EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress) { string lstsyst; DateTime lstsystdate; // First system in EDSM is from 2015-05-01 00:39:40 DateTime gammadate = new DateTime(2015, 5, 1, 0, 0, 0, DateTimeKind.Utc); if (SystemClass.GetTotalSystems() == 0) { lstsystdate = gammadate; } else { // Get the most recent modify time returned from EDSM lstsystdate = SystemClass.GetLastSystemModifiedTime() - TimeSpan.FromSeconds(1); if (lstsystdate < gammadate) { lstsystdate = gammadate; } } lstsyst = lstsystdate.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); Console.WriteLine("EDSM Check date: " + lstsyst); long updates = 0; while (lstsystdate < DateTime.UtcNow) { if (cancelRequested()) return updates; DateTime enddate = lstsystdate + TimeSpan.FromHours(12); if (enddate > DateTime.UtcNow) { enddate = DateTime.UtcNow; } discoveryform.LogLine($"Downloading systems from {lstsystdate.ToLocalTime().ToString()} to {enddate.ToLocalTime().ToString()}"); reportProgress(-1, "Requesting systems from EDSM"); string json = RequestSystems(lstsystdate, enddate); if (json == null) { reportProgress(-1, "EDSM request failed"); discoveryform.LogLine("Download of EDSM systems from the server failed, will try next time program is run"); break; } updates += SystemClass.ParseEDSMUpdateSystemsString(json, ref lstsyst, false, discoveryform, cancelRequested, reportProgress, false); lstsystdate += TimeSpan.FromHours(12); } discoveryform.LogLine($"System download complete"); return updates; }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; edsm = new EDSMClass(); }
public PopOutControl(EDDiscoveryForm ed) { discoveryform = ed; usercontrolsforms = new Forms.UserControlFormList(discoveryform); }
public MapManager(bool nowindowreposition,EDDiscoveryForm frm) { _formMap = new FormMap(); _formMap.discoveryForm = frm; _formMap.noWindowReposition = nowindowreposition; }
public void InitControl(EDDiscoveryForm ed, UserControls.UserControlCursorType uctg, int displaynumber) { userControlContainerGrid.Init(ed, uctg, displaynumber); // pass in the default TG }
internal static bool SendTravelLog(EDSMClass edsm, VisitedSystemsClass system, EDDiscoveryForm mainform) { string json; if (!system.HasTravelCoordinates) json = edsm.SetLog(system.Name, system.Time); else json = edsm.SetLogWithPos(system.Name, system.Time, system.X, system.Y, system.Z); if (json != null) { JObject msg = (JObject)JObject.Parse(json); int msgnum = msg["msgnum"].Value<int>(); string msgstr = msg["msg"].Value<string>(); if (msgnum == 100 || msgnum == 401 || msgnum == 402 || msgnum == 403) { system.EDSM_sync = true; system.Update(); return true; } else { if (mainform!=null) mainform.LogLine("EDSM sync ERROR:" + msgnum.ToString() + ":" + msgstr); System.Diagnostics.Trace.WriteLine("Error sync:" + msgnum.ToString() + " : " + system.Name); return false; } } else return false; }
public SystemViewForm(EDDiscoveryForm frm) { _eddiscoveryForm = frm; InitializeComponent(); }