public void SendMutedChangeEnocderNumber(DeviceVolChangedEventArgs e) { if (e.EncoderNumbers.Count >= 1) { RaiseDeviceVolChangedEvent(e); } }
private void _deviceController_DeviceVolChangedEvent(object sender, DeviceVolChangedEventArgs e) { if (e.Muted) { _serialCon.SendMutedChange(e.Name); _webAccessHost.SendMutedChangeEnocderNumber(e); } else { _serialCon.SendMVolChange(e.Name, e.Volume); _webAccessHost.SendVolChangedEncoderNumber(e); } }
protected virtual void RaiseDeviceVolChangedEvent(DeviceVolChangedEventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler <DeviceVolChangedEventArgs> raiseEvent = DeviceVolChangedEvent; // Event will be null if there are no subscribers if (raiseEvent != null) { raiseEvent(this, e); } GlobalHost.ConnectionManager.GetHubContext <WebControlHub>().Clients.All.updateVol(e.EncoderNumbers, e.Muted, e.Volume * 100); }