void Adapter_DeviceConnected (object sender, DeviceConnectionEventArgs e) { Debug.WriteLine("Device connected"); //adapter.StopScanningForDevices(); StopScanning(); Device.BeginInvokeOnMainThread(() => { this.lblConnectedDevice.IsVisible = true; this.btnGenerateCode.IsVisible = true; this.btnDisconnect.IsVisible = true; this.lblConnectedDevice.Text = "Device Connected: " + e.Device.Name; }); Debug.WriteLine("Connected Devices Count: "+ adapter.ConnectedDevices.Count); device = e.Device; device.ServicesDiscovered += Device_ServicesDiscovered; device.DiscoverServices (); }
void Adapter_DeviceFailedToConnect (object sender, DeviceConnectionEventArgs e) { StartScanning (); }
void Adapter_DeviceDisconnected (object sender, DeviceConnectionEventArgs e) { Device.BeginInvokeOnMainThread(() => { this.lblConnectedDevice.IsVisible = false; this.lblCodeCaption.IsVisible = false; this.txtCode.IsVisible = false; this.btnValidate.IsVisible = false; this.btnGenerateCode.IsVisible = false; this.btnValidate.IsEnabled = false; this.btnDisconnect.IsVisible = false; this.lblConnectedDevice.Text = ""; this.txtCode.Text = ""; }); //this.StartScanning(); this.StartScanning (0x180F.UuidFromPartial ()); }
void Adapter_DeviceFailedToConnect(object sender, DeviceConnectionEventArgs e) { }
void Adapter_DeviceDisconnected(object sender, DeviceConnectionEventArgs e) { }
void Adapter_DeviceConnected(object sender, DeviceConnectionEventArgs e) { Debug.WriteLine("Device Connected"); this.Device = e.Device; e.Device.ServicesDiscovered += Services_Discovered; e.Device.DiscoverServices(); }
void Adapter_DeviceDisconnected(object sender, DeviceConnectionEventArgs e) { Debug.WriteLine("SyncHandler: Device Disconnected"); this.DeviceDisconnected(this, new EventArgs() { }); this.ProcessingDevice = false; this.Device = null; e.Device.ServicesDiscovered -= Services_Discovered; this.SyncDeviceHandler.SyncStarted -= SyncDeviceHandler_SyncStarted; if (this.SyncDeviceHandler != null) { this.SyncDeviceHandler.CleanUp(); } this.DeviceDisconnected(this, new EventArgs { }); //this.Adapter.StartScanningForDevices(); }
void Adapter_DeviceConnected(object sender, DeviceConnectionEventArgs e) { Debug.WriteLine("Device Connected"); this.Device = e.Device; //if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("932")) //{ // Debug.WriteLine("Instantiating PE932 Handler"); // this.syncDeviceHandler = SyncDeviceHandler932.GetInstance(); //} /*else */ if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("961")) { Debug.WriteLine("Instantiating PE/FT961 Handler"); this.SyncDeviceHandler = SyncDeviceHandler961.GetInstance(); } else if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("939")) { Debug.WriteLine("Instantiating PE939 Handler"); this.SyncDeviceHandler = SyncDeviceHandler939.GetInstance(); } else if (this.Device.Name.StartsWith("H25FE2")) { this.SyncDeviceHandler = SyncDeviceHandlerStriiv.GetInstance(); } this.SyncDeviceHandler.IncrementProgressBar += UpdateProgressBar; this.SyncDeviceHandler.SyncDone += DoneSyncing; this.SyncDeviceHandler.SyncStarted += SyncDeviceHandler_SyncStarted; this.SyncDeviceHandler.ValidationCodeDisplayed += SyncDeviceHandler_ValidationCodeDisplayed; this.SyncDeviceHandler.CodeValidated += SyncDeviceHandler_CodeValidated; this.SyncDeviceHandler.SetAdapter(this.Adapter); this.SyncDeviceHandler.SetDevice(this.Device); this.SyncDeviceHandler.SetWebService(this.WebService); this.SyncDeviceHandler.SetUserInformation(UserInformationInstance); this.SyncDeviceHandler.SetApplicationInformation(ApplicationInfoInstance); e.Device.ServicesDiscovered += Services_Discovered; //this.Adapter.CommandResponse += SyncDeviceHandler.ReceiveResponse; e.Device.DiscoverServices(); }