public override bool ExecuteAction(ActionProgramRun ap)
        {
            List <string> ctrl = FromString(UserData);

            if (ctrl != null)
            {
                List <string> exp;

                if (ap.Functions.ExpandStrings(ctrl, out exp) != Functions.ExpandResult.Failed)
                {
                    string caption = (exp[1].Length > 0) ? exp[1]: "EDDiscovery Program Message";

                    ExtendedControls.InfoForm ifrm = new ExtendedControls.InfoForm();
                    ifrm.Info(caption, ap.ActionController.Icon, exp[0]);
                    ifrm.Show(ap.ActionController.Form);
                }
                else
                {
                    ap.ReportError(exp[0]);
                }
            }
            else
            {
                ap.ReportError("InfoBox command line not in correct format");
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void buttonExtEDShipyard_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text == travelhistorytext || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                Newtonsoft.Json.Linq.JObject jo = si.ToJSONLoadout();

                string loadoutjournalline = jo.ToString(Newtonsoft.Json.Formatting.Indented);

                //     File.WriteAllText(@"c:\code\loadoutout.txt", loadoutjournalline);

                string uri = EDDConfig.Instance.EDDShipyardURL + "#/I=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(loadoutjournalline);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual ED Shipyard import", FindForm().Icon, loadoutjournalline);
                    info.ShowDialog(FindForm());
                }
            }
        }
        private void buttonExtEDShipyard_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text.Contains("Travel") || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                string s = si.ToJSONLoadout();

                string uri = Properties.Resources.URLEDShipyard + "#/I=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s);

                //File.WriteAllText(@"c:\code\out.txt", uri);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual ED Shipyard import", FindForm().Icon, s);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 4
0
        private void buttonImportHelp_Click(object sender, EventArgs e)
        {
            ExtendedControls.InfoForm dl = new ExtendedControls.InfoForm();
            string text = EDDiscovery.Properties.Resources.ImportHelp;

            dl.Info("Import Help", text, new Font("Microsoft Sans Serif", 10), new int[] { 50, 200, 400 });
            dl.Show();
        }
Ejemplo n.º 5
0
        private void buttonImportHelp_Click(object sender, EventArgs e)
        {
            ExtendedControls.InfoForm dl = new ExtendedControls.InfoForm();
            string text = EDDiscovery.Properties.Resources.ImportHelp;

            dl.Info("Import Help", Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                    text, new Font("Microsoft Sans Serif", 10), new int[] { 50, 200, 400 });
            dl.Show();
        }
Ejemplo n.º 6
0
        // About Map

        private void aboutToolStripAbout_Click(object sender, EventArgs e)
        {
            ExtendedControls.InfoForm frm = new ExtendedControls.InfoForm();
            frm.Info("Map Help", FindForm().Icon, EDDiscovery.Properties.Resources.mapuc, null, new int[1] {
                300
            }, true);
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.Show(FindForm());
        }
Ejemplo n.º 7
0
 private void dataGridViewJournal_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (leftclickrow >= 0)                                                   // Click expands it..
     {
         ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
         leftclicksystem.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);
         string infodetailed = EventDescription.AppendPrePad(EventDetailedInfo, Environment.NewLine);
         info.Info((EDDiscoveryForm.EDDConfig.ConvertTimeToSelectedFromUTC(leftclicksystem.EventTimeUTC)) + ": " + leftclicksystem.EventSummary,
                   FindForm().Icon, infodetailed);
         info.Size = new Size(1200, 800);
         info.Show(FindForm());
     }
 }
Ejemplo n.º 8
0
 private void dataGridViewModules_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         string tt = dataGridViewModules.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText;
         if (!string.IsNullOrEmpty(tt))
         {
             Form mainform = FindForm();
             ExtendedControls.InfoForm frm = new ExtendedControls.InfoForm();
             frm.Info("Module Information".T(EDTx.UserControlModules_MI), mainform.Icon, tt);
             frm.Size          = new Size(600, 400);
             frm.StartPosition = FormStartPosition.CenterParent;
             frm.Show(mainform);
         }
     }
 }
Ejemplo n.º 9
0
 private void openRecipeInWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataGridViewMC.RightClickRowValid)
     {
         string mats = (string)dataGridViewMC.Rows[dataGridViewMC.RightClickRow].Tag;
         if (mats != null)   // sheer paranoia.
         {
             mats = mats.Replace(": ", Environment.NewLine + "      ");
             ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
             info.Info(dataGridViewMC.Rows[dataGridViewMC.RightClickRow].Cells[0].Value as string, FindForm().Icon, mats);
             info.Size          = new Size(800, 600);
             info.StartPosition = FormStartPosition.CenterParent;
             info.ShowDialog(FindForm());
         }
     }
 }
