private async void OnBleAdvertisementUpdated(BleAdvertisementWatcher sender, DeviceWatchEvent eventCode, BLEAdvertisementInfo bleAdvertisementInfo)
        {
            DeviceInformation btDeviceInformation = await BluetoothDevices.CreateDeviceInformation(bleAdvertisementInfo.ToBtAddressString(), AddressType.Bluetooth);

            DeviceInformation bleDeviceInformation = await BluetoothDevices.CreateDeviceInformation(bleAdvertisementInfo.ToBtAddressString(), AddressType.BLE);

            if (!App.sUserManager.IsSingnIn())
            {
                // FIXME: SERVICE CODE to configuration
                if (bleAdvertisementInfo.Advertisement.ManufacturerData[0].Data.Length > 5)
                {
                    // ignore, because it has user Key.
                    Log.D(string.Format($"Other User's Device Found: {bleAdvertisementInfo.Advertisement.ManufacturerData[0].Data}"));
                    return;
                }
            }

            if (eventCode == DeviceWatchEvent.Added)
            {
                Log.D(string.Format($"New BLE Advertisement Found: {bleAdvertisementInfo.ToBtAddressString()}"));

                AddNearByEarbuds(bleDeviceInformation.Id);
                AddNearByBtDevice(bleDeviceInformation.Id, btDeviceInformation.Name);
            }
            else if (eventCode == DeviceWatchEvent.Removed)
            {
                Log.D(string.Format($"BLE Advertisement Removed: {bleAdvertisementInfo.ToBtAddressString()}"));

                Earbuds removeEarBuds = RemoveNearByEarbuds(bleDeviceInformation.Id);
                if (removeEarBuds != null)
                {
                    RemoveNearByBtDevice(bleDeviceInformation.Id, btDeviceInformation.Name);
                }
            }
        }
        public DeviceManager()
        {
            // Init BleAdvertisementWacther
            bleAdvertisementWatcher = new BleAdvertisementWatcher();

            // Init BluetoothWacther
            bluetoothWatcher = new BluetoothWatcher();

            PairingManager = new PairingManager();
        }
        // BLE Advertisement Handler
        private void OnBleAdvertisementUpdated(BleAdvertisementWatcher sender, DeviceWatchEvent eventCode, BLEAdvertisementInfo bleAdvertisementInfo)
        {
            if (userKey == null || userKey.Length == 0)
            {
                // FIXME: SERVICE CODE to configuration
                if (bleAdvertisementInfo.Advertisement.ManufacturerData[0].Data.Length > 5)
                {
                    // ignore, because it has user Key.
                    return;
                }
            }

            if (eventCode == DeviceWatchEvent.Added)
            {
                Log.D($"New BLE Advertisement Found: {bleAdvertisementInfo.ToBtAddressString()}");
                ValueSet newBleDeviceMessage = new ValueSet
                {
                    { "opcode", "ble_device" },
                    { "status", "added" },
                    { "name", bleAdvertisementInfo.Advertisement.LocalName },
                    { "id", $"Bluetooth#Bluetooth{localBtAddress}-{bleAdvertisementInfo.ToBtAddressString()}" }
                };
                systrayApplicationServiceConnection.SendMessageAsync(newBleDeviceMessage);
            }
            else if (eventCode == DeviceWatchEvent.Removed)
            {
                Log.D($"BLE Advertisement Removed: {bleAdvertisementInfo.ToBtAddressString()}");
                ValueSet removeBleDeviceMessage = new ValueSet
                {
                    { "opcode", "ble_device" },
                    { "status", "removed" },
                    { "name", bleAdvertisementInfo.Advertisement.LocalName },
                    { "id", $"Bluetooth#Bluetooth{localBtAddress}-{bleAdvertisementInfo.ToBtAddressString()}" }
                };
                systrayApplicationServiceConnection.SendMessageAsync(removeBleDeviceMessage);
            }

            // Propergate Event to Earbuds Menu
            string deviceId = $"Bluetooth#Bluetooth{localBtAddress}-{bleAdvertisementInfo.ToBtAddressString()}";

            foreach (EarbudsMenuItem earbudsMenuItem in PairedDeviceMenuItems)
            {
                if (BluetoothDevices.EqualDevice(deviceId, earbudsMenuItem.BtID))
                {
                    earbudsMenuItem.HandleBleAdvertisement(eventCode);
                    break;
                }
            }
        }
        public SystrayApplicationContext()
        {
            // Initialize ApplicationSErvice Connection
            systrayApplicationServiceConnection = new SystrayApplicationServiceConnection();
            systrayApplicationServiceConnection.Init();
            if (systrayApplicationServiceConnection.Initialized)
            {
                MessageBox.Show("Failed to initialize AppServiceConnection" + systrayApplicationServiceConnection.Status.ToString());
                Application.Exit();
            }

            systrayApplicationServiceConnection.NewMessageReceived += OnNewMessageReceived;
            systrayApplicationServiceConnection.ConnectionClosed   += OnAppClosed;

            Log = Log.GetInstance(systrayApplicationServiceConnection);

            // Init Parameters
            var userInfo = (ApplicationDataCompositeValue)ApplicationData.Current.LocalSettings.Values["userInfo"];

            if (userInfo != null)
            {
                userName = userInfo["name"] as string;
                userKey  = userInfo["key"] as string;
            }
            else
            {
                userName = "******";
                userKey  = null;
            }

            // Init BleAdvertisementWacther
            bleAdvertisementWatcher = new BleAdvertisementWatcher();

            // Init BluetoothWacther
            bluetoothWatcher = new BluetoothWatcher();

            // Initialize Menu
            InitMenu();
            InitMenuItems();

            // Initialize AudioMonitor
            AudioMonitor = new AudioMonitor();

            // Start Post Initilalizaion Timer
            postInitializationTimer.Tick    += OnIntialized;
            postInitializationTimer.Interval = 1000;
            postInitializationTimer.Start();
        }