示例#1
0
        private void extCheckBoxStar_Click(object sender, EventArgs e)
        {
            if (extCheckBoxStar.Checked == true)
            {
                ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();
                int width = 500;
                f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "System:".T(EDTx.UserControlEDSM_System), new Point(10, 40), new Size(110, 24), null));
                f.Add(new ExtendedControls.ConfigurableForm.Entry("Sys", typeof(ExtendedControls.ExtTextBoxAutoComplete), "", new Point(120, 40), new Size(width - 120 - 20, 24), null));

                f.AddOK(new Point(width - 20 - 80, 80));
                f.AddCancel(new Point(width - 200, 80));

                f.Trigger += (dialogname, controlname, tag) =>
                {
                    if (controlname == "OK" || controlname == "Cancel" || controlname == "Close")
                    {
                        f.ReturnResult(controlname == "OK" ? DialogResult.OK : DialogResult.Cancel);
                    }
                    else if (controlname == "Sys:Return")
                    {
                        if (f.Get("Sys").HasChars())
                        {
                            f.ReturnResult(DialogResult.OK);
                        }

                        f.SwallowReturn = true;
                    }
                };

                f.InitCentred(this.FindForm(), this.FindForm().Icon, "Show System".T(EDTx.UserControlEDSM_EnterSys), null, null, closeicon: true);
                f.GetControl <ExtendedControls.ExtTextBoxAutoComplete>("Sys").SetAutoCompletor(SystemCache.ReturnSystemAutoCompleteList, true);
                DialogResult res = f.ShowDialog(this.FindForm());

                if (res == DialogResult.OK)
                {
                    string sname = f.Get("Sys");
                    if (sname.HasChars())
                    {
                        override_system = new EliteDangerousCore.SystemClass(sname);
                        PresentSystem(override_system);
                        extCheckBoxStar.Checked = true;
                    }
                    else
                    {
                        extCheckBoxStar.Checked = false;
                    }
                }
                else
                {
                    extCheckBoxStar.Checked = false;
                }
            }
            else
            {
                override_system = null;
                PresentSystem(last_sys);
                extCheckBoxStar.Checked = false;
            }
        }
        // Present a menu to ask how much data to download..

        public static Tuple <string, string> SelectGalaxyMenu(Form parent)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var list = DefaultGalaxyOptions.Where(x => x.Item1 != "Custom" && x.Item1 != "Reset").Select(x => x.Item1).ToList();

            int width = 700;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "ED Discovery downloads star data from EDSM/EDDB which is used to give you additional data.  Select how much data you want to store.  The more of the galaxy you select, the bigger the storage needed".T(EDTx.GalaxySectorSelect_GALSELEX),
                                                              new Point(10, 30), new Size(width - 50, 70), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Select:".T(EDTx.GalaxySectorSelect_Select), new Point(10, 100), new Size(160, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Entry", "All",
                                                              new Point(180, 100), new Size(width - 180 - 100, 24),
                                                              "Select the data set".T(EDTx.GalaxySectorSelect_GALSELEN), list));

            f.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ExtButton), "OK".T(EDTx.OK), new Point(width - 40 - 80, 150), new Size(80, 24), "Press to Accept".T(EDTx.GalaxySectorSelect_PresstoAccept)));

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

            DialogResult res = f.ShowDialogCentred(parent, parent.Icon, "Select EDSM Galaxy Data".T(EDTx.GalaxySectorSelect_GALSELTitle));

            string sel   = f.Get("Entry");
            int    index = DefaultGalaxyOptions.FindIndex((x) => { return(x.Item1 == sel); });

            return(DefaultGalaxyOptions[index]);
        }
        private void selectFSSSignalsShownToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width = 430;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Text", typeof(ExtendedControls.ExtTextBox), fsssignalsdisplayed, new Point(10, 40), new Size(width - 10 - 20, 110), "List Names to show")
            {
                textboxmultiline = true
            });

            f.AddOK(new Point(width - 100, 180));
            f.AddCancel(new Point(width - 200, 180));

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

            DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "List signals to display, semicolon seperated", closeicon: true);

            if (res == DialogResult.OK)
            {
                fsssignalsdisplayed = f.Get("Text");
                PutSetting("fsssignals", fsssignalsdisplayed);
                DrawSystem(last_sys);
            }
        }