Ejemplo n.º 10
0
 private void dataGridViewMC_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.RowIndex < dataGridViewMC.Rows.Count)
     {
         string mats = (string)dataGridViewMC.Rows[e.RowIndex].Tag;
         if (mats != null)   // sheer paranoia.
         {
             mats = mats.Replace(": ", Environment.NewLine + "      ");
             ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
             info.Info(dataGridViewMC.Rows[e.RowIndex].Cells[0].Value as string, FindForm().Icon, mats);
             info.Size          = new Size(800, 600);
             info.StartPosition = FormStartPosition.CenterParent;
             info.ShowDialog(FindForm());
         }
     }
 }
Ejemplo n.º 11
0
        private void extButtonEDSY_Click(object sender, EventArgs e)
        {
            if (lasthe != null)
            {
                string loadoutjournalline = lasthe.ShipInformation.ToJSONLoadout();

                //     File.WriteAllText(@"c:\code\loadoutout.txt", loadoutjournalline);

                string uri = EDDConfig.Instance.EDDShipyardURL + "#/I=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(loadoutjournalline);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual ED Shipyard import", FindForm().Icon, loadoutjournalline);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 12
0
        static void Main(string [] stringargs)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CommandArgs args = new CommandArgs(stringargs);
            string      arg1 = args.Next();
            Type        t    = Type.GetType("DialogTest." + arg1);

            if (t != null)
            {
                Application.Run((Form)Activator.CreateInstance(t));
            }
            else
            {
                Form sel = null;

                switch (arg1)
                {
                case "keyform":
                    ExtendedControls.KeyForm f = new ExtendedControls.KeyForm();
                    f.Init(null, true, " ", "", "", -1, false);
                    sel = f;
                    break;

                case "infoform":
                    ExtendedControls.ThemeStandard th = new ExtendedControls.ThemeStandard();
                    th.LoadBaseThemes();
                    th.SetThemeByName("Elite Verdana");
                    ExtendedControls.ThemeableFormsInstance.Instance = th;
                    ExtendedControls.InfoForm inf = new ExtendedControls.InfoForm();
                    inf.Info("Info form", Properties.Resources._3x3_grid, "This is a nice test\r\nOf the info form\r\n", new int[] { 0, 100, 200, 300, 400, 500, 600 });
                    sel = inf;
                    break;
                }

                if (sel != null)
                {
                    Application.Run(sel);
                }
            }
        }
Ejemplo n.º 13
0
        private void buttonExtEDSMConfigureArea_Click(object sender, EventArgs e)
        {
            GalaxySectorSelect gss = new GalaxySectorSelect();

            if (!gss.Init(EDDConfig.Instance.EDSMGridIDs))
            {
                ExtendedControls.MessageBoxTheme.Show(this, "Warning".T(EDTx.Warning), "No map downloaded - please wait for it to download".T(EDTx.UserControlSettings_NoMap));
            }
            else if (gss.ShowDialog() == DialogResult.OK)
            {
                EDDConfig.Instance.EDSMGridIDs = gss.Selection;

                if (gss.Action == GalaxySectorSelect.ActionToDo.Add)
                {
                    discoveryform.ForceEDSMEDDBFullRefresh();
                }
                else if (gss.Action == GalaxySectorSelect.ActionToDo.Remove)
                {
                    System.Diagnostics.Debug.WriteLine("Remove ");

                    info = new ExtendedControls.InfoForm();
                    info.Info("Remove Sectors".T(EDTx.UserControlSettings_RemoveSectors),
                              EDDiscovery.Properties.Resources.edlogo_3mo_icon,
                              string.Format(("Removing {0} Sector(s)." + Environment.NewLine + Environment.NewLine +
                                             "This will take a while (up to 30 mins dep on drive type and amount of sectors)." + Environment.NewLine +
                                             "You may continue to use EDD while this operation takes place" + Environment.NewLine +
                                             "but it may be slow to respond. Do not close down EDD until this window says" + Environment.NewLine +
                                             "the process has finished" + Environment.NewLine + Environment.NewLine).T(EDTx.UserControlSettings_GalRemove), gss.Removed.Count));
                    info.EnableClose = false;
                    info.Show(discoveryform);

                    taskremovesectors = Task.Factory.StartNew(() => RemoveSectors(gss.AllRemoveSectors, (s) => discoveryform.Invoke(new Action(() => { info.AddText(s); }))));

                    removetimer = new Timer()
                    {
                        Interval = 200
                    };
                    removetimer.Tick += Removetimer_Tick;
                    removetimer.Start();
                }
            }
        }
