Ejemplo n.º 1
0
        private async void Start()
        {
            var list = await GetFiles();

            int count = BluetoothManager.Current.FilesToShare.Count;

            foreach (var file in BluetoothManager.Current.FilesToShare)
            {
                FilesToShare.Add(file);
            }
            BluetoothManager.Current.AddFiles(list);
            foreach (var f in list)
            {
                FilesToShare.Add(f);
            }
            if (count == 0)
            {
                await StartScan();
            }
            else
            {
                DeviceListVisibility = false;
                FileListVisibility   = true;
                if (filesToShare[0].ShareStatus == FileShareStatus.Error)
                {
                    BluetoothManager.Current.StartService();
                }
            }
        }
Ejemplo n.º 2
0
 async void BluetoothManager_FailedHandler(FileItemToShare f)
 {
     await DispatcherHelper.RunAsync(() =>
     {
         FileItemToShare file = filesToShare[0];
         file.ShareStatus     = FileShareStatus.Error;
         file.Progress        = 0;
         FilesToShare.RemoveAt(0);
         FilesToShare.Add(file);
     });
 }
Ejemplo n.º 3
0
 private void ForegroundApp_Resuming(object sender, object e)
 {
     foreach (var file in BluetoothManager.Current.FilesToShare)
     {
         FilesToShare.Add(file);
     }
     BluetoothManager.FailedHandler            += BluetoothManager_FailedHandler;
     BluetoothManager.ChangeProgressHandler    += BluetoothManager_ChangeProgressHandler;
     BluetoothManager.ChangeStatusHandler      += BluetoothManager_ChangeStatusHandler;
     BluetoothManager.RemoveFirstFileHandler   += BluetoothManager_RemoveFirstFileHandler;
     BluetoothManager.SetDevicesListHandler    += BluetoothManager_SetDevicesListHandler;
     BluetoothManager.TransferCompletedHandler += BluetoothManager_TransferCompletedHandler;
 }