public static Log GetInstance(SystrayApplicationServiceConnection appServiceConnection)
 {
     if (sInstance == null)
     {
         sInstance = new Log(appServiceConnection);
     }
     return(sInstance);
 }
        public EarbudsMenuItem(DeviceInformation deviceInformation, SystrayApplicationServiceConnection sysAppConnection) : base(deviceInformation.Name)
        {
            this.Earbuds = new Earbuds(deviceInformation);

            SysAppConnection = sysAppConnection;

            ConnectMenu    = new MenuItem("Connect A2DP", ConnectClicked);
            DisconnectMenu = new MenuItem("Disconnect A2DP", DisconnectClicked);
            UnpairMenu     = new MenuItem("Unpair", UnpaireClicked);

            MenuItems.AddRange(new MenuItem[] { ConnectMenu, DisconnectMenu, UnpairMenu });

            Log = SystrayApplicationContext.Log;
        }
        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();
        }
 private Log(SystrayApplicationServiceConnection appServiceConnection)
 {
     this.AppServiceConnection = appServiceConnection;
 }
 private void OnAppClosed(SystrayApplicationServiceConnection sender)
 {
     Application.Exit();
 }
 private void OnNewMessageReceived(SystrayApplicationServiceConnection sender, ValueSet message)
 {
     // NOT USED YET
 }