public static Task <string> GetFirmwareVersionTaskAsync(this BandClient client)
        {
            var tcs = new TaskCompletionSource <string> ();

            client.GetFirmwareVersionAsync(tcs.AttachCompletionHandler());
            return(tcs.Task);
        }
Example #2
0
        public override async Task Prepare()
        {
            if (BandClient == null)
            {
                BandClient = await BandClientManager.Instance.ConnectAsync(BandInfo);
            }

            await base.Prepare();

            FirmwareVersion = await BandClient.GetFirmwareVersionAsync();

            OnPropertyChanged("FirmwareVersion");

            HardwareVersion = await BandClient.GetHardwareVersionAsync();

            OnPropertyChanged("HardwareVersion");
        }
        public override async void OnAppearing(object navigationContext)
        {
            var bandInfo = navigationContext as BandDeviceInfo;

            if (bandInfo != null)
            {
                BandInfo = bandInfo;
                BandName = bandInfo.Name;

                if (BandClient == null)
                {
                    BandClient = await BandClientManager.Instance.ConnectAsync(BandInfo);
                }

                IsConnected     = BandClient.IsConnected;
                FirmwareVersion = await BandClient.GetFirmwareVersionAsync();

                HardwareVersion = await BandClient.GetHardwareVersionAsync();
            }

            base.OnAppearing(navigationContext);
        }
        public override async Task Prepare()
        {
            if (BandClient == null)
            {
                IsLoading = true;

                BandClient = await BandClientManager.Instance.ConnectAsync(BandInfo);

                IsLoading = false;

                BandClient.TileManager.TileButtonPressed += (sender, e) =>
                {
                    CrossLocalNotifications.Current.Show(
                        "Tile Button Pressed",
                        string.Format("Button [{0}] pressed on page [{1}] of tile [{2}].", e.ElementId, e.PageId, e.TileId));
                };
                BandClient.TileManager.TileOpened += (sender, e) =>
                {
                    CrossLocalNotifications.Current.Show("Tile Opened", string.Format("Tile [{0}] opened.", e.TileId));
                };
                BandClient.TileManager.TileClosed += (sender, e) =>
                {
                    CrossLocalNotifications.Current.Show("Tile Closed", string.Format("Tile [{0}] closed.", e.TileId));
                };
                await BandClient.TileManager.StartEventListenersAsync();
            }

            await base.Prepare();

            FirmwareVersion = await BandClient.GetFirmwareVersionAsync();

            OnPropertyChanged("FirmwareVersion");

            HardwareVersion = await BandClient.GetHardwareVersionAsync();

            OnPropertyChanged("HardwareVersion");
        }