コード例 #1
0
        public BeaconViewModel(IBeaconRangingManager ranging, IBeaconMonitoringManager monitoring)
        {
            this.Start = ReactiveCommand.Create(() => this.scan = ranging
                                                                  .WhenBeaconRanged(MyRegion)
                                                                  .Subscribe(beacon =>
            {
                this.Beacons.Add(beacon);
            })
                                                );

            this.Stop = ReactiveCommand.Create(() => this.scan?.Dispose());

            this.StartMonitor = ReactiveCommand.CreateFromTask(
                () => monitoring.StartMonitoring(MyRegion)
                );
            this.StopMonitor = ReactiveCommand.CreateFromTask(
                () => monitoring.StopAllMonitoring()
                );
        }