Beispiel #1
0
        private async void OnNewWorldStateObject(IWorldStateObject worldStateObject)
        {
            if (!Application.Settings.Alerts.Matches(worldStateObject))
            {
                return;
            }

            Notify(await CreateControl(worldStateObject));
        }
Beispiel #2
0
 public bool Matches(IWorldStateObject worldStateObject)
 {
     return
         (Alerts
          .Where(alert => alert.Enabled && alert.MatchingRule == MatchingRule.Include)
          .Any(worldStateObject.Matches) &&
          !Alerts
          .Where(alert => alert.Enabled && alert.MatchingRule == MatchingRule.Exclude)
          .Any(worldStateObject.Matches)
         );
 }
Beispiel #3
0
        private async Task <Control> CreateControl(IWorldStateObject worldStateObject)
        {
            switch (worldStateObject)
            {
            case Fissure fissure:
                var fissureControl = new FissureControl {
                    ImageRepository = Application.ImageRepository,
                    Active          = true,
                };
                fissureControl.Update(fissure, await Application.SolNodes);

                return(fissureControl);
            }

            throw new ApplicationException("Unrecognized world state object type.");
        }