Exemple #1
0
        private void ExternalDisplay_EventReceived(object sender, ExternalEventArgs e)
        {
            if (e.Action == ExternalAction.Click)
            {
                KeyCode?key;
                switch (e.Command)
                {
                case "key_next":
                    key = KeyCode.MEDIA_NEXT_TRACK;
                    break;

                case "key_play_pause":
                    key = KeyCode.MEDIA_PLAY_PAUSE;
                    break;

                case "key_previous":
                    key = KeyCode.MEDIA_PREV_TRACK;
                    break;

                case "key_stop":
                    key = KeyCode.MEDIA_STOP;
                    break;

                case "key_volume_down":
                    key = KeyCode.VOLUME_DOWN;
                    break;

                case "key_volume_up":
                    key = KeyCode.VOLUME_UP;
                    break;

                default:
                    key = null;
                    break;
                }
                if (key != null)
                {
                    SendKeyPress(key.Value);
                }
            }
            else
            {
                StateChangedArgs args = new StateChangedArgs();
                if (e.Action == ExternalAction.Brightness)
                {
                    displayBrightness = Convert.ToInt32(e.Command);
                    args.Brightness   = displayBrightness;
                }
                else if (e.Action == ExternalAction.ConnectionChanged)
                {
                    args.DisplayStatus = (DisplayStatus)e.Command;
                }
                listeners?.BeginInvoke(args, (ar) => { }, null);
            }
        }
Exemple #2
0
        private void RefreshTimer_Tick(object sender, ElapsedEventArgs e)
        {
            StateChangedArgs args = new StateChangedArgs();

            if (displayStatus != externalDisplay.Status)
            {
                displayStatus      = externalDisplay.Status;
                args.DisplayStatus = displayStatus;
            }

            if (displayStatus == DisplayStatus.Connected)
            {
                RefreshDataToDisplay();
            }
            args.StreamBandwidthInKb = externalDisplay.StreamBandwidthInKb;
            listeners?.BeginInvoke(args, (ar) => { }, null);
        }
Exemple #3
0
 private void Worker_Listener(StateChangedArgs changes)
 {
     Invoke(new MethodInvoker(() => {
         if (changes.Brightness != null)
         {
             trb_display_brightness.Value    = Convert.ToInt32(changes.Brightness.Value) / 10;
             trb_display_brightness.Enabled  = true;
             lbl_display_brightness_set.Text = Convert.ToString(changes.Brightness.Value);
         }
         if (changes.DisplayStatus != null)
         {
             editStatus(changes.DisplayStatus.Value);
         }
         lbl_bandwidth.Text = changes.StreamBandwidthInKb + " kb/s";
     }
                              ));
 }