示例#4
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var routes     = SavedRouteClass.GetAllSavedRoutes();
            var routenames = (from x in routes select x.Name).ToList();

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route", routenames, new Size(400, 400)));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ButtonExt), "Cancel", new Point(410 - 100, 80), new Size(100, 24), "Press to Cancel"));
            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname != "Route")
                {
                    f.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    f.DialogResult = DialogResult.OK;
                }
                f.Close();
            };
            if (f.ShowDialog(this.FindForm(), this.FindForm().Icon, new Size(430, 120), new Point(-999, -999), "Enter route") == DialogResult.OK)
            {
                string routename = f.Get("Route");
                currentRoute = routes.Find(x => x.Name.Equals(routename));       // not going to be null, but consider the upset.

                // currentRoute.TestHarness(); // enable for debug

                if (currentRoute != null)
                {
                    SQLiteDBClass.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant());        // write ID back
                }
                Display();
            }
        }
示例#5
0
        // Present a menu to ask how much data to download..

        public static Tuple <string, string> SelectGalaxyMenu(Form parent)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var list = DefaultGalaxyOptions.Where(x => x.Item2 != "Custom" && x.Item2 != "Reset").Select(x => x.Item1).ToList();

            int    width = 500;
            string text  = "ED Discovery downloads star data from EDSM which is used to give you additional data.  Select how much data you want to store.  The more of the galaxy you select, the bigger the storage needed.  Note your System DB located in the Appdata folder must be stored on a SSD. Using a HDD will be very slow. Select None if your using a HDD.".T(EDTx.GalaxySectorSelect_GALSELEX);

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), text, new Point(10, 30), new Size(width - 50, 100), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Select:".T(EDTx.GalaxySectorSelect_Select), new Point(10, 130), new Size(130, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Entry", DefaultGalaxyOptions[2].Item1,
                                                              new Point(140, 130), new Size(width - 140 - 100, 24),
                                                              "Select the data set".T(EDTx.GalaxySectorSelect_GALSELEN), list));

            f.AddOK(new Point(width - 40 - 80, 170), "Press to Accept".T(EDTx.GalaxySectorSelect_PresstoAccept));

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

            DialogResult res = f.ShowDialogCentred(parent, parent.Icon, "Select EDSM Galaxy Data".T(EDTx.GalaxySectorSelect_GALSELTitle));

            string sel   = f.Get("Entry");
            int    index = DefaultGalaxyOptions.FindIndex((x) => { return(x.Item1 == sel); });

            return(DefaultGalaxyOptions[index]);
        }
示例#6
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var routes     = SavedRouteClass.GetAllSavedRoutes();
            var routenames = (from x in routes select x.Name).ToList();

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route".T(EDTx.UserControlRouteTracker_Selectroute), routenames));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ExtButton), "Cancel".T(EDTx.Cancel), new Point(410 - 100, 80), new Size(100, 24), "Press to Cancel".T(EDTx.UserControlRouteTracker_PresstoCancel)));
            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname != "Route")
                {
                    f.ReturnResult(DialogResult.Cancel);
                }
                else
                {
                    f.ReturnResult(DialogResult.OK);
                }
            };
            if (f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Enter route".T(EDTx.UserControlRouteTracker_Enterroute)) == DialogResult.OK)
            {
                string routename = f.Get("Route");
                currentRoute = routes.Find(x => x.Name.Equals(routename)); // not going to be null, but consider the upset.

                currentRoute.TestHarness();                                // enable for debug

                if (currentRoute != null)
                {
                    EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant());        // write ID back
                }
                Display();
            }
        }
