public void UpdateStateDevice(EDeviceState deviceState, int id) { foreach (ListViewItem row in list_view_devices.Items) { if ((int)row.Tag == id) { row.ImageIndex = (int)deviceState; break; } } if (_controller.CurrentVideoCapture == id) { switch (deviceState) { case EDeviceState.Runing: image_state.BackColor = Color.Green; break; case EDeviceState.Recording: image_state.BackColor = Color.Red; break; case EDeviceState.Stoped: image_grid.Image = null; image_state.BackColor = SystemColors.Control; break; } } EnableDeviceButtons(); }
public DeviceInfo(string deviceId, string name, EDataFlow flow, EDeviceState state) { _deviceId = deviceId; _friendlyName = name; _dataFlow = flow; _state = state; }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { if (DeviceStateChanged != null) { DeviceStateChanged(deviceId, newState); } }
public MMDeviceCollection EnumerateAudioEndPoints(EDataFlow dataFlow, EDeviceState dwStateMask) { IMMDeviceCollection result; //Marshal.ThrowExceptionForHR(_realEnumerator.EnumAudioEndpoints(dataFlow, dwStateMask, out result)); _realEnumerator.EnumAudioEndpoints(dataFlow, dwStateMask, out result); return new MMDeviceCollection(result, dataFlow, dwStateMask); }
public int OnDeviceStateChanged(string DeviceId, EDeviceState newState) { DeviceStateChangedEventArgs arg = new DeviceStateChangedEventArgs(DeviceId, newState); _DeviceEnumerator.FireDeviceStateChangedEvent(arg); return(0); }
public void TurnOn() { if (this.PowerState != EDeviceState.BROKEN) { this.PowerState = EDeviceState.ON; } }
/// <summary> /// Find audio endpoint by name /// </summary> /// <param name="name">the name of the endpint</param> /// <param name="deviceflow">whenever it is input or output or both</param> /// <param name="state">whenever it is enabled,disabled unpluged or both</param> /// <returns>the desired endpoint</returns> public MMDevice FindEndpointByName(string name, EDataFlow deviceflow, EDeviceState state) { try { MMDevice device = null; MMDeviceCollection devices = this.GetAllAudioEndPoints(deviceflow, state); if (devices != null) { for (int i = 0; i < devices.Count; i++) { MMDevice deviceAt = devices[i]; if (deviceAt.FriendlyName.ToLower() == name) { device = deviceAt; break; } } } return(device); } catch (Exception e) { Program.Bugtracking(e); return(null); } }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { if (DeviceStateChanged != null) { DeviceStateChanged(deviceId, newState); } }
public MMDeviceCollection EnumerateAudioEndPoints(EDataFlow dataFlow, EDeviceState dwStateMask) { IMMDeviceCollection result; Marshal.ThrowExceptionForHR(_realEnumerator.EnumAudioEndpoints(dataFlow, dwStateMask, out result)); return(new MMDeviceCollection(result)); }
void IMultimediaNotificationClient.OnDeviceStateChanged(string deviceId, EDeviceState newState) { _client._deviceStateChanged.OnNext(new DeviceStateChangedArgs { DeviceId = deviceId, State = newState }); }
void ISystemAudioEventClient.OnDeviceStateChanged(string deviceId, EDeviceState newState) { var dev = GetOrAddDeviceFromRealId(deviceId); if (dev != null) { RaiseAudioDeviceChanged(new DeviceStateChangedEventArgs(dev, newState.AsDeviceState())); } }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { var inner = GetInner(); if (inner != null) { inner.OnDeviceStateChanged(deviceId, newState); } }
private void HandleStateChanged(DeviceStateChangedEventArgs stateChangedEvent) { _state = stateChangedEvent.State.AsEDeviceState(); ReloadAudioEndpointVolume(_device); ReloadAudioMeterInformation(_device); OnPropertyChanged("State"); }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { if (newState == EDeviceState.Unplugged || newState == EDeviceState.Disabled || newState == EDeviceState.NotPresent) { if (DeviceRemoved != null) DeviceRemoved(deviceId); } else if (newState == EDeviceState.Active) if (DeviceAdded != null) DeviceAdded(deviceId); }
public List <ListViewItem> GetItemGroupSorted(EDeviceState state) { ListViewGroup activeGroup = GetItemGroup(EDeviceState.Active); List <ListViewItem> list = activeGroup.Items.OfType <ListViewItem>().Select(i => i).ToList(); ListViewColumnSorter sorter = m_listDevices.ListViewItemSorter as ListViewColumnSorter; list.Sort((i1, i2) => ListViewColumnSorter.Compare(i1, i2, sorter.SortColumn, sorter.SortOrder)); return(list); }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { if (newState == EDeviceState.Unplugged || newState == EDeviceState.Disabled || newState == EDeviceState.NotPresent) { if (DeviceRemoved != null) { DeviceRemoved(deviceId); } } else if (newState == EDeviceState.Active) { if (DeviceAdded != null) { DeviceAdded(deviceId); } } }
/// <summary> /// Gets all the audio endpoints based on the criteria given /// </summary> /// <param name="edataflow"> choose if you want the input or output endpoints or both</param> /// <param name="devicestate">choose if you want to get the disabled,enabled or unpluged or all.</param> /// <returns></returns> public MMDeviceCollection GetAllAudioEndPoints(EDataFlow edataflow, EDeviceState devicestate) { try { MMDeviceCollection devices = null; devices = DevEnum.EnumerateAudioEndPoints(edataflow, devicestate); return(devices); } catch (Exception e) { Program.Bugtracking(e); return(null); } }
public ListViewGroup GetItemGroup(EDeviceState state) { switch (state) { case EDeviceState.Active: return(m_listDevices.Groups[0]); case EDeviceState.Unplugged: return(m_listDevices.Groups[1]); case EDeviceState.Disabled: return(m_listDevices.Groups[2]); case EDeviceState.NotPresent: default: return(m_listDevices.Groups[3]); } }
private void OnStateChanged(EDeviceState deviceState) { _state = deviceState; ReloadAudioEndpointVolume(); ReloadAudioMeterInformation(); ReloadAudioSessionController(); OnStateChanged(deviceState.AsDeviceState()); //only load properties if it's active if ((deviceState & EDeviceState.Active) != 0) { //Attempt to reload properties if the device has become active. //A fail-safe incase the device doesn't fire property changed events //when it becomes "active" ComThread.BeginInvoke(LoadProperties); } }
void deviceStateChanged(EDeviceState state) { if (state == EDeviceState.Offline) { lblState.Text = "Offline"; lblState.ForeColor = Color.Gray; } if (state == EDeviceState.PortOpen) { lblState.Text = "Opened"; lblState.ForeColor = Color.Yellow; } if (state == EDeviceState.Online) { Invoke(deviceConnectedMethod); lblState.Text = "Connected"; lblState.ForeColor = Color.Green; } }
/// <summary> /// Find all audio endpoint containing the given name /// </summary> /// <param name="name">the name of the endpint</param> /// <param name="deviceflow">whenever it is input or output or both</param> /// <param name="state">whenever it is enabled,disabled unpluged or both</param> /// <returns>the desired endpoint</returns> public MMDevice[] FindEndpointContaininginName(string name, EDataFlow deviceflow, EDeviceState state) { try { MMDevice[] device = null; int MaxAudio = 0; MMDeviceCollection devices = this.GetAllAudioEndPoints(deviceflow, state); if (devices != null) { for (int i = 0; i < devices.Count; i++) { MMDevice deviceAt = devices[i]; if (deviceAt.FriendlyName.Contains(name) == true) { ++MaxAudio; } } device = new MMDevice[MaxAudio]; for (int i = 0; i < devices.Count; i++) { MMDevice deviceAt = devices[i]; if (deviceAt.FriendlyName.Contains(name) == true) { device[i] = deviceAt; } } } return(device); } catch (Exception e) { Program.Bugtracking(e); return(null); } }
internal static DeviceState AsDeviceState(this EDeviceState deviceState) { switch (deviceState) { case EDeviceState.Active: return(DeviceState.Active); case EDeviceState.Disabled: return(DeviceState.Disabled); case EDeviceState.NotPresent: return(DeviceState.NotPresent); case EDeviceState.Unplugged: return(DeviceState.Unplugged); case EDeviceState.All: return(DeviceState.All); default: throw new ArgumentOutOfRangeException(nameof(deviceState)); } }
private void HandleStateChanged(DeviceStateChangedEventArgs stateChangedEvent) { _state = stateChangedEvent.State.AsEDeviceState(); ReloadAudioEndpointVolume(_device); ReloadAudioMeterInformation(_device); OnPropertyChanged("State"); }
public DeviceFullInfo(MMDevice device) : base(device) { IconPath = device.IconPath; State = device.State; }
public void UpdateStateDevice(EDeviceState deviceState, int id) { _view.UpdateStateDevice(deviceState, id); }
internal void FireOnDeviceStateChanged([MarshalAs(UnmanagedType.LPWStr)] string deviceId, EDeviceState newState) { //Debug.WriteLine("FireOnDeviceStateChanged"); _OnDeviceStateChanged?.Invoke(deviceId, newState); }
public void TurnOff() { this.PowerState = EDeviceState.OFF; }
internal void FireOnDeviceStateChanged(string deviceId, EDeviceState newState) { }
void SelectedPort_Disposed(EDeviceState state, SerialManager sm) { Invoke(DeviceStateChanged, state, sm); }
void OnDeviceStatusChanged(EDeviceState state, SerialManager sm) { ShowMessage(device.PortName + " --> " + state); if (state == EDeviceState.Offline) { DisableItems(); device = null; } }
protected void ChangeState(EDeviceState state) { if (state >= EDeviceState.Online) { btnSerialStatus.ForeColor = Color.Green; } if (state == EDeviceState.Busy) { btnSerialStatus.ForeColor = Color.Orange; } if (state == EDeviceState.Offline) { btnSerialStatus.ForeColor = Color.DarkRed; } if (state == EDeviceState.Error) { btnSerialStatus.ForeColor = Color.Red; } btnSerialStatus.Text = state.ToString(); }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { parent.FireOnDeviceStateChanged(deviceId, newState); }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { throw new NotImplementedException(); }
public ElectricDevice() { this.PowerState = EDeviceState.OFF; }
public int OnDeviceStateChanged(string DeviceId, EDeviceState newState) { DeviceStateChangedEventArgs arg = new DeviceStateChangedEventArgs(DeviceId, newState); _DeviceEnumerator.FireDeviceStateChangedEvent(arg); return 0; }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { throw new NotImplementedException(); }
public DeviceStateChangedEventArgs(string deviceId, EDeviceState newState) { DeviceId = deviceId; NewState = newState; }
internal MMDeviceCollection(IMMDeviceCollection parent, EDataFlow flow, EDeviceState state) { _MMDeviceCollection = parent; DataFlow = flow; DeviceState = state; }
public DeviceInfo(string deviceId, string name, EDataFlow flow, EDeviceState state) { _deviceId = deviceId; _friendlyName = name; _dataFlow = flow; _state = state; }
void ISystemAudioEventClient.OnDeviceStateChanged(string deviceId, EDeviceState newState) { RaiseAudioDeviceChanged(new AudioDeviceChangedEventArgs(GetDevice(CoreAudioDevice.SystemIdToGuid(deviceId)), AudioDeviceEventType.StateChanged)); }
internal MMDeviceCollection(IMMDeviceCollection parent, EDataFlow flow, EDeviceState state) { _MMDeviceCollection = parent; DataFlow = flow; DeviceState = state; }
public void OnDeviceStateChanged(string deviceId, EDeviceState newState) { var inner = GetInner(); if(inner != null) inner.OnDeviceStateChanged(deviceId, newState); }
public DeviceFullInfo(string name, string id, EDataFlow type, string iconPath, EDeviceState state) : base(name, id, type) { IconPath = iconPath; State = state; }
public DeviceStateChangedEventArgs(string deviceId, EDeviceState newState) { DeviceId = deviceId; NewState = newState; }
void UART_Server_OnStateChange(EDeviceState state, SerialManager sm) { try { Invoke(new Action<EDeviceState>(ChangeState), state); } catch(Exception e) { } }
public Section(EDeviceState state, string name, CGColor color) { this.state = state; this.name = name; this.color = color; }