示例#1
0
        public CentralExtensionsViewModel(ICentralManager centralManager,
                                          IUserDialogs dialogs)
        {
            this.Tasks = new List <TaskViewModel>
            {
                new TaskViewModel(
                    "Scan Find Peripheral",
                    ct => centralManager
                    .ScanUntilPeripheralFound(this.PeripheralName)
                    .ToTask(ct),

                    this.WhenAny(
                        x => x.PeripheralName,
                        x => !x.GetValue().IsEmpty()
                        )
                    ),
                new TaskViewModel(
                    "Scan For Unique Peripherals",
                    ct => centralManager
                    .ScanForUniquePeripherals()
                    .ToTask(ct)
                    ),
                new TaskViewModel(
                    "Scan Interval",
                    ct => centralManager
                    .ScanInterval(
                        TimeSpan.FromSeconds(10),
                        TimeSpan.FromSeconds(10)
                        )
                    .ToTask(ct)
                    )
            };
        }
        public CentralExtensionsViewModel(ICentralManager centralManager)
        {
            //centralManager.ScanInterval
            //centralManager.ScanForUniquePeripherals

            this.Tasks = new List <TaskViewModel>
            {
                new TaskViewModel(
                    "Scan Find Peripheral",
                    ct => centralManager
                    .ScanUntilPeripheralFound(this.DeviceName)
                    .ToTask(ct),

                    this.WhenAny(
                        x => x.DeviceName,
                        x => !x.GetValue().IsEmpty()
                        )
                    )
            };
        }