示例#7
0
        private void addPlanetManuallyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width = 430;
            int ctrlleft = 150;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Planet:".T(EDTx.SurfaceBookmarkUserControl_PL), new Point(10, 40), new Size(140, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Planet", typeof(ExtendedControls.ExtTextBox),
                "", new Point(ctrlleft, 40), new Size(width - ctrlleft - 20, 24), "Enter planet name".T(EDTx.SurfaceBookmarkUserControl_EPN)));

            f.AddOK(new Point(width - 100, 70), "Press to Accept".T(EDTx.SurfaceBookmarkUserControl_PresstoAccept));
            f.AddCancel(new Point(width - 200, 70), "Press to Cancel".T(EDTx.SurfaceBookmarkUserControl_PresstoCancel));

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

            DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Manually Add Planet".T(EDTx.SurfaceBookmarkUserControl_MAP), closeicon:true);

            string pname = f.Get("Planet");
            if (res == DialogResult.OK && pname.HasChars())
            {
                if ( !BodyName.Items.Contains(pname))
                    BodyName.Items.Add(pname);
            }
        }
示例#8
0
        // present and allow alloweddisallowed string to be edited. null if cancel

        public static string DLLPermissionManager(Form form, Icon icon, string alloweddisallowed)
        {
            string[] allowedfiles = alloweddisallowed.Split(',');

            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width  = 400;
            int margin = 20;
            int vpos   = 30;

            foreach (string setting in allowedfiles)
            {
                if (setting.Length >= 2)    // double check
                {
                    string name = setting.Substring(1);
                    f.Add(new ExtendedControls.ConfigurableForm.Entry(name, typeof(ExtendedControls.ExtCheckBox), name, new Point(margin, vpos), new Size(width - margin - 20, 20), null)
                    {
                        checkboxchecked = setting[0] == '+'
                    });
                    vpos += 30;
                }
            }

            f.AddOK(new Point(width - margin - 100, vpos), "OK".Tx());
            f.AddCancel(new Point(width - margin - 200, vpos), "Cancel".Tx());

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

            if (f.ShowDialogCentred(form, icon, "DLL - applies at next restart", closeicon: true) == DialogResult.OK)
            {
                alloweddisallowed = "";
                foreach (var e in f.Entries.Where(x => x.controltype == typeof(ExtendedControls.ExtCheckBox)))
                {
                    alloweddisallowed = alloweddisallowed.AppendPrePad((f.Get(e.controlname) == "1" ? "+" : "-") + e.controlname, ",");
                }

                return(alloweddisallowed);
            }
            else
            {
                return(null);
            }
        }
示例#9
0
        private void addPlanetManuallyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width    = 430;
            int ctrlleft = 150;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Planet:".Tx(this, "PL"), new Point(10, 40), new Size(140, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Planet", typeof(ExtendedControls.TextBoxBorder),
                                                              "", new Point(ctrlleft, 40), new Size(width - ctrlleft - 20, 24), "Enter planet name".Tx(this, "EPN")));

            f.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ButtonExt), "OK".Tx(), new Point(width - 100, 70), new Size(80, 24), "Press to Accept".Tx(this)));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ButtonExt), "Cancel".Tx(), new Point(width - 200, 70), new Size(80, 24), "Press to Cancel".Tx(this)));

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

            DialogResult res = f.ShowDialog(this.FindForm(), this.FindForm().Icon, new Size(width, 110), new Point(-999, -999), "Manually Add Planet".Tx(this, "MAP"));

            string pname = f.Get("Planet");

            if (res == DialogResult.OK && pname.HasChars())
            {
                if (!BodyName.Items.Contains(pname))
                {
                    BodyName.Items.Add(pname);
                }
            }
        }
