protected virtual void RaiseWebCommandEvent(CommandFromWebEventArgs 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 <CommandFromWebEventArgs> raiseEvent = WebCommandEvent;

            // Event will be null if there are no subscribers
            if (raiseEvent != null)
            {
                raiseEvent(this, e);
            }
        }
Exemple #2
0
        private void _webAccessHost_WebCommandEvent(object sender, CommandFromWebEventArgs e)
        {
            switch (e.WebCommand)
            {
            case WebCommandEnum.VOLCHANGE:
            {
                _deviceController.VolumeSet(e.EncoderNumber, e.Volume);
            }
            break;

            case WebCommandEnum.MUTED:
            {
                _deviceController.Mute(e.EncoderNumber);
            }
            break;

            case WebCommandEnum.UNMUTED:
            {
                _deviceController.UnMute(e.EncoderNumber);
            }
            break;

            case WebCommandEnum.REBINDENCODER:
            {
                if (e.SessionProcessID <= 0)
                {
                    _deviceController.BindEncoderToDevice(e.EncoderNumber, e.DeviceBindingID);
                }
                else
                {
                    _deviceController.BindEncoderToSession(e.EncoderNumber, e.DeviceBindingID, e.SessionProcessID);
                }
            }
            break;

            default:
                break;
            }
        }