}
}
- internal void AddDevice(BtDevice btDevice) // TODO: need to create AddDeviceFront function to add the device in front of the list for paired and unpaired case
+ internal void AddDeviceFront(BtDevice btDevice)
+ {
+ if (this.Count == 0)
+ {
+ this.Add(new Device(btDevice));
+ }
+ else
+ {
+ if (btDevice.DeviceState == BtDeviceState.Connected)
+ {
+ this.Insert(0, new Device(btDevice));
+ }
+ else
+ {
+ this.Add(new Device(btDevice));
+ }
+ }
+ }
+
+ internal void AddDevice(BtDevice btDevice)
{
if (this.Count == 0)
{
{
this.Insert(0, mPaired);
}
- mPaired.AddDevice(btDevice); // TODO: need to Add to in front of the list not Insert if paired
+ mPaired.AddDeviceFront(btDevice);
UpdateState(btDevice); // TODO: don't need to find device item. let's use return value from above function
}
case BtDeviceState.Connected:
if (mDeviceSource.FindInPaired(ev.BtDevice) != null)
{
+ mDeviceSource.RemoveFromPaired(ev.BtDevice);
+ mDeviceSource.AddToPaired(ev.BtDevice);
mDeviceSource.UpdateState(ev.BtDevice);
}
break;
case BtDeviceState.Disconnecting:
if (mDeviceSource.FindInPaired(ev.BtDevice) != null)
{
+ mDeviceSource.RemoveFromPaired(ev.BtDevice);
+ mDeviceSource.AddToPaired(ev.BtDevice);
mDeviceSource.UpdateState(ev.BtDevice);
}
break;