示例#1
0
 void range_TargetDistance_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.RangeDistance;
 }
示例#2
0
 void range_Temperature_SelectedIndexChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.RangeTemperature;
 }
示例#3
0
 void range_Place_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.RangeLocation;
 }
示例#4
0
 void range_TargetDistanceUnits_SelectedIndexChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.RangeDistanceUnits;
 }
示例#5
0
 void general_ShotsFired_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.TotalShotsFired;
 }
示例#6
0
        void imageSelect_SelectionChange(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            // If there is a previous selection, go ahead and commit the data then
            // empty the fields so they can be repopulated if necessary.
            if (_active)
            {
                CommitData();

                HighlightInvalidImages();

                EraseFields();
            }

            // Make sure there is a selection.
            if (imageSelect.SelectedItems.Count > 0)
            {
                _active = true;
                button_Save.Enabled = true;
                button_GenerateReport.Enabled = true;

                int[] selectedIndices = new int[imageSelect.SelectedIndices.Count];
                imageSelect.SelectedIndices.CopyTo(selectedIndices, 0);
                PopulateFields(_uic.GetImageData(selectedIndices));
                SetEnabled(true);

                _modifiedAttributes = UIController.Attributes.None;

                if (imageSelect.SelectedIndices.Count > 1)
                {
                    measureBox.SetMultipleFileMode(true);
                    measureBox.Enabled = false;
                    selectBox.SetMultipleFileMode(true);
                    selectBox.Enabled = false;

                    currentImageLabel.Text = "Current: Multiple";
                }
                else
                {
                    measureBox.SetMultipleFileMode(false);
                    measureBox.Enabled = true;
                    selectBox.SetMultipleFileMode(false);
                    selectBox.Enabled = true;

                    // Lengths are originally zero and need to be "initialized".
                    // Zero lengths also mess up scaling.
                    if (_uic.CurrentData.scale.verticalLength == 0)
                        _uic.CurrentData.scale.verticalLength = 1;
                    text_Height.Text = Convert.ToString(_uic.CurrentData.scale.verticalLength);

                    if (_uic.CurrentData.scale.horizontalLength == 0)
                        _uic.CurrentData.scale.horizontalLength = 1;
                    text_Width.Text = Convert.ToString(_uic.CurrentData.scale.horizontalLength);

                    Bitmap image = _uic.CurrentData.bitmap;

                    /***** Set values for MeasureBox *****/
                    measureBox.SetImage(image, true);

                    // If the top left point is the same as the bottom right (Points
                    // are initialized to (0,0))
                    if (_uic.CurrentData.regionOfInterest.topLeft.Equals(_uic.CurrentData.regionOfInterest.bottomRight))
                    {
                        // Change the region of interest to be the whole image
                        Datatype.ROI roi;
                        roi.topLeft = new Point();
                        roi.bottomRight = new Point(image.Width, image.Height);
                        measureBox.RegionOfInterest = roi;
                    }
                    else
                        measureBox.RegionOfInterest = _uic.CurrentData.regionOfInterest;

                    // If the two scaling points are the same (Points are initialized
                    // to (0,0))
                    if (_uic.CurrentData.scale.horizontal == _uic.CurrentData.scale.vertical &&
                        _uic.CurrentData.scale.horizontal == _uic.CurrentData.scale.middle)
                        // give it the default scale indicator
                        measureBox.ResetRules();
                    else
                        measureBox.Scaling = _uic.CurrentData.scale;

                    measureBox.Refresh();

                    /***** Set values for SelectBox *****/
                    selectBox.SetImage(image, true);
                    selectBox.BulletHoles = (List<Point>)_uic.CurrentData.points;

                    selectBox.Refresh();

                    // Change the label to indicate which image is selected
                    currentImageLabel.Text = String.Format("Current: {0}", imageSelect.Items[imageSelect.SelectedIndices[0]].Text);
                }

                // After populating the fields, validate them so the user knows
                // which are invalid.
                general_ShotsFired_Validate(this, EventArgs.Empty);
                range_TargetDistance_Validate(this, EventArgs.Empty);
                ammo_Caliber_Validate(this, EventArgs.Empty);
                ammo_ProjectileMass_Validate(this, EventArgs.Empty);
                text_Width_Validate(this, EventArgs.Empty);
                text_Height_Validate(this, EventArgs.Empty);
            }
            else
            {
                // Nothing is selected so disable most everything
                _active = false;
                button_Save.Enabled = false;
                menu_Save.Enabled = false;
                button_GenerateReport.Enabled = false;
                menu_GenerateReport.Enabled = false;
                SetEnabled(true, false);
                currentImageLabel.Text = String.Format("Current: None");
            }
        }
示例#7
0
 void general_Date_ValueChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.DateTimeFired;
 }
示例#8
0
 void general_ShooterLast_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.ShooterLastName;
 }
示例#9
0
 void ammo_Notes_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.AmmoNotes;
 }
示例#10
0
 void ammo_ProjectileMass_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.AmmoMass;
 }
示例#11
0
 void ammo_LotNumber_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.AmmoLotNumber;
 }
示例#12
0
 void ammo_CaliberUnit_SelectedIndexChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.AmmoCaliberUnits;
 }
示例#13
0
 void weapon_SerialNumber_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.WeaponSerial;
 }
示例#14
0
 void weapon_Notes_TextChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.WeaponNotes;
 }
示例#15
0
 void weapon_Nomenclature_SelectedIndexChanged(object sender, EventArgs e)
 {
     _modifiedAttributes |= UIController.Attributes.WeaponName;
 }