private void ProcessRegistryListBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (MyWSim != null)
     {
         string     SelectedName = ProcessRegistryListBox.SelectedItem.ToString();
         int        index        = ProcessRegistryListBox.SelectedIndex;
         CheckState ischecked    = ProcessRegistryListBox.GetItemCheckState(index);
         if (ischecked == CheckState.Unchecked)
         {
             AnnualFeedbackProcess AFP = MyWSim.ProcessRegistry.Construct(SelectedName, MyWSim);
             if (AFP != null)
             {
                 MyWSim.ProcessManager.AddProcess(AFP);
             }
         }
         else
         {
             AnnualFeedbackProcess AFP = MyWSim.ProcessManager.FindByClassname(SelectedName);
             if (AFP != null)
             {
                 MyWSim.ProcessManager.Delete(AFP);
             }
         }
     }
 }
        // OK need to have an event handler to precent anyone from delete the tracking process while this process is still active.
        internal void OnProcessManagerProcessEventHandler(object sender, ProcessManagerEventArgs e)
        {
            AnnualFeedbackProcess AFP = e.TheAnnualFeedbackProcess;

            e.TheResult = true;
            if (e.TheProcessEventType == ProcessManagerEventType.peDeleteProcess)
            {
                if (AFP.Name == "TrackAvailableGroundwater")
                {
                    e.TheResult = false;
                }
            }
        }
        //============================================
        internal void SetUpProcessAndParameters(WaterSimManager WSim)
        {
            ModelParameterBaseClass MP = WSim.ParamManager.Model_ParameterBaseClass(eModelParam.epYearsNotAssured);

            FWSim = WSim;
            if (MP == null)
            {
                FAFPTracker = new TrackAvailableGroundwater("Tracking Support for AWS Limit", WSim);
                WSim.ProcessManager.AddProcess(FAFPTracker);
            }
            WSim.ParamManager.AddParameter(new ModelParameterClass(eModelParam.epYearsOfNonAWSTrigger, "Trigger for NonAWS Years", "NONAWSTRG", modelParamtype.mptInputBase, rangeChecktype.rctNoRangeCheck, 0, 0, geti_Max_Years_NonAWS_Trigger, null, seti_Max_Years_NonAWS_Trigger, null, null, null, null));
            WSim.ProcessManager.ProcessManagerChangeEvent += OnProcessManagerProcessEventHandler;
        }
Esempio n. 4
0
        //============================================
        internal void SetUpPolicyProcessAndParameters(WaterSimManager WSim)
        {
            ModelParameterBaseClass MP = WSim.ParamManager.Model_ParameterBaseClass(eModelParam.epDeficit_Years);

            FWSim = WSim;
            if (MP == null)
            {
                FAFPTracker = new TrackGroundwaterCreditsProcess("Tracking Support for Credits Limit", WSim);
                //FAFPTracker = new TrackAvailableGroundwater("Tracking Support for AWS Limit", WSim);
                WSim.ProcessManager.AddProcess(FAFPTracker);
            }
            WSim.ParamManager.AddParameter(new ModelParameterClass(eModelParam.epYearsOfCreditsTrigger, "Trigger for Negative Credit Balance", "NEGCREDITS", modelParamtype.mptInputBase, rangeChecktype.rctNoRangeCheck, 0, 0, geti_Max_Years_Deficit_Trigger, null, seti_Max_Years_Deficit_Trigger, null, null, null, null));
            WSim.ProcessManager.ProcessManagerChangeEvent += OnProcessManagerProcessEventHandler;
        }
 private void ProcessRegistryListBox_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (MyWSim != null)
     {
         string                SelectedName = ProcessRegistryListBox.SelectedItem.ToString();
         int                   index        = ProcessRegistryListBox.SelectedIndex;
         CheckState            ischecked    = ProcessRegistryListBox.GetItemCheckState(index);
         AnnualFeedbackProcess AFP          = MyWSim.ProcessRegistry.Construct(SelectedName, MyWSim);
         if (AFP != null)
         {
             MyWSim.ProcessManager.AddProcess(AFP);
         }
     }
 }
        private void ProcessManagerListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string SelectedName = ProcessManagerListBox.SelectedItem.ToString();
            int    index        = SelectedName.IndexOf(" : ");

            if (index > -1)
            {
                SelectedName = SelectedName.Substring(0, index).Trim();
                AnnualFeedbackProcess AFP = MyWSim.ProcessManager.Find(SelectedName);
                if (AFP != null)
                {
                    string temp = AFP.ProcessCode + "  " + AFP.Name + " : " + AFP.ProcessLongDescription;
                    StatusLabel1.Text = temp;
                }
            }
        }