예제 #1
0
 /// <summary>
 /// Handle the user clicking the GUI Edit Indicator button
 /// </summary>
 private void EditIndicatorButton_Click(object sender, EventArgs e)
 {
     if (ObservablesListBox.SelectedItem == null)
     {
         return;
     }
     else
     {
         AddIndicatorForm X = new AddIndicatorForm(ref ObsCollection, ObsCollection.Observables[ObservablesListBox.SelectedIndex]);
         X.StartPosition = FormStartPosition.Manual;
         X.Location      = this.Location;
         if (X.ShowDialog() == DialogResult.OK)
         {
             ObsCollection.Observables[ObservablesListBox.SelectedIndex] = X.CreatedObservable;
             updateObservables();
         }
     }
 }
예제 #2
0
        //Handle the GUI Add indicator button being clicked
        private void AddIndicatorButton_Click(object sender, EventArgs e)
        {
            //Ask the user if they are sure they want to proceded if they havn't filled in the incident details
            //We generate the ID values for each observable based on the incident data, so its a good idea to fill it out first
            if (checkIncidentDetails())
            {
                if (MessageBox.Show("It looks like you haven't completed all the values relating to the incident metadata.\r\n\r\nID values for the indicators you add are derived from this data, so you may want to double check.\r\n\r\nYou can change the metadata later, but ID values for any indicators added now won't show the right values.\r\n\r\nCarry on to add a new indicator?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
                {
                    return;
                }
            }

            //Create the GUI form used to input the data
            AddIndicatorForm currentAddForm = new AddIndicatorForm(ref ObsCollection);

            //Make sure the new form opens over the main window, not in some random place, which is uber annoying
            currentAddForm.StartPosition = FormStartPosition.Manual;
            currentAddForm.Location      = this.Location;

            //In a loop so the user can click "Save and Add Another"
            do
            {
                //Should we clear the form between indicators?
                if (currentAddForm.clearform)
                {
                    //Clear and reset the form
                    currentAddForm = new AddIndicatorForm(ref ObsCollection);
                    currentAddForm.StartPosition = FormStartPosition.Manual;
                    currentAddForm.Location      = this.Location;
                }

                //Show the form and handle the result
                if (currentAddForm.ShowDialog() == DialogResult.OK)
                {
                    //Add the created observable
                    ObsCollection.Observables.Add(currentAddForm.CreatedObservable);

                    //Update the main GUI
                    updateObservables();
                }
            }while (currentAddForm.openagain); //Open another form if requested by the last form
        }