示例#10
0
        private void extCheckBoxAllowedList_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width = 430;

            string deflist = GetSetting("Allowed", "");

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Text", typeof(ExtendedControls.ExtTextBox), deflist, new Point(10, 40), new Size(width - 10 - 20, 110), "URLs")
            {
                textboxmultiline = true
            });

            f.AddOK(new Point(width - 100, 180));
            f.AddCancel(new Point(width - 200, 180));

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

            DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "URLs", closeicon: true);

            if (res == DialogResult.OK)
            {
                string userurllist = f.Get("Text");
                wbb.userurllist = userurllist;
                PutSetting("Allowed", userurllist);
                PresentSystem(last_sys_tracked);
            }
        }
        // Present a menu to ask how much data to download..

        public static Tuple <string, string> SelectGalaxyMenu(Form parent)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();
            Type t = typeof(GalaxySectorSelect);

            var list = DefaultGalaxyOptions.Where(x => x.Item1 != "Custom" && x.Item1 != "Reset").Select(x => x.Item1).ToList();

            int width = 700;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "ED Discovery downloads star data from EDSM/EDDB which is used to give you additional data.  Select how much data you want to store.  The more of the galaxy you select, the bigger the storage needed".Tx(t, "GALSELEX"),
                                                              new Point(10, 30), new Size(width - 30, 60), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Select:".Tx(t), new Point(10, 100), new Size(160, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Entry", "All",
                                                              new Point(180, 100), new Size(width - 180 - 20, 24),
                                                              "Enter number to jump to or near to".Tx(t, "GALSELEN"), list));

            f.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ButtonExt), "OK".Tx(), new Point(width - 20 - 80, 140), new Size(80, 24), "Press to Accept".Tx(t)));

            //f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ButtonExt), "Cancel".Tx(), new Point(width - 200, 70), new Size(80, 24), "Press to Cancel".Tx(t)));

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

            DialogResult res = f.ShowDialog(parent, parent.Icon, new Size(width, 200), new Point(-999, -999), "Select EDSM Galaxy Data".Tx(t, "GALSELTitle"));

            string sel   = f.Get("Entry");
            int    index = DefaultGalaxyOptions.FindIndex((x) => { return(x.Item1 == sel); });

            return(DefaultGalaxyOptions[index]);
        }
        private void extButtonHeader_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            int width  = 800;
            int okline = 600;

            var istr = curprog.HeaderText ?? "";                                                                                           // may be null

            string conv = string.Join(Environment.NewLine, istr.Split(Environment.NewLine).Select(x => x.ReplaceIfStartsWith("// ", ""))); // split, remove any // space prefixes

            f.Add(new ExtendedControls.ConfigurableForm.Entry("text", typeof(ExtendedControls.ExtTextBox), conv,
                                                              new Point(8, 30), new Size(width - 20, okline - 10 - 30), null)
            {
                textboxmultiline = true
            });

            f.AddOK(new Point(width - 100, okline));
            f.AddCancel(new Point(width - 200, okline));
            f.InstallStandardTriggers();

            DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Header", closeicon: true);

            if (res == DialogResult.OK)
            {
                var str = f.Get("text");
                if (str.HasChars())     // if anything there, put back the custom header, with // any lines which do not start with it
                {
                    curprog.HeaderText = string.Join(Environment.NewLine, str.Split(Environment.NewLine).Select(x => x.StartsWith("//") ? x : "// " + x));
                }
                else
                {
                    curprog.HeaderText = null;  // else cancel the custom header
                }
            }
        }
