public override void Load() { try { DeviceList = Device.GetLookupList(null, "Measurement", true); CurrentDevice = DeviceList.First(); lock (m_subscribedMeasurementsLock) { if ((object)m_currentSubscribedMeasurementsPage != null && m_currentSubscribedMeasurementsPage.Count > 0) { m_authorizationQuery.RequestAuthorizationStatus(m_currentSubscribedMeasurementsPage.Select(measurement => measurement.SignalID)); } } m_refreshTimer.Start(); } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex.InnerException); } else { Popup(ex.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex); } } }
public WindowsSession() { IDeviceList list = new DeviceList(); list.Scan(); IDevice device = list.First() ?? throw new ApplicationException("Could not find a device"); this.stateHandler = new StateHandler.StateHandler(device, FocusState.Low, PhysicalPresence.Present); this.Initialize(); }
public static IDevice GetDevice() { IDeviceList list = new DeviceList(); list.Scan(); if (list.Count() == 0) { throw new Exception("No Luxafor device found"); } return list.First(); }
private static void setColor() { if (IsAudioPlaying(audioDevice)) { return; } IDeviceList list = new DeviceList(); list.Scan(); var device = list.First(); device.SetColor(LedTarget.All, defaultColor); }
public MainView() { IDeviceList listOfDevices = new DeviceList(); listOfDevices.Scan(); device = listOfDevices.First(); InitializeComponent(); colorsBox.DataSource = new BindingSource(colors.ColorsMap, null); colorsBox.DisplayMember = "Key"; colorsBox.ValueMember = "Value"; pomodoroPanel.Visible = true; settingsPanel.Visible = false; }
private bool ConnectLuxafor() { try { IDeviceList list = new DeviceList(); list.Scan(); _device = list.First(); } catch (Exception e) { Console.WriteLine("Error: " + e.Message.ToString()); return(false); } return(true); }
private bool ConnectLuxafor() { try { IDeviceList list = new DeviceList(); list.Scan(); _device = list.First(); } catch (Exception e) { Console.WriteLine("Error: " + e.Message.ToString()); setStatusText("Error: Can't find Luxafor device."); return(false); } ToggleAutomatic(); return(true); }
private void ServiceWorkerThread(object state) { while (!this.isStopping) { IDeviceList list = new DeviceList(); list.Scan(); IDevice device = list.First(); if (device != null && IsAudioPlaying(audioDevice)) { device.SetColor(LedTarget.All, new Color(255, 255, 0)); } else if (device != null) { device.SetColor(LedTarget.All, new Color(0, 255, 0)); } Thread.Sleep(500); } }
private static void ServiceWorkerThread(object state) { while (!isStopping) { IDeviceList list = new DeviceList(); list.Scan(); if (list.Any()) { var device = list.First(); if (device != null && IsAudioPlaying(audioDevice)) { device.SetColor(LedTarget.All, yellow); } else { device?.SetColor(LedTarget.All, defaultColor); } } Thread.Sleep(500); } }
private void LoadDevices(JObject payload) { _devIdNameMap = new Dictionary<string, Device>(); List<Device> temp = new List<Device>(); foreach (var deviceToken in payload["deviceInfos"]) { Device device = new Device() { DeviceId = deviceToken["id"].ToString(), DisplayName = deviceToken["extendedDisplayName"].ToString() }; _devIdNameMap.Add(deviceToken["id"].ToString(), device); temp.Add(device); } DeviceList = temp; RefreshBattery(); SelectedDevice = DeviceList.SingleOrDefault(x => x.DeviceId == Settings.Default.LastDeviceId) ?? DeviceList.First(); SelectedDevice.IsChecked = true; }