Пример #1
0
        private void extButtonHighValue_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm cf = new ConfigurableForm();
            int width  = 300;
            int height = 100;

            cf.Add(new ExtendedControls.ConfigurableForm.Entry("UC", typeof(ExtendedControls.NumberBoxLong), panelStars.ValueLimit.ToStringInvariant(),
                                                               new Point(5, 30), new Size(width - 5 - 20, 24), null)
            {
                numberboxlongminimum = 1, numberboxlongmaximum = 2000000000
            });

            cf.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ExtButton), "OK".T(EDTx.OK),
                                                               new Point(width - 20 - 80, height - 40), new Size(80, 24), ""));

            cf.Trigger += (dialogname, controlname, tag) =>
            {
                System.Diagnostics.Debug.WriteLine("control" + controlname);

                if (controlname.Contains("Validity:False"))
                {
                    cf.SetEnabled("OK", false);
                }
                else if (controlname.Contains("Validity:True"))
                {
                    cf.SetEnabled("OK", true);
                }
                else if (controlname == "OK")
                {
                    cf.ReturnResult(DialogResult.OK);
                }
                else if (controlname == "Cancel")
                {
                    cf.ReturnResult(DialogResult.Cancel);
                }
            };

            if (cf.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Set Valuable Minimum".T(EDTx.UserControlScan_VLMT)) == DialogResult.OK)
            {
                long?value = cf.GetLong("UC");
                panelStars.ValueLimit = (int)value.Value;
                EliteDangerousCore.DB.UserDatabase.Instance.PutSettingInt(DbSave + "ValueLimit", panelStars.ValueLimit);
                DrawSystem();
            }
        }
Пример #2
0
        private void extButtonHighValue_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm cf = new ConfigurableForm();
            int width  = 300;
            int height = 100;

            cf.Add(new ExtendedControls.ConfigurableForm.Entry("UC", typeof(ExtendedControls.NumberBoxLong), panelStars.ValueLimit.ToStringInvariant(),
                                                               new Point(5, 30), new Size(width - 5 - 20, 24), null)
            {
                numberboxlongminimum = 1, numberboxlongmaximum = 2000000000
            });

            cf.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ExtButton), "OK".Tx(),
                                                               new Point(width - 20 - 80, height - 40), new Size(80, 24), ""));

            cf.Trigger += (dialogname, controlname, tag) =>
            {
                System.Diagnostics.Debug.WriteLine("control" + controlname);

                if (controlname.Contains("Validity:False"))
                {
                    cf.SetEnabled("OK", false);
                }
                else if (controlname.Contains("Validity:True"))
                {
                    cf.SetEnabled("OK", true);
                }
                else if (controlname == "OK")
                {
                    cf.DialogResult = DialogResult.OK;
                    cf.Close();
                }
            };

            if (cf.ShowDialog(this.FindForm(), this.FindForm().Icon, new Size(width, height), new Point(-999, -999), "Set Valuable Minimum".Tx(this, "VLMT")) == DialogResult.OK)
            {
                long?value = cf.GetLong("UC");
                panelStars.ValueLimit = (int)value.Value;
                SQLiteDBClass.PutSettingInt(DbSave + "ValueLimit", panelStars.ValueLimit);
                DrawSystem();
            }
        }