private void toolStripButtonAddSystems_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            FindSystemsUserControl usc = new FindSystemsUserControl();

            usc.ReturnSystems = (List <Tuple <ISystem, double> > syslist) =>
            {
                List <String> systems      = new List <String>();
                int           countunknown = 0;
                foreach (Tuple <ISystem, double> ret in syslist)
                {
                    ret.Item1.Name = ret.Item1.Name.Trim();

                    ISystem sc = discoveryform.history.FindSystem(ret.Item1.Name, discoveryform.galacticMapping, true);
                    if (sc == null)
                    {
                        sc = ret.Item1;
                        countunknown++;
                    }
                    systems.Add(sc.Name);
                }

                if (systems.Count == 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "The imported file contains no known system names".T(EDTx.UserControlExploration_NoSys),
                                                          "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    AddSystems(systems);        // makes it dirty
                }
                f.ReturnResult(DialogResult.OK);
            };

            f.Add(new ExtendedControls.ConfigurableForm.Entry("UC", null, "", new Point(5, 30), usc.Size, null)
            {
                control = usc
            });
            f.AddCancel(new Point(4 + usc.Width - 80, usc.Height + 50));

            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname == "Cancel" || controlname == "Close")
                {
                    f.ReturnResult(DialogResult.Cancel);
                }
            };

            DBSettingsSaver db = new DBSettingsSaver(this, "Sys");

            f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Add Systems".T(EDTx.UserControlExploration_AddSys),
                                callback: () =>
            {
                usc.Init(db, false, discoveryform);
            },
                                closeicon: true);
            usc.Save();
        }
Exemple #2
0
        private void tsbAddSystems_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            FindSystemsUserControl usc = new FindSystemsUserControl();

            usc.ReturnSystems = (List <Tuple <ISystem, double> > syslist) =>
            {
                List <String> systems      = new List <String>();
                int           countunknown = 0;
                foreach (Tuple <ISystem, double> ret in syslist)
                {
                    string name = ret.Item1.Name;

                    ISystem sc = SystemCache.FindSystem(name.Trim());
                    if (sc == null)
                    {
                        sc = new SystemClass(name.Trim());
                        countunknown++;
                    }
                    systems.Add(sc.Name);
                }

                if (systems.Count == 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "The imported file contains no known system names".Tx(this, "NoSys"),
                                                          "Warning".Tx(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    AddSystems(systems);
                }

                f.DialogResult = DialogResult.OK;
                f.Close();
            };

            f.Add(new ExtendedControls.ConfigurableForm.Entry("UC", null, "", new Point(5, 30), new Size(740, 200), null)
            {
                control = usc
            });
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ExtButton), "Cancel".Tx(), new Point(650, 230), new Size(80, 24), ""));

            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname == "Cancel")
                {
                    f.DialogResult = DialogResult.Cancel;
                    f.Close();
                }
            };

            f.ShowDialog(this.FindForm(), this.FindForm().Icon, new Size(750, 280), new Point(-999, -999), "Add Systems".Tx(this, "AddSys"),
                         callback: () => { usc.Font = EDDTheme.Instance.GetFontStandardFontSize(); usc.Init(0, "ExplorationFindSys", false, discoveryform); });
            usc.Closing();
        }
        private void tsbAddSystems_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            FindSystemsUserControl usc = new FindSystemsUserControl();

            usc.ReturnSystems = (List <Tuple <ISystem, double> > syslist) =>
            {
                List <String> systems      = new List <String>();
                int           countunknown = 0;
                foreach (Tuple <ISystem, double> ret in syslist)
                {
                    string name = ret.Item1.Name;

                    ISystem sc = SystemCache.FindSystem(name.Trim());
                    if (sc == null)
                    {
                        sc = new SystemClass(name.Trim());
                        countunknown++;
                    }
                    systems.Add(sc.Name);
                }

                if (systems.Count == 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "The imported file contains no known system names".T(EDTx.UserControlExploration_NoSys),
                                                          "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    AddSystems(systems);
                }

                f.ReturnResult(DialogResult.OK);
            };

            f.Add(new ExtendedControls.ConfigurableForm.Entry("UC", null, "", new Point(5, 30), usc.Size, null)
            {
                control = usc
            });
            f.AddCancel(new Point(4 + usc.Width - 80, usc.Height + 50));

            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname == "Cancel" || controlname == "Close")
                {
                    f.ReturnResult(DialogResult.Cancel);
                }
            };

            // usc.Font = EDDTheme.Instance.GetScaledFont(0.8f)
            f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Add Systems".T(EDTx.UserControlExploration_AddSys),
                                callback: () => {; usc.Init(0, "ExplorationFindSys", false, discoveryform); }, closeicon: true);
            usc.Closing();
        }