Ejemplo n.º 14
0
        private void extButtonCoriolis_Click(object sender, EventArgs e)
        {
            if (lasthe != null)
            {
                string errstr;
                string s = lasthe.ShipInformation.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = EDDConfig.Instance.CoriolisURL + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(lasthe.ShipInformation.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", FindForm().Icon, s);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 15
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text.Contains("Travel") || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = Properties.Resources.URLCoriolis + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(si.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                              s, new int[] { 0, 100 });
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 16
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text == travelhistorytext || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.ShipInformationList.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = EDDConfig.Instance.CoriolisURL + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(si.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", FindForm().Icon, s);
                    info.ShowDialog(FindForm());
                }
            }
        }
        void ShowNotification()        // orgnanise pop ups one at a time..
        {
            if (popupnotificationlist.Count > 0)
            {
                Notifications.NotificationParas p = popupnotificationlist[0].Select(EDDConfig.Instance.Language);

                Action <object> act = new Action <object>((o) =>      // on ack, update list of ack entries
                {
                    DateTime ackdate = (DateTime)o;
                    System.Diagnostics.Debug.WriteLine("Ack to " + ackdate.ToStringZulu());
                    EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString("NotificationLastAckTime", EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString("NotificationLastAckTime", "") + ackdate.ToStringZulu());
                });

                ExtendedControls.InfoForm infoform = new ExtendedControls.InfoForm();
                infoform.Info(p.Caption, this.Icon, p.Text, pointsize: popupnotificationlist[0].PointSize,
                              acknowledgeaction: act,
                              acknowledgedata: popupnotificationlist[0].StartUTC);

                infoform.FormClosed += (s, e1) => { ShowNotification(); };     // chain to next, one at a time..

                popupnotificationlist.RemoveAt(0);
                infoform.Show();
            }
        }
Ejemplo n.º 18
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] cmdlineopts = Environment.GetCommandLineArgs().ToArray();

            string selection = cmdlineopts.Length > 1 ? cmdlineopts[1].ToLower() : "default";

            Form sel;

            switch (selection)
            {
            default:
            case "default":
            case "testform":
                sel = new TestForm();
                break;

            case "testrolluppanel":
                sel = new TestRollUpPanel();
                break;

            case "testautocomplete":
                sel = new TestAutoComplete();
                break;

            case "testselectionpanel":
                sel = new TestSelectionPanel();
                break;

            case "keyform":
                ExtendedControls.KeyForm f = new ExtendedControls.KeyForm();
                f.Init(null, true, " ", "", "", -1, false);
                sel = f;
                break;

            case "infoform":
                ExtendedControls.ThemeStandard th = new ExtendedControls.ThemeStandard();
                th.LoadBaseThemes();
                th.SetThemeByName("Elite Verdana");
                ExtendedControls.ThemeableFormsInstance.Instance = th;
                ExtendedControls.InfoForm inf = new ExtendedControls.InfoForm();
                inf.Info("Info form", Properties.Resources._3x3_grid, "This is a nice test\r\nOf the info form\r\n", new int[] { 0, 100, 200, 300, 400, 500, 600 });
                sel = inf;
                break;

            case "testtabstrip":
                sel = new TestTabStrip();
                break;

            case "testdirectinput":
                sel = new TestDirectInput();
                break;

            case "testtabcontrolcustom":
                sel = new TestTabControlCustom();
                break;

            case "testjournalread":
                sel = new TestJournalRead();
                break;

            case "testcompositebutton":
                sel = new TestCompositeButton();
                break;

            case "testcompasscontrol":
                sel = new TestCompassControl();
                break;
            }


            Application.Run(sel);
        }
Ejemplo n.º 19
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text.Contains("Travel") || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByShortName(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSON(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = null;

                var bytes = Encoding.UTF8.GetBytes(s);
                using (MemoryStream indata = new MemoryStream(bytes))
                {
                    using (MemoryStream outdata = new MemoryStream())
                    {
                        using (System.IO.Compression.GZipStream gzipStream = new System.IO.Compression.GZipStream(outdata, System.IO.Compression.CompressionLevel.Optimal, true))
                            indata.CopyTo(gzipStream);      // important to clean up gzip otherwise all the data is not written.. using

                        uri += Properties.Resources.URLCoriolis + "data=" + Uri.EscapeDataString(Convert.ToBase64String(outdata.ToArray()));
                        uri += "&bn=" + Uri.EscapeDataString(si.Name);

                        string browser = BaseUtils.BrowserInfo.GetDefault();

                        if (browser != null)
                        {
                            string path = BaseUtils.BrowserInfo.GetPath(browser);

                            if (path != null)
                            {
                                try
                                {
                                    System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(path, uri);
                                    p.UseShellExecute = false;
                                    System.Diagnostics.Process.Start(p);
                                    return;
                                }
                                catch (Exception ex)
                                {
                                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "Unable to launch browser" + ex.Message, "Browser Launch Error");
                                }
                            }
                        }
                    }
                }

                ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                info.Info("Cannot launch browser, use this JSON for manual Coriolis import", Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                          s, new Font("MS Sans Serif", 10), new int[] { 0, 100 });
                info.ShowDialog(FindForm());
            }
        }