Ejemplo n.º 1
0
        private async void ClientOnConnectionEstablished(BluetoothClient Client, ClientConnectedEventArgs Args)
        {
            var connection = Args.Connection;

            using (var db = new SQLiteConnection(Database.DatabasePath))
            {
                var query = db.Table<Location>().OrderBy(x => x.Timestamp).ToArray();

                // First send the number of locations we want to send.
                await connection.SendUInt32((uint)query.Length);

                foreach (var location in query)
                {
                    await connection.SendObject(location);
                }
            }

            // Disconnect
        }
Ejemplo n.º 2
0
 private async void SyncBluetoothButton_Click(object Sender, RoutedEventArgs Args)
 {
     var client = new BluetoothClient();
     client.ConnectionEstablished += ClientOnConnectionEstablished;
     await client.Connect();
 }