public override void Init() { dataGridView.CheckEDSM = true; dataGridView.MakeDoubleBuffered(); dataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; dataGridView.RowTemplate.Height = 26; dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx BaseUtils.Translator.Instance.Translate(this, new Control[] { }); BaseUtils.Translator.Instance.Translate(toolTip, this); dataGridView.Init(discoveryform); itemlist = MaterialCommodityData.GetAll(); Array.Sort(itemlist, (left, right) => left.Name.CompareTo(right.Name)); var list = (from x in itemlist select x.Name + " (" + x.Category + ", " + x.Type + ((x.Rarity) ? ", Rare Commodity".Tx(this):"") + ")"); comboBoxCustomCM1.Items.AddRange(list); comboBoxCustomCM1.SelectedIndex = Math.Min(SQLiteConnectionUser.GetSettingInt(DbCM1, 0), list.Count() - 1); comboBoxCustomCM2.Items.Add("----"); comboBoxCustomCM2.Items.AddRange(list); comboBoxCustomCM2.SelectedIndex = Math.Min(SQLiteConnectionUser.GetSettingInt(DbCM2, 0), list.Count() - 1); comboBoxCustomCMANDOR.Items.AddRange(new string[] { "AND".Tx(this), "OR".Tx(this) }); comboBoxCustomCMANDOR.SelectedIndex = SQLiteConnectionUser.GetSettingInt(DbCMANDOR, 0); }
public void Update(bool write = true, SQLiteConnectionUser conn = null) // call at start to populate above { try { useNotifyIcon = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn); orderrowsinverted = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn); minimizeToNotifyIcon = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn); keepOnTop = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn); displayUTC = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn); clearCommodities = SQLiteConnectionUser.GetSettingBool("ClearCommodities", false, conn); clearMaterials = SQLiteConnectionUser.GetSettingBool("ClearMaterials", false, conn); autoLoadPopouts = SQLiteConnectionUser.GetSettingBool("AutoLoadPopouts", false, conn); autoSavePopouts = SQLiteConnectionUser.GetSettingBool("AutoSavePopouts", false, conn); defaultvoicedevice = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn); defaultwavedevice = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn); showuievents = SQLiteConnectionUser.GetSettingBool("ShowUIEvents", false, conn); clickthrukey = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn); edsmeddbdownload = SQLiteConnectionUser.GetSettingBool("EDSMEDDBDownloadData", true, conn); // this goes with the USER on purpose, so its kept over a system db delete edsmgridids = SQLiteConnectionSystem.GetSettingString("EDSMGridIDs", "All"); // from system database, not user, to keep setting with system data fullhistoryloaddaylimit = SQLiteConnectionUser.GetSettingInt("FullHistoryLoadDayLimit", 0); EliteDangerousCore.EDCommander.Load(write, conn); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message); System.Diagnostics.Trace.WriteLine(ex.StackTrace); } }
public void Update(bool write = true, SQLiteConnectionUser conn = null) // call at start to populate above { try { useNotifyIcon = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn); orderrowsinverted = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn); minimizeToNotifyIcon = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn); keepOnTop = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn); displayUTC = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn); defaultvoicedevice = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn); defaultwavedevice = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn); showuievents = SQLiteConnectionUser.GetSettingBool("ShowUIEvents", false, conn); clickthrukey = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn); edsmeddbdownload = SQLiteConnectionUser.GetSettingBool("EDSMEDDBDownloadData", true, conn); // this goes with the USER on purpose, so its kept over a system db delete edsmgridids = SQLiteConnectionSystem.GetSettingString("EDSMGridIDs", "Not Set"); // from system database, not user, to keep setting with system data fullhistoryloaddaylimit = SQLiteConnectionUser.GetSettingInt("FullHistoryLoadDayLimit", 0); language = SQLiteConnectionUser.GetSettingString("DefaultLanguage", "Auto"); drawduringresize = SQLiteConnectionUser.GetSettingBool("DrawDuringResizeWindow", true); sortpanelsalpha = SQLiteConnectionUser.GetSettingBool("PanelsSortedByName", false); essentialeventtype = SQLiteConnectionUser.GetSettingString("EssentialEventType", "Default"); coriolisURL = SQLiteConnectionUser.GetSettingString("CorolisURL", Properties.Resources.URLCoriolis); eddshipyardURL = SQLiteConnectionUser.GetSettingString("EDDShipyardURL", Properties.Resources.URLEDShipyard); edsmfullsystemsurl = SQLiteConnectionUser.GetSettingString("EDSMFullSystemsURL", "Default"); eddbsystemsurl = SQLiteConnectionUser.GetSettingString("EDDBSystemsURL", "Default"); EliteDangerousCore.EDCommander.Load(write, conn); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message); System.Diagnostics.Trace.WriteLine(ex.StackTrace); } }
public override void InitialDisplay() { int seltab = SQLiteConnectionUser.GetSettingInt(DbSelectedSave, 0); seltab = seltab.Range(0, tabStrip.ImageList.Length - 1); tabStrip.SelectedIndex = seltab; }
public void Update(bool write = true, SQLiteConnectionUser conn = null) // call at start to populate above { try { _useNotifyIcon = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn); _EDSMLog = SQLiteConnectionUser.GetSettingBool("EDSMLog", false, conn); _orderrowsinverted = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn); _minimizeToNotifyIcon = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn); _keepOnTop = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn); _displayUTC = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn); _clearCommodities = SQLiteConnectionUser.GetSettingBool("ClearCommodities", false, conn); _clearMaterials = SQLiteConnectionUser.GetSettingBool("ClearMaterials", false, conn); _autoLoadPopouts = SQLiteConnectionUser.GetSettingBool("AutoLoadPopouts", false, conn); _autoSavePopouts = SQLiteConnectionUser.GetSettingBool("AutoSavePopouts", false, conn); _defaultvoicedevice = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn); _defaultwavedevice = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn); _showuievents = SQLiteConnectionUser.GetSettingBool("ShowUIEvents", false, conn); _clickthrukey = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn); EliteDangerousCore.EDCommander.Load(write, conn); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message); System.Diagnostics.Trace.WriteLine(ex.StackTrace); } }
public void LoadSavedPopouts() { foreach (PanelInformation.PanelIDs p in Enum.GetValues(typeof(PanelInformation.PanelIDs))) // in terms of PanelInformation.PopOuts Enum { int numtoopen = SQLiteConnectionUser.GetSettingInt(PopOutSaveID(p), 0); PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(p); //System.Diagnostics.Debug.WriteLine("Load panel type " + paneltype.Name + " " + p.ToString() + " " + numtoopen); if (pi != null && numtoopen > 0) // paranoia on first.. { System.Diagnostics.Debug.WriteLine($"Load Popout {p} {numtoopen}"); int numopened = usercontrolsforms.CountOf(pi.PopoutType); if (numopened < numtoopen) { for (int i = numopened + 1; i <= numtoopen; i++) { PopOut(p); } } } } }
public void DGVLoadColumnLayout(DataGridView dgv, string root) { if (SQLiteConnectionUser.keyExists(root + "1")) // if stored values, set back to what they were.. { for (int i = 0; i < dgv.Columns.Count; i++) { string k = root + (i + 1).ToString(); int w = SQLiteDBClass.GetSettingInt(k, -1); if (w >= 10) // in case something is up (min 10 pixels) { dgv.Columns[i].Width = w; } //System.Diagnostics.Debug.WriteLine("Load {0} {1} {2} {3}", Name, k, w, dgv.Columns[i].Width); } int hwidth = SQLiteConnectionUser.GetSettingInt(root + "HW", 0); if (hwidth > 0) { dgv.RowHeadersWidth = hwidth; } else { using (Graphics g = dgv.CreateGraphics()) { SizeF sz = g.MeasureString("999999", discoveryform.theme.GetFont); dgv.RowHeadersWidth = (int)(sz.Width + 6); // size it to the text, need a little more for rounding } } } }
public void LoadProfiles() { string profiles = SQLiteConnectionUser.GetSettingString("ProfileIDs", "0"); List <int> profileints = profiles.RestoreIntListFromString(1, 0); // default is length 1, value 0 foreach (int profileid in profileints) { StringParser sp = new StringParser(SQLiteConnectionUser.GetSettingString(ProfilePrefix(profileid) + "Settings", "")); string name = sp.NextQuotedWordComma(); string tripcondition = sp.NextQuotedWordComma(); string backcondition = sp.NextQuotedWord(); if (name != null && tripcondition != null && backcondition != null) { Profile p = new Profile(profileid, name, tripcondition, backcondition); System.Diagnostics.Debug.WriteLine("Profile {0} {1} {2}", name, tripcondition, backcondition); ProfileList.Add(p); } } if (ProfileList.Count == 0) { ProfileList.Add(new Profile(DefaultId, "Default", "Condition AlwaysFalse", "Condition AlwaysFalse")); } int curid = SQLiteConnectionUser.GetSettingInt("ProfilePowerOnID", DefaultId); PowerOn = Current = ProfileList.Find(x => x.Id == curid) ?? ProfileList[0]; History.Push(Current.Id); }
public override void Init() { BaseUtils.Translator.Instance.Translate(this); SelectionBits sel = (SelectionBits)SQLiteConnectionUser.GetSettingInt(DBSelections, (int)SelectionBits.Default); missionDescriptionToolStripMenuItem.Checked = (sel & SelectionBits.MissionName) != SelectionBits.None; startDateToolStripMenuItem.Checked = (sel & SelectionBits.StartDate) != SelectionBits.None; endDateToolStripMenuItem.Checked = (sel & SelectionBits.StartDate) != SelectionBits.None; factionInformationToolStripMenuItem.Checked = (sel & SelectionBits.FactionInfo) != SelectionBits.None; missionDescriptionToolStripMenuItem.Checked = (sel & SelectionBits.MissionDescription) != SelectionBits.None; rewardToolStripMenuItem.Checked = (sel & SelectionBits.RewardInfo) != SelectionBits.None; // TAGS relate controls to selection bits missionNameToolStripMenuItem.Tag = SelectionBits.MissionName; startDateToolStripMenuItem.Tag = SelectionBits.StartDate; endDateToolStripMenuItem.Tag = SelectionBits.EndDate; factionInformationToolStripMenuItem.Tag = SelectionBits.FactionInfo; missionDescriptionToolStripMenuItem.Tag = SelectionBits.MissionDescription; rewardToolStripMenuItem.Tag = SelectionBits.RewardInfo; missionNameToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); startDateToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); endDateToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); factionInformationToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); missionDescriptionToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); rewardToolStripMenuItem.Click += new System.EventHandler(this.Selection_Click); BaseUtils.Translator.Instance.Translate(contextMenuStrip, this); }
public override void InitialDisplay() { int seltab = SQLiteConnectionUser.GetSettingInt(DbSelectedSave, 0); if (seltab >= 0 && seltab <= tabStrip.ImageList.Length) { tabStrip.SelectedIndex = seltab; } }
public override void Init() { computer = new StarDistanceComputer(); slideMaxItems.Value = maxitems = SQLiteConnectionUser.GetSettingInt(DbSave + "MapMaxItems", maxitems); textMaxRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "MapMax", defaultMapMaxRadius); textMinRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "MapMin", defaultMapMinRadius); textMinRadius.SetComparitor(textMaxRadius, -2); // need to do this after values are set textMaxRadius.SetComparitor(textMinRadius, 2); uctg.OnTravelSelectionChanged += Uctg_OnTravelSelectionChanged; slidetimer = new System.Windows.Forms.Timer(); slidetimer.Interval = 500; slidetimer.Tick += Slidetimer_Tick; }
private void Selection_Click(object sender, EventArgs e) { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; SelectionBits sel = (SelectionBits)(tsmi.Tag); // tag contains bit number SelectionBits cur = (SelectionBits)SQLiteConnectionUser.GetSettingInt(DBSelections, (int)SelectionBits.Default); cur = (cur & ~sel); if (tsmi.Checked) { cur |= sel; } SQLiteConnectionUser.PutSettingInt(DBSelections, (int)cur); System.Diagnostics.Debug.WriteLine("Mission overal sel code " + cur); Display(currentHE); }
internal void LoadSavedPopouts() { foreach (int popout in Enum.GetValues(typeof(PopOuts))) { int numToOpen = SQLiteConnectionUser.GetSettingInt("SavedPopouts:" + ((PopOuts)popout).ToString(), 0); if (numToOpen > 0) { UserControlCommonBase ctrl = Create((PopOuts)popout); int numOpened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType()); if (numOpened < numToOpen) { for (int i = numOpened + 1; i <= numToOpen; i++) { PopOut((PopOuts)popout); } } } } }
public override void Init() { computer = new StarDistanceComputer(); slideMaxItems.Value = maxitems = SQLiteConnectionUser.GetSettingInt(DbSave + "MapMaxItems", maxitems); textMaxRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "MapMax", defaultMapMaxRadius); textMinRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "MapMin", defaultMapMinRadius); textMinRadius.SetComparitor(textMaxRadius, -2); // need to do this after values are set textMaxRadius.SetComparitor(textMinRadius, 2); slidetimer = new System.Windows.Forms.Timer(); slidetimer.Interval = 500; slidetimer.Tick += Slidetimer_Tick; var style = chartMap.ChartAreas[0].Area3DStyle; style.Rotation = Math.Min(180, Math.Max(-180, style.Rotation - (Convert.ToInt32(SQLiteConnectionUser.GetSettingDouble(DbSave + "MapRotationX", xr))))); style.Inclination = Math.Min(90, Math.Max(-90, style.Inclination + (Convert.ToInt32(SQLiteConnectionUser.GetSettingDouble(DbSave + "MapRotationY", yr))))); }
internal void LoadSavedPopouts() { foreach (int ip in Enum.GetValues(typeof(PanelInformation.PanelIDs))) // in terms of PopOut ENUM { PanelInformation.PanelIDs p = (PanelInformation.PanelIDs)ip; int numToOpen = SQLiteConnectionUser.GetSettingInt("SavedPanelInformation.PopOuts:" + p.ToString(), 0); if (numToOpen > 0) { UserControlCommonBase ctrl = PanelInformation.Create(p); int numOpened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType()); if (numOpened < numToOpen) { for (int i = numOpened + 1; i <= numToOpen; i++) { PopOut(p); } } } } }
internal void LoadSavedPopouts() { foreach (PanelInformation.PanelIDs p in Enum.GetValues(typeof(PanelInformation.PanelIDs))) // in terms of PanelInformation.PopOuts Enum { int numtoopen = SQLiteConnectionUser.GetSettingInt("SavedPanelInformation.PopOuts:" + p.ToString(), 0); Type paneltype = PanelInformation.GetPanelTypeByEnum(p); //System.Diagnostics.Debug.WriteLine("Load panel type " + paneltype.Name + " " + p.ToString() + " " + numtoopen); if (paneltype != null && numtoopen > 0) // paranoia on first.. { int numopened = usercontrolsforms.CountOf(paneltype); if (numopened < numtoopen) { for (int i = numopened + 1; i <= numtoopen; i++) { PopOut(p); } } } } }
public static List <EDCommander> GetCommanders(SQLiteConnectionUser conn = null) { List <EDCommander> commanders = new List <EDCommander>(); bool closeconn = false; if (conn == null) { closeconn = true; conn = new SQLiteConnectionUser(true, SQLLiteExtensions.SQLExtConnection.AccessMode.Reader); } if (SQLiteConnectionUser.GetSettingInt("DBVer", 1, conn) >= 102) { using (DbCommand cmd = conn.CreateCommand("SELECT * FROM Commanders")) { using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { EDCommander edcmdr = new EDCommander(reader); string name = Convert.ToString(reader["Name"]); string edsmapikey = Convert.ToString(reader["EdsmApiKey"]); commanders.Add(edcmdr); } } } } if (closeconn && conn != null) { conn.Dispose(); } return(commanders); }
private int GetSettingInt(string key) { return(GetSetting <int>(key, (k, d) => SQLiteConnectionUser.GetSettingInt(k, d))); }