Example #1
0
 private void markTypeAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DialogBuilder.DResult result = DialogBuilder.BuildAndShowDialog(
         "Mark Type",
         new List <DialogBuilder.DControl>()
     {
         new DialogBuilder.DControl(
             "Enter type name:",
             new TextBox()
             )
     },
         new List <DialogBuilder.DClosingButtonOption>()
     {
         new DialogBuilder.DClosingButtonOption(0, "Set", true, 100),
         new DialogBuilder.DClosingButtonOption(1, "Cancel", false, 100)
     },
         400,
         7
         );
     if (result.ClosingButtonOptionIDPressed == 1 || result.ClosingButtonOptionIDPressed == -1)
     {
         return;
     }
     selectedEntity.CustomType = result.ResultingControls[0].Text;
     refreshEntityList(true);
 }
Example #2
0
        private void showThreshDialog(Threshold ExistingThresh, bool Velocity)
        {
            NumericUpDown GEV = new NumericUpDown();

            GEV.Enabled       = ExistingThresh.GreaterThanEnabled;
            GEV.Maximum       = decimal.MaxValue;
            GEV.Minimum       = decimal.MinValue;
            GEV.DecimalPlaces = 3;
            GEV.Value         = Convert.ToDecimal((double)ExistingThresh.GreaterThanThreshold);
            CheckBox GEC = new CheckBox();

            GEC.Text            = "Property Must be >=";
            GEC.Checked         = ExistingThresh.GreaterThanEnabled;
            GEC.CheckedChanged += (object sender1, EventArgs e1) => { GEV.Enabled = GEC.Checked; };
            NumericUpDown LEV = new NumericUpDown();

            LEV.Enabled       = ExistingThresh.LessThanEnabled;
            LEV.Maximum       = decimal.MaxValue;
            LEV.Minimum       = decimal.MinValue;
            LEV.DecimalPlaces = 3;
            LEV.Value         = Convert.ToDecimal((double)ExistingThresh.LessThanThreshold);
            CheckBox LEC = new CheckBox();

            LEC.Text            = "Property Must be <=";
            LEC.Checked         = ExistingThresh.LessThanEnabled;
            LEC.CheckedChanged += (object sender1, EventArgs e1) => { LEV.Enabled = LEC.Checked; };
            CheckBox SC = new CheckBox();

            SC.Text    = "Simulate Collision";
            SC.Checked = ExistingThresh.SimulateCollision;
            SC.Enabled = !Velocity;
            DialogBuilder.DResult result = DialogBuilder.BuildAndShowDialog(
                "Set Threshold",
                "Set Threshold",
                new List <DialogBuilder.DControl>()
            {
                new DialogBuilder.DControl("", GEC, false, false, false),
                new DialogBuilder.DControl("", GEV, false, false, false),
                new DialogBuilder.DControl("", LEC, false, false, false),
                new DialogBuilder.DControl("", LEV, false, false, false),
                new DialogBuilder.DControl("", SC, false, false, false)
            },
                new List <DialogBuilder.DClosingButtonOption>()
            {
                new DialogBuilder.DClosingButtonOption(0, "Set", true, 100),
                new DialogBuilder.DClosingButtonOption(1, "Cancel", false, 100)
            },
                221,
                7
                );
            if (result.ClosingButtonOptionIDPressed == 0)
            {
                ExistingThresh.GreaterThanEnabled   = GEC.Checked;
                ExistingThresh.GreaterThanThreshold = (float)GEV.Value;
                ExistingThresh.LessThanEnabled      = LEC.Checked;
                ExistingThresh.LessThanThreshold    = (float)LEV.Value;
                ExistingThresh.SimulateCollision    = SC.Checked;
            }
        }