private void Remove(Models.AlertModel alert)
        {
            if (Alerts.Contains(alert))
            {
                _eventAggregator.GetEvent <Events.AlertRemovedEvent>().Publish(alert);

                Alerts.Remove(alert);
            }
        }
        private void RemoveAlerts(IEnumerable <AlertModel> alerts)
        {
            foreach (var alert in alerts)
            {
                if (Alerts.Contains(alert))
                {
                    Alerts.Remove(alert);
                }
            }

            _eventAggregator.GetEvent <Events.AlertRemovedEvent>().Publish(alerts);
        }
Beispiel #3
0
 internal AlertsReadout_Patch()
 {
     foreach (Type type in typeof(Alert).AllLeafSubclasses())
     {
         Alert alert = (Alert)Activator.CreateInstance(type);
         DebugUtil.Log("Attempting to create Alert: " + Format(alert));
         if (!Alerts.Contains(alert))
         {
             Alerts.Add(alert);
         }
         Alerts.Add(alert);
         ToggleManager.Add(
             label: Format(alert),
             root: ButtonCat.Events,
             group: ButtonCat.Alerts
             );
     }
 }
        private void AddAlert(AlertModel alert)
        {
            AlertModel alertCopy = alert.Clone() as AlertModel;

            if (!alertCopy.Time.Offset.Equals(_settings.Alerts.TimeZone.BaseUtcOffset))
            {
                alertCopy.Time = alert.Time.ToOffset(_settings.Alerts.TimeZone.BaseUtcOffset);
            }

            alertCopy.Price = Math.Round(alertCopy.Price, Settings.Alerts.MaxPriceDecimalPlacesNumber);

            if (!Alerts.Contains(alertCopy))
            {
                Alerts.Add(alertCopy);

                VisibleAlert = alertCopy;
            }
        }