예제 #1
0
파일: BandStrapp.cs 프로젝트: jehy/unBand
        public BandStrapp(BandTiles tiles, AdminBandTile strapp)
        {
            Strapp = strapp;
            _tiles = tiles;

            TileImage = strapp.Image.ToWriteableBitmap();
        }
예제 #2
0
파일: BandStrapp.cs 프로젝트: jehy/unBand
        public BandStrapp(BandTiles tiles, AdminBandTile strapp)
        {
            Strapp = strapp;
            _tiles = tiles;

            TileImage = strapp.Image.ToWriteableBitmap();
        }
예제 #3
0
        private async Task DiscoverDevices()
        {
            var devices = await CargoClient.GetConnectedDevicesAsync();

            if (devices.Count() > 0)
            {
                // must create on the UI thread for various Binding reasons
                _deviceInfo = devices[0];

                Application.Current.Dispatcher.BeginInvoke(new Action(async() =>
                {
                    // TODO: support more than one device?
                    InitializeCargoLogging();
                    CargoClient = await CargoClient.CreateAsync(_deviceInfo);

                    IsConnected = true;

                    //TODO: call an "OnConnected" function
                    Properties = new BandProperties(CargoClient);
                    Theme      = new BandTheme(CargoClient);
                    Sensors    = new BandSensors(CargoClient);
                    Tiles      = new BandTiles(CargoClient);
                }));
            }
        }
예제 #4
0
        private async Task ConnectDevice()
        {
            if (DesktopSyncAppIsRunning())
            {
                return;
            }

            // We support connecting to a device over USB and Bluetooth.
            // Since USB is super fast (the device is either there or not), search there first and then fallback
            // on Bluetooth, since that can take a little longer.

            var device = await GetUSBBand();

            if (device == null)
            {
                // now try Bluetooth
                device = await GetBluetoothBand();
            }

            if (device != null)
            {
                // since this will trigger binding, invoke on the UI thread
                Application.Current.Dispatcher.BeginInvoke(new Action(async() =>
                {
                    // TODO: support more than one device?
                    CargoClient = device;

                    IsConnected = true;

                    //TODO: call an "OnConnected" function

                    // Bluetooth is sensitive to multiple things going on at once across different threads
                    // so let's make sure we go about this serially

                    Properties = new BandProperties(CargoClient);
                    await Properties.InitAsync();

                    Theme = new BandTheme(CargoClient);
                    await Theme.InitAsync();

                    Sensors = new BandSensors(CargoClient);
                    await Sensors.InitAsync();

                    Tiles = new BandTiles(CargoClient);
                    await Tiles.InitAsync();
                }));
            }
        }
예제 #5
0
파일: BandManager.cs 프로젝트: jehy/unBand
        private async Task ConnectDevice()
        {
            if (DesktopSyncAppIsRunning())
                return;

            // We support connecting to a device over USB and Bluetooth.
            // Since USB is super fast (the device is either there or not), search there first and then fallback
            // on Bluetooth, since that can take a little longer.

            var device = await GetUSBBand();

            if (device == null)
            {
                // now try Bluetooth
                device = await GetBluetoothBand();
            }

            if (device != null)
            {
                // since this will trigger binding, invoke on the UI thread
                Application.Current.Dispatcher.BeginInvoke(new Action(async () =>
                {
                    // TODO: support more than one device?
                    CargoClient = device;

                    IsConnected = true;

                    //TODO: call an "OnConnected" function

                    // Bluetooth is sensitive to multiple things going on at once across different threads
                    // so let's make sure we go about this serially

                    Properties = new BandProperties(CargoClient);
                    await Properties.InitAsync();
                    
                    Theme = new BandTheme(CargoClient);
                    await Theme.InitAsync();

                    Sensors = new BandSensors(CargoClient);
                    await Sensors.InitAsync();

                    Tiles = new BandTiles(CargoClient);
                    await Tiles.InitAsync();
                }));
            }
        }
예제 #6
0
 public BandStrapp(BandTiles tiles, CargoStrapp strapp)
 {
     Strapp = strapp;
     _tiles = tiles;
 }