示例#13
0
        DialogResult EditEntry(FilterEntry entry, bool newentry, bool allowdel)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            DateTime starttime = EDDConfig.Instance.ConvertTimeToSelectedFromUTC(entry.StartTimeUTC);
            DateTime endtime   = EDDConfig.Instance.ConvertTimeToSelectedFromUTC(entry.EndTimeUTC);

            int width = 430;

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Name:".T(EDTx.UserControlCombatPanel_Name), new Point(10, 40), new Size(80, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Name", typeof(ExtendedControls.ExtTextBox), entry.Name, new Point(100, 40), new Size(width - 100 - 20, 24), "Give name to campaign".T(EDTx.UserControlCombatPanel_C1))
            {
                clearonfirstchar = newentry
            });

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Faction:".T(EDTx.UserControlCombatPanel_Faction), new Point(10, 70), new Size(80, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Faction", typeof(ExtendedControls.ExtTextBox), entry.TargetFaction, new Point(100, 70), new Size(width - 100 - 20, 24), "Optional faction to target".T(EDTx.UserControlCombatPanel_C2)));

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Start:".T(EDTx.UserControlCombatPanel_Start), new Point(10, 100), new Size(80, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("DTS", typeof(ExtendedControls.ExtDateTimePicker), starttime.ToStringZulu(), new Point(100, 100), new Size(width - 100 - 20, 24), "Select Start time".T(EDTx.UserControlCombatPanel_C3))
            {
                customdateformat = "yyyy-MM-dd HH:mm:ss"
            });

            f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "End:".T(EDTx.UserControlCombatPanel_End), new Point(10, 130), new Size(80, 24), ""));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("DTE", typeof(ExtendedControls.ExtDateTimePicker), endtime.ToStringZulu(), new Point(100, 130), new Size(width - 100 - 20, 24), "Select Start time".T(EDTx.UserControlCombatPanel_C4))
            {
                customdateformat = "yyyy-MM-dd HH:mm:ss"
            });

            f.AddOK(new Point(width - 100, 180), "Press to Accept".T(EDTx.UserControlCombatPanel_C5));
            f.AddCancel(new Point(width - 200, 180), "Press to Cancel".T(EDTx.UserControlCombatPanel_C6));

            if (allowdel)
            {
                f.Add(new ExtendedControls.ConfigurableForm.Entry("Delete", typeof(ExtendedControls.ExtButton), "Delete".T(EDTx.Delete), new Point(10, 180), new Size(80, 24), "Press to Delete".T(EDTx.UserControlCombatPanel_C7)));
            }

            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname == "OK")
                {
                    FilterEntry fe = displayedfilterentries.Find(x => x.UniqueID.Equals(f.Get("Name")));

                    if (fe != null && fe != entry)
                    {
                        ExtendedControls.MessageBoxTheme.Show(this.FindForm(), "Name of campaign already in use, cannot overwrite".T(EDTx.UserControlCombatPanel_NoOverwrite), "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        f.ReturnResult(DialogResult.OK);
                    }
                }
                else if (controlname == "Delete")
                {
                    if (f.Get("Name").Equals(entry.Name))
                    {
                        if (ExtendedControls.MessageBoxTheme.Show(this.FindForm(), string.Format("Confirm deletion of {0}".T(EDTx.UserControlCombatPanel_Condel), entry.Name), "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                        {
                            f.ReturnResult(DialogResult.Abort);
                        }
                    }
                    else
                    {
                        ExtendedControls.MessageBoxTheme.Show(this.FindForm(), "Name changed - can't delete".T(EDTx.UserControlCombatPanel_NC), "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (controlname == "Cancel" || controlname == "Close")
                {
                    f.ReturnResult(DialogResult.Cancel);
                }
            };

            DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Campaign".T(EDTx.Campaign), closeicon: true);

            if (res == DialogResult.OK)
            {
                entry.Reset(f.Get("Name"), f.Get("Faction"),
                            EDDConfig.Instance.ConvertTimeToUTCFromSelected(f.GetDateTime("DTS").Value),
                            EDDConfig.Instance.ConvertTimeToUTCFromSelected(f.GetDateTime("DTE").Value));
            }

            return(res);
        }
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string exp;

            if (ap.Functions.ExpandString(UserData, out exp) != Functions.ExpandResult.Failed)
            {
                StringParser sp     = new StringParser(exp);
                string       handle = sp.NextWordComma();

                if (handle != null)
                {
                    bool infile  = ap.ActionFile.Dialogs.ContainsKey(handle);
                    bool inlocal = ap.Dialogs.ContainsKey(handle);

                    ExtendedControls.ConfigurableForm f = infile ? ap.ActionFile.Dialogs[handle] : (inlocal ? ap.Dialogs[handle] : null);

                    string cmd = sp.NextWordLCInvariant();

                    if (cmd == null)
                    {
                        ap.ReportError("Missing command in DialogControl");
                    }
                    else if (cmd.Equals("exists"))
                    {
                        ap["Exists"] = (f != null) ? "1" : "0";
                    }
                    else if (f == null)
                    {
                        ap.ReportError("No such dialog exists in DialogControl");
                    }
                    else if (cmd.Equals("continue"))
                    {
                        return((inlocal) ? false : true); // if local, pause. else just ignore
                    }
                    else if (cmd.Equals("position"))      // verified 10/1/21
                    {
                        int?x = sp.NextIntComma(",");
                        int?y = sp.NextInt();

                        if (x != null)
                        {
                            if (y != null)
                            {
                                f.Location = new System.Drawing.Point(x.Value, y.Value);
                            }
                            else
                            {
                                ap.ReportError("Missing position in DialogControl position");
                            }
                        }
                        else if (sp.IsEOL)
                        {
                            ap["X"] = f.Location.X.ToStringInvariant();
                            ap["Y"] = f.Location.Y.ToStringInvariant();
                        }
                        else
                        {
                            ap.ReportError("Missing position in DialogControl position");
                        }
                    }
                    else if (cmd.Equals("size"))    // verified 10/1/21
                    {
                        int?w = sp.NextIntComma(",");
                        int?h = sp.NextInt();

                        if (w != null)
                        {
                            if (h != null)
                            {
                                f.Size = new System.Drawing.Size(w.Value, h.Value);
                            }
                            else
                            {
                                ap.ReportError("Missing size in DialogControl size");
                            }
                        }
                        else if (sp.IsEOL)
                        {
                            ap["W"] = f.Size.Width.ToStringInvariant();
                            ap["H"] = f.Size.Height.ToStringInvariant();
                        }
                        else
                        {
                            ap.ReportError("Missing size in DialogControl size");
                        }
                    }
                    else if (cmd.Equals("get"))
                    {
                        string control = sp.NextQuotedWord();
                        string r;

                        if (control != null && (r = f.Get(control)) != null)
                        {
                            ap["DialogResult"] = r;
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog name in DialogControl get");
                        }
                    }
                    else if (cmd.Equals("set"))
                    {
                        string control = sp.NextQuotedWord(" =");
                        string value   = sp.IsCharMoveOn('=') ? sp.NextQuotedWord() : null;
                        if (control != null && value != null)
                        {
                            if (!f.Set(control, value))
                            {
                                ap.ReportError("Cannot set control " + control + " in DialogControl set");
                            }
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog name and/or value in DialogControl set");
                        }
                    }
                    else if (cmd.Equals("enable") || cmd.Equals("visible"))     // verified 10/1/21
                    {
                        string  control = sp.NextQuotedWord();
                        Control c;

                        if (control != null && (c = f.GetControl(control)) != null)
                        {
                            bool?r = sp.NextBoolComma();

                            if (r != null)
                            {
                                if (cmd.Equals("enable"))
                                {
                                    c.Enabled = r.Value;
                                }
                                else
                                {
                                    c.Visible = r.Value;
                                }
                            }
                            else if (sp.IsEOL)
                            {
                                if (cmd.Equals("enable"))
                                {
                                    ap["Enabled"] = c.Enabled.ToStringIntValue();
                                }
                                else
                                {
                                    ap["Visible"] = c.Visible.ToStringIntValue();
                                }
                            }
                            else
                            {
                                ap.ReportError("Missing or invalid " + cmd + "value in DialogControl " + cmd);
                            }
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog control name in DialogControl " + cmd);
                        }
                    }
                    else if (cmd.Equals("controlbounds"))       // verified 10/1/21
                    {
                        string  control = sp.NextQuotedWord();
                        Control c;

                        if (control != null && (c = f.GetControl(control)) != null)
                        {
                            int?x = sp.NextIntComma(",");
                            int?y = sp.NextIntComma(",");
                            int?w = sp.NextIntComma(",");
                            int?h = sp.NextInt();

                            if (x != null && y != null && w != null && h != null)
                            {
                                c.Bounds = new System.Drawing.Rectangle(x.Value, y.Value, w.Value, h.Value);
                            }
                            else if (sp.IsEOL)
                            {
                                ap["X"] = c.Left.ToStringInvariant();
                                ap["Y"] = c.Top.ToStringInvariant();
                                ap["W"] = c.Width.ToStringInvariant();
                                ap["H"] = c.Height.ToStringInvariant();
                            }
                            else
                            {
                                ap.ReportError("Missing or invalid bounds values in DialogControl controlbounds");
                            }
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog control name in DialogControl controlbounds");
                        }
                    }
                    else if (cmd.Equals("close"))
                    {
                        f.ReturnResult(f.DialogResult);
                        if (inlocal)
                        {
                            ap.Dialogs.Remove(handle);
                        }
                        else
                        {
                            ap.ActionFile.Dialogs.Remove(handle);
                        }
                    }
                    else
                    {
                        ap.ReportError("Unknown command in DialogControl");
                    }
                }
                else
                {
                    ap.ReportError("Missing handle in DialogControl");
                }
            }
            else
            {
                ap.ReportError(exp);
            }

            return(true);
        }
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string exp;

            if (ap.functions.ExpandString(UserData, out exp) != ConditionFunctions.ExpandResult.Failed)
            {
                StringParser sp     = new StringParser(exp);
                string       handle = sp.NextWordComma();

                if (handle != null)
                {
                    bool infile  = ap.actionfile.dialogs.ContainsKey(handle);
                    bool inlocal = ap.dialogs.ContainsKey(handle);

                    ExtendedControls.ConfigurableForm f = infile ? ap.actionfile.dialogs[handle] : (inlocal ? ap.dialogs[handle] : null);

                    string cmd = sp.NextWord(lowercase: true);

                    if (cmd == null)
                    {
                        ap.ReportError("Missing command in DialogControl");
                    }
                    else if (cmd.Equals("exists"))
                    {
                        ap["Exists"] = (f != null) ? "1" : "0";
                    }
                    else if (f == null)
                    {
                        ap.ReportError("No such dialog exists in DialogControl");
                    }
                    else if (cmd.Equals("continue"))
                    {
                        return((inlocal) ? false : true);    // if local, pause. else just ignore
                    }
                    else if (cmd.Equals("position"))
                    {
                        ap["X"] = f.Location.X.ToStringInvariant();
                        ap["Y"] = f.Location.Y.ToStringInvariant();
                    }
                    else if (cmd.Equals("get"))
                    {
                        string control = sp.NextWord();
                        string r;

                        if (control != null && (r = f.Get(control)) != null)
                        {
                            ap["DialogResult"] = r;
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog name in DialogControl get");
                        }
                    }
                    else if (cmd.Equals("set"))
                    {
                        string control = sp.NextWord(" =");
                        string value   = sp.IsCharMoveOn('=') ? sp.NextQuotedWord() : null;
                        if (control != null && value != null)
                        {
                            if (!f.Set(control, value))
                            {
                                ap.ReportError("Cannot set control " + control + " in DialogControl set");
                            }
                        }
                        else
                        {
                            ap.ReportError("Missing or invalid dialog name and/or value in DialogControl set");
                        }
                    }
                    else if (cmd.Equals("close"))
                    {
                        f.Close();
                        if (inlocal)
                        {
                            ap.dialogs.Remove(handle);
                        }
                        else
                        {
                            ap.actionfile.dialogs.Remove(handle);
                        }
                    }
                    else
                    {
                        ap.ReportError("Unknown command in DialogControl");
                    }
                }
                else
                {
                    ap.ReportError("Missing handle in DialogControl");
                }
            }
            else
            {
                ap.ReportError(exp);
            }

            return(true);
        }