public bool Init(string cellset) { string datapath = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Maps"); if (Directory.Exists(datapath)) { galaxy = Map2d.LoadImage(Path.Combine(datapath, "Galaxy_L_Grid.json")); if (galaxy != null) { imageViewer.Image = new Bitmap(galaxy.FilePath); imageViewer.ZoomToFit(); imageViewer.Init(galaxy); comboBoxSelections.Items.AddRange((from x in defaultsel select x.Item1)); initialsel = Selection = cellset; initiallist = new List <int>(imageViewer.Selection); // copy of.. EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; bool winborder = theme.ApplyToForm(this); statusStripCustom.Visible = panel_close.Visible = panel_minimize.Visible = !winborder; SetComboBox(); imageViewer.BackColor = Color.FromArgb(5, 5, 5); return(true); } } return(false); }
public void Init(string[] exportlist, bool disablestartendtime = false) { comboBoxCustomExportType.Items.AddRange(exportlist); customDateTimePickerFrom.Value = new DateTime(2014, 11, 22, 4, 0, 0, DateTimeKind.Utc); //Gamma start customDateTimePickerTo.Value = DateTime.Now; if (System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator.Equals(".")) { radioButtonComma.Checked = true; } else { radioButtonSemiColon.Checked = true; } checkBoxIncludeHeader.Checked = EliteDangerousCore.DB.SQLiteConnectionUser.GetSettingBool("ExportFormIncludeHeader", true); checkBoxCustomAutoOpen.Checked = EliteDangerousCore.DB.SQLiteConnectionUser.GetSettingBool("ExportFormOpenExcel", true); comboBoxCustomExportType.SelectedIndex = 0; EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; font = new Font(theme.FontName, 10); bool winborder = theme.ApplyToForm(this, font); label_index.Visible = panel_minimize.Visible = panel_close.Visible = !winborder; if (disablestartendtime) { customDateTimePickerFrom.Visible = customDateTimePickerTo.Visible = false; int d = panelBottom.Top - customDateTimePickerFrom.Top; panelBottom.Top -= d; panelOuter.Height -= d; Height -= d; } }
public CommanderForm() { InitializeComponent(); EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; font = new Font(theme.FontName, 10); bool winborder = theme.ApplyToForm(this, font); panelTop.Visible = panelTop.Enabled = !winborder; }
public void Init() { EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; font = new Font(theme.FontName, 10); bool winborder = theme.ApplyToForm(this, font); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; richTextBoxScrollDescription.TextBox.ReadOnly = true; }
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); }
private void Form2dLoad(object sender, EventArgs e) { initdone = false; pickerStart = new DateTimePicker(); pickerStop = new DateTimePicker(); host1 = new ToolStripControlHost(pickerStart); toolStrip.Items.Add(host1); host2 = new ToolStripControlHost(pickerStop); toolStrip.Items.Add(host2); pickerStart.Value = DateTime.Today.AddMonths(-1); this.pickerStart.ValueChanged += new System.EventHandler(this.dateTimePickerStart_ValueChanged); this.pickerStop.ValueChanged += new System.EventHandler(this.dateTimePickerStop_ValueChanged); startDate = new DateTime(2010, 1, 1); if (!AddImages()) { ExtendedControls.MessageBoxTheme.Show(this, "2DMaps", "No maps available", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Close(); return; } toolStripComboExpo.Items.Clear(); foreach (Map2d img in fgeimages) { toolStripComboExpo.Items.Add(img.FileName); } toolStripComboBoxTime.Items.AddRange(new string[] { "Distant Worlds Expedition", "FGE Expedition start", "Last Week", "Last Month", "Last Year", "All", "Custom" }); toolStripComboExpo.SelectedIndex = 0; toolStripComboBoxTime.SelectedIndex = 0; initdone = true; ShowSelectedImage(); imageViewer.BackColor = Color.FromArgb(5, 5, 5); EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; bool winborder = theme.ApplyToForm(this); statusStripCustom.Visible = panel_close.Visible = panel_minimize.Visible = !winborder; }
public void Init(bool ad) // true = manage downloads, else just show actions and allow editing of them { managedownloadmode = ad; EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; font = new Font(theme.FontName, 10); bool winborder = theme.ApplyToForm(this, font); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; richTextBoxScrollDescription.TextBox.ReadOnly = true; label_index.Text = this.Text = (managedownloadmode) ? "Add-On Manager" : "Edit Add-Ons"; buttonExtGlobals.Visible = !managedownloadmode; buttonMore.Visible = !managedownloadmode; }
public SetNoteForm(HistoryEntry he, EDDiscoveryForm parent) { InitializeComponent(); this.Owner = parent; this._discoveryForm = parent; this.HistoryEntry = he; this.NoteText = he.snc?.Note; this.textBoxNote.Text = this.NoteText ?? ""; this.labelTimestamp.Text = he.EventTimeLocal.ToString(); this.labelSystem.Text = he.System.name; this.labelSummary.Text = he.EventSummary; this.labelDetails.Text = he.EventDescription; EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; theme.ApplyToForm(this); }
// altops, if given, describes the operator of each variable. public void Init(string t, EDDiscovery.EDDTheme th, ConditionVariables vbs, Dictionary <string, string> altops = null, bool showone = false, bool showrefresh = false, bool showrefreshstate = false, bool allowadd = false, bool allownoexpand = false) { theme = th; bool winborder = theme.ApplyToForm(this, SystemFonts.DefaultFont); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; this.Text = label_index.Text = t; showadd = allowadd; shownoexpand = allownoexpand; int pos = panelmargin; checkBoxCustomRefresh.Enabled = checkBoxCustomRefresh.Visible = showrefresh; checkBoxCustomRefresh.Checked = showrefreshstate; checkBoxCustomRefresh.Location = new Point(pos, panelmargin); if (vbs != null) { foreach (string key in vbs.NameEnumuerable) { CreateEntry(key, vbs[key], (altops != null) ? altops[key] : "="); } } if (groups.Count == 0 && showone) { CreateEntry("", "", "="); } if (groups.Count >= 1) { groups[0].var.Focus(); } }
public AssignTravelLogSystemForm(ISystem refsys, DateTime?visited = null) { InitializeComponent(); SystemClassDB.GetSystemAndAlternatives(refsys, out _linkSystem, out _alternatives, out _namestatus); this.tbLogSystemName.Text = refsys.name; this.tbVisitedDate.Text = visited == null ? "-" : visited.ToString(); this.tbLogCoordX.Text = refsys.HasCoordinate ? refsys.x.ToString("0.00") : "?"; this.tbLogCoordY.Text = refsys.HasCoordinate ? refsys.y.ToString("0.00") : "?"; this.tbLogCoordZ.Text = refsys.HasCoordinate ? refsys.z.ToString("0.00") : "?"; this.tbLogCoordX.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center; this.tbLogCoordY.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center; this.tbLogCoordZ.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center; UpdateLinkedSystemList(_linkSystem); tbManualSystemName.AutoCompleteMode = AutoCompleteMode.SuggestAppend; tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource; tbManualSystemName.SetAutoCompletor(EDDiscovery.DB.SystemClassDB.ReturnSystemListForAutoComplete); EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; theme.ApplyToForm(this); }
public void Init(string ptext, string caption, MessageBoxButtons buttons, MessageBoxIcon ic) { if (buttons == MessageBoxButtons.AbortRetryIgnore) { buttonExt1.Tag = DialogResult.Ignore; buttonExt1.Text = "Ignore"; buttonExt2.Tag = DialogResult.Retry; buttonExt2.Text = "Retry"; buttonExt3.Tag = DialogResult.Abort; buttonExt3.Text = "Abort"; } else if (buttons == MessageBoxButtons.OK) { buttonExt1.Tag = DialogResult.OK; buttonExt1.Text = "OK"; buttonExt2.Visible = false; buttonExt3.Visible = false; this.AcceptButton = this.CancelButton = buttonExt1; } else if (buttons == MessageBoxButtons.OKCancel) { buttonExt1.Tag = DialogResult.Cancel; buttonExt1.Text = "Cancel"; buttonExt2.Tag = DialogResult.OK; buttonExt2.Text = "OK"; buttonExt3.Visible = false; } else if (buttons == MessageBoxButtons.RetryCancel) { buttonExt1.Tag = DialogResult.Cancel; buttonExt1.Text = "Cancel"; buttonExt2.Tag = DialogResult.OK; buttonExt2.Text = "Retry"; buttonExt3.Visible = false; } else if (buttons == MessageBoxButtons.YesNo) { buttonExt1.Tag = DialogResult.No; buttonExt1.Text = "No"; buttonExt2.Tag = DialogResult.Yes; buttonExt2.Text = "Yes"; buttonExt3.Visible = false; } else if (buttons == MessageBoxButtons.YesNoCancel) { buttonExt1.Tag = DialogResult.Cancel; buttonExt1.Text = "Cancel"; buttonExt2.Tag = DialogResult.No; buttonExt2.Text = "No"; buttonExt3.Tag = DialogResult.Yes; buttonExt3.Text = "Yes"; } labelCaption.Text = this.Text = caption; text = ptext; if (ic == MessageBoxIcon.Asterisk) { icon = SystemIcons.Asterisk; } if (ic == MessageBoxIcon.Error) { icon = SystemIcons.Error; } if (ic == MessageBoxIcon.Exclamation) { icon = SystemIcons.Exclamation; } if (ic == MessageBoxIcon.Information) { icon = SystemIcons.Information; } if (ic == MessageBoxIcon.Question) { icon = SystemIcons.Question; } if (ic == MessageBoxIcon.Warning) { icon = SystemIcons.Warning; } int ystart = 30; EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; if (theme != null) // paranoid { fnt = new Font(theme.FontName, 12.0F); forecolour = theme.TextBlockColor; bool border = theme.ApplyToForm(this, fnt); if (!border) { labelCaption.Visible = true; ystart += 20; } } else { fnt = new Font("MS Sans Serif", 12.0F); forecolour = Color.Red; } int bordery = Bounds.Height - ClientRectangle.Height; int borderx = Bounds.Width - ClientRectangle.Width; int left = (ic != MessageBoxIcon.None) ? 80 : 20; using (Graphics g = CreateGraphics()) { SizeF sizeftext = g.MeasureString(text, fnt); SizeF sizefcaption = g.MeasureString(caption, fnt); Height = (int)sizeftext.Height + ystart + 50 + bordery; Width = Math.Min(Math.Max(300, left + (int)Math.Max(sizeftext.Width, sizefcaption.Width) + 20), 1800) + borderx; textarea = new Rectangle(left, ystart, (int)(sizeftext.Width + 1), (int)(sizeftext.Height + 1)); } }
public NewReleaseForm() { InitializeComponent(); EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; theme.ApplyToForm(this); }
// lab sets the items, def can be less or null public static List <string> ShowDialog(Form p, string caption, string[] lab, string[] def, bool multiline = false, string[] tooltips = null) { EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; int vstart = theme.WindowsFrame ? 20 : 40; int vspacing = multiline ? 60 : 40; int lw = 100; int lx = 10; int tx = 10 + lw + 8; Form prompt = new Form() { Width = 600, Height = 90 + vspacing * lab.Length + (theme.WindowsFrame ? 20 : 0), FormBorderStyle = FormBorderStyle.FixedDialog, Text = caption, StartPosition = FormStartPosition.CenterScreen, }; Panel outer = new Panel() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle }; prompt.Controls.Add(outer); Label textLabel = new Label() { Left = lx, Top = 8, Width = prompt.Width - 50, Text = caption }; if (!theme.WindowsFrame) { outer.Controls.Add(textLabel); } Label[] lbs = new Label[lab.Length]; ExtendedControls.TextBoxBorder[] tbs = new ExtendedControls.TextBoxBorder[lab.Length]; ToolTip tt = new ToolTip(); tt.ShowAlways = true; int y = vstart; for (int i = 0; i < lab.Length; i++) { lbs[i] = new Label() { Left = lx, Top = y, Width = lw, Text = lab[i] }; tbs[i] = new ExtendedControls.TextBoxBorder() { Left = tx, Top = y, Width = prompt.Width - 50 - tx, Text = (def != null && i < def.Length) ? def[i] : "", Height = vspacing - 20, Multiline = multiline, ScrollBars = (multiline) ? ScrollBars.Vertical : ScrollBars.None, WordWrap = multiline }; outer.Controls.Add(lbs[i]); outer.Controls.Add(tbs[i]); if (tooltips != null && i < tooltips.Length) { tt.SetToolTip(lbs[i], tooltips[i]); tt.SetToolTip(tbs[i], tooltips[i]); } y += vspacing; } ExtendedControls.ButtonExt confirmation = new ExtendedControls.ButtonExt() { Text = "Ok", Left = tbs[0].Right - 80, Width = 80, Top = y, DialogResult = DialogResult.OK }; outer.Controls.Add(confirmation); confirmation.Click += (sender, e) => { prompt.Close(); }; ExtendedControls.ButtonExt cancel = new ExtendedControls.ButtonExt() { Text = "Cancel", Left = confirmation.Location.X - 90, Width = 80, Top = confirmation.Top, DialogResult = DialogResult.Cancel }; outer.Controls.Add(cancel); cancel.Click += (sender, e) => { prompt.Close(); }; if (!multiline) { prompt.AcceptButton = confirmation; } prompt.CancelButton = cancel; prompt.ShowInTaskbar = false; theme.ApplyToForm(prompt, System.Drawing.SystemFonts.DefaultFont); if (prompt.ShowDialog(p) == DialogResult.OK) { var r = (from ExtendedControls.TextBoxBorder t in tbs select t.Text).ToList(); return(r); } else { return(null); } }
public void Show(Form p, string lname, System.Drawing.Size size, string caption, Entry[] e, Object t) { logicalname = lname; entries = e; tag = t; EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; Size = size; FormBorderStyle = FormBorderStyle.FixedDialog; Text = caption; StartPosition = FormStartPosition.CenterScreen; Panel outer = new Panel() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle }; Controls.Add(outer); Label textLabel = new Label() { Left = 4, Top = 8, Width = Width - 50, Text = caption }; if (!theme.WindowsFrame) { outer.Controls.Add(textLabel); } ToolTip tt = new ToolTip(); tt.ShowAlways = true; for (int i = 0; i < entries.Length; i++) { Control c = (Control)Activator.CreateInstance(entries[i].controltype); entries[i].control = c; c.Size = entries[i].size; c.Location = entries[i].pos; c.Text = entries[i].text; c.Tag = entries[i]; outer.Controls.Add(c); if (entries[i].tooltip != null) { tt.SetToolTip(c, entries[i].tooltip); } if (c is ExtendedControls.ButtonExt) { ExtendedControls.ButtonExt b = c as ExtendedControls.ButtonExt; b.Click += (sender, ev) => { Entry en = (Entry)(((Control)sender).Tag); if (Trigger != null) { Trigger(logicalname, en.name, tag); } }; } if (c is ExtendedControls.TextBoxBorder) { ExtendedControls.TextBoxBorder tb = c as ExtendedControls.TextBoxBorder; tb.Multiline = tb.WordWrap = entries[i].textboxmultiline; } if (c is ExtendedControls.CheckBoxCustom) { ExtendedControls.CheckBoxCustom cb = c as ExtendedControls.CheckBoxCustom; cb.Checked = entries[i].checkboxchecked; cb.Click += (sender, ev) => { Entry en = (Entry)(((Control)sender).Tag); if (Trigger != null) { Trigger(logicalname, en.name, tag); } }; } } ShowInTaskbar = false; theme.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont); Show(p); }