/// OnAlerted (event) - Jacob Monger
 /// <summary>
 /// adds or removes flag stating if alert limit was excided
 /// </summary>
 /// <param name="source"> alert view model.</param>
 /// <param name="e"> data structure see alert view model.</param>
 public void OnAlerted(object source, AlertEventArgs e)
 {
     if (e.NewAlert == true) // is there a new alert
     {
         for (int ListPosition = 0; ListPosition < AlertList.Count(); ListPosition++)
         {
             if (AlertList[ListPosition].AlertName == e.AlertName) // find alert limit
             {
                 if (e.AlertName.Contains("Max"))
                 {
                     if (e.AlertValue > AlertList[ListPosition].Threshold || AlertList[ListPosition].ThresholdToDisplay == null) // if bigger up date
                     {
                         App.Current.Dispatcher.Invoke((Action) delegate
                         {
                             AlertList.Remove(AlertList[ListPosition]);
                             AlertList.Insert(ListPosition, new AlertListItemModel(e.AlertName, " (Exceeded ", e.AlertValue.ToString("0.00") + ")", e.AlertValue));
                         });
                     }
                 }
                 if (e.AlertName.Contains("Min"))
                 {
                     if (e.AlertValue < AlertList[ListPosition].Threshold || AlertList[ListPosition].ThresholdToDisplay == null) // if smaller upadte
                     {
                         App.Current.Dispatcher.Invoke((Action) delegate
                         {
                             AlertList.Remove(AlertList[ListPosition]);
                             AlertList.Insert(ListPosition, new AlertListItemModel(e.AlertName, " (Exceeded ", e.AlertValue.ToString("0.00") + ")", e.AlertValue));
                         });
                     }
                 }
                 return;
             }
         }
     }
     else
     {
         for (int ListPosition = 0; ListPosition < AlertList.Count(); ListPosition++) // clear all flags
         {
             if (AlertList[ListPosition].Exceeded != null)
             {
                 string temporyName = AlertList[ListPosition].AlertName;
                 App.Current.Dispatcher.Invoke((Action) delegate
                 {
                     AlertList.Remove(AlertList[ListPosition]);
                     AlertList.Insert(ListPosition, new AlertListItemModel(temporyName));
                 });
             }
         }
     }
 }
 /// UpdateAlert (command) - Jacob Monger
 /// <summary>
 /// if valid updates setting, removes alert from alert list if flagged
 /// </summary>
 /// <param name="message"> user input</param>
 public void UpdateAlert(object message)
 {
     if (SelectedAlertsIndex != -1)
     {
         if (double.TryParse(message.ToString(), out double newValue))
         {
             if (AlertList[SelectedAlertsIndex].ThresholdToDisplay != null)
             {
                 AlertViewModelInstance.RemoveAlert(AlertList[SelectedAlertsIndex].AlertName);
             }
             String AlertName = AlertList[SelectedAlertsIndex].AlertName;
             Properties.Settings.Default[AlertName] = newValue;    //convert.ToDouble(null);
             Properties.Settings.Default.Save();
             AlertList.Remove(AlertList[SelectedAlertsIndex]);
             AlertList.Insert(SelectedAlertsIndex, new AlertListItemModel(AlertName));
         }
     }
 }