コード例 #1
0
        public void AddDefaultZone()
        {
            if (Observer == null)
            {
                Log.Debug("app", "Observer is not defined yet");
                return;
            }

            var newZone = Observer
                          .ZoneBuilder()
                          .ForAttachmentKeyAndValue(Helpers.Settings.DefaultProximityZoneKey, Helpers.Settings.DefaultProximityZoneValue)
                          .InCustomRange(Helpers.Settings.DefaultProximityZoneDistance)
                          .WithOnEnterAction(new OnEnterDefaultZoneHandler(this.Model))
                          .WithOnChangeAction(new OnChangeDefaultZoneHandler(this.Model))
                          .WithOnExitAction(new OnExitDefaultZoneHandler(this.Model))
                          .Create();

            Observer.AddProximityZone(newZone);

            Log.Debug("app", $"Proximity all ready to go! - Default zone range {Helpers.Settings.DefaultProximityZoneDistance} ");
        }
コード例 #2
0
        public void AddCustomZone(double range, string key, string value, string[] beacons)
        {
            if (Observer == null)
            {
                Log.Debug("app", "Observer is not defined yet");
                return;
            }

            var newZone = Observer
                          .ZoneBuilder()
                          .ForAttachmentKeyAndValue(key, value)
                          .InCustomRange(range)
                          .WithOnEnterAction(new OnEnterCustomZoneHandler(this.Model, beacons))
                          .WithOnChangeAction(new OnChangeCustomZoneHandler(this.Model, beacons))
                          .WithOnExitAction(new OnExitCustomZoneHandler(this.Model, beacons))
                          .Create();

            Observer.AddProximityZone(newZone);
            ProximityZones.Add(newZone);

            Log.Debug("app", $"Proximity all ready to go! - Zone range {range} ");
        }