コード例 #1
0
ファイル: ObjectForm.cs プロジェクト: jcryer/SolarCore
        private void VelocityPresetButton_Click(object sender, EventArgs e)
        {
            // Opens up a new instance of the ExistingObjectsForm.
            var form   = new ExistingObjectsForm(2);
            var result = form.ShowDialog();

            // Waits until the form has closed, and then checks the outcome of it. If DialogResult.OK is returned,
            // an object was selected and the "Confirm" button was pressed.
            if (result == DialogResult.OK)
            {
                // The SolarObject's position value is updated with the value selected from the preset dialog.
                SolarObject.Velocity = form.Location;
                // The ObjectForm fields are updated with the new values, to show the change in position values to the user.
                Update(SolarObject);
            }
        }
コード例 #2
0
ファイル: ObjectForm.cs プロジェクト: jcryer/SolarCore
        private void ExistingButton_Click(object sender, EventArgs e)
        {
            // Opens up a new instance of the ExistingObjectsForm.
            var form   = new ExistingObjectsForm();
            var result = form.ShowDialog();

            // Waits until the form has closed, and then checks the outcome of it. If DialogResult.OK is returned,
            // an object was selected and the "Confirm" button was pressed.
            if (result == DialogResult.OK)
            {
                // The selected object's position and velocity values are pulled from the database based on the selected object's name.
                // The form's SolarObject entity is then updated with these values.
                form.Object.Position = DatabaseMethods.GetLocationPresets(0)[form.Object.Name];
                form.Object.Velocity = DatabaseMethods.GetLocationPresets(1)[form.Object.Name];
                // The ObjectForm fields are updated with the new values, to show the change in position and velocity values to the user.
                Update(form.Object);
            }
        }