コード例 #1
0
ファイル: ValueChangeLogSection.cs プロジェクト: rputch/atata
        public ValueChangeLogSection(UIComponent component, string changeAction, object value)
            : base(component)
        {
            string valueAsString = SpecialKeys.Replace(Stringifier.ToString(value));

            Message = $"{changeAction} {valueAsString} in {component.ComponentFullName}";
        }
コード例 #2
0
ファイル: ValueSetLogSection.cs プロジェクト: rputch/atata
        public ValueSetLogSection(UIComponent component, object value)
            : base(component)
        {
            string valueAsString = SpecialKeys.Replace(Stringifier.ToString(value));

            Message = $"Set {valueAsString} to {component.ComponentFullName}";
        }
コード例 #3
0
        public PressKeysLogSection(UIComponent component, string keys)
            : base(component)
        {
            Keys = keys;

            Message = $"Press \"{SpecialKeys.Replace(keys)}\" key{(keys?.Length == 1 ? null : "s")}";
        }
コード例 #4
0
        /// <summary>
        /// Sends a keyboard combination that would otherwise be reserved for the client PC.
        /// </summary>
        /// <param name="keys">SpecialKeys is an enumerated list of supported keyboard combinations.</param>
        /// <remarks>Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.</remarks>
        /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not in the Connected state.</exception>
        public void SendSpecialKeys(SpecialKeys keys, bool release)
        {
            InsureConnection(true);
            // For all of these I am sending the key presses manually instead of calling
            // the keyboard event handlers, as I don't want to propegate the calls up to the
            // base control class and form.
            switch (keys)
            {
            case SpecialKeys.Ctrl:
                PressKeys(new uint[] { 0xffe3 }, release);                              // CTRL, but don't release
                break;

            case SpecialKeys.Alt:
                PressKeys(new uint[] { 0xffe9 }, release);                              // ALT, but don't release
                break;

            case SpecialKeys.CtrlAltDel:
                PressKeys(new uint[] { 0xffe3, 0xffe9, 0xffff }, release);                         // CTRL, ALT, DEL
                break;

            case SpecialKeys.AltF4:
                PressKeys(new uint[] { 0xffe9, 0xffc1 }, release);                         // ALT, F4
                break;

            case SpecialKeys.CtrlEsc:
                PressKeys(new uint[] { 0xffe3, 0xff1b }, release);                         // CTRL, ESC
                break;

            // TODO: are there more I should support???
            default:
                break;
            }
        }
コード例 #5
0
        public static string EncodeSpecialKey(SpecialKeys key)
        {
            return(keyEncodingCache.GetOrAdd(
                       key,
                       newKey =>
            {
                var attribute = newKey.GetEnumValueCustomAttribute <SpecialKeyEncodingAttribute>();

                return attribute.Encoding;
            }));
        }
コード例 #6
0
 private async void RokuKeyPress(SpecialKeys key)
 {
     if (_roku == null)
     {
         return;
     }
     try {
         await _roku.KeyPressAsync(key);
     } catch (Exception) {
         MessageBox.Show(this, "Could not connect to the Roku device.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #7
0
        public void SendSpecialKeys(SpecialKeys Keys)
        {
            try
            {
                switch (Keys)
                {
                case ProtocolVNC.SpecialKeys.CtrlAltDel:
                    _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
                    break;

                case ProtocolVNC.SpecialKeys.CtrlEsc:
                    _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
                    break;
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSendSpecialKeysFailed + Environment.NewLine + ex.Message, true);
            }
        }
コード例 #8
0
        public void SendSpecialKeys(SpecialKeys Keys)
        {
            try
            {
                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (Keys)
                {
                case SpecialKeys.CtrlAltDel:
                    _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
                    break;

                case SpecialKeys.CtrlEsc:
                    _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
                    break;
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSendSpecialKeysFailed + Environment.NewLine + ex.Message, true);
            }
        }
コード例 #9
0
        public void SendSpecialKeys(SpecialKeys Keys)
        {
            try
            {
                switch (Keys)
                {
                case SpecialKeys.CtrlAltDel:
                    VNC_Client.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
                    break;

                case SpecialKeys.CtrlEsc:
                    VNC_Client.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
                    break;
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                    Language.strVncSendSpecialKeysFailed + Constants.vbNewLine +
                                                    ex.Message, true);
            }
        }
コード例 #10
0
ファイル: VncDesktop.cs プロジェクト: cdhunt/EasyConnect
 /// <summary>
 /// Sends a keyboard combination that would otherwise be reserved for the client PC.
 /// </summary>
 /// <param name="keys">SpecialKeys is an enumerated list of supported keyboard combinations.</param>
 /// <remarks>Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.</remarks>
 /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not in the Connected state.</exception>
 public void SendSpecialKeys(SpecialKeys keys, bool release)
 {
     InsureConnection(true);
     // For all of these I am sending the key presses manually instead of calling
     // the keyboard event handlers, as I don't want to propegate the calls up to the
     // base control class and form.
     switch (keys)
     {
         case SpecialKeys.Ctrl:
             PressKeys(new uint[] { 0xffe3 }, release);	// CTRL, but don't release
             break;
         case SpecialKeys.Alt:
             PressKeys(new uint[] { 0xffe9 }, release);	// ALT, but don't release
             break;
         case SpecialKeys.CtrlAltDel:
             PressKeys(new uint[] { 0xffe3, 0xffe9, 0xffff }, release); // CTRL, ALT, DEL
             break;
         case SpecialKeys.AltF4:
             PressKeys(new uint[] { 0xffe9, 0xffc1 }, release); // ALT, F4
             break;
         case SpecialKeys.CtrlEsc:
             PressKeys(new uint[] { 0xffe3, 0xff1b }, release); // CTRL, ESC
             break;
         // TODO: are there more I should support???
         default:
             break;
     }
 }
コード例 #11
0
ファイル: Input.cs プロジェクト: Michael-Manning/GlDrawer
 /// <summary>
 /// Returns true if the key was lifted during the current frame
 /// <param name="button">keycode to check if lifted</param>>
 /// </summary>
 public bool GetSpecialKeyUp(SpecialKeys button)
 {
     return(GLWrapper.getKeyUp((int)button));
 }
コード例 #12
0
 public void SendSpecialKeys(SpecialKeys Keys)
 {
     try
     {
         switch (Keys)
         {
             case SpecialKeys.CtrlAltDel:
                 _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel);
                 break;
             case SpecialKeys.CtrlEsc:
                 _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc);
                 break;
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strVncSendSpecialKeysFailed + Environment.NewLine + ex.Message, true);
     }
 }
コード例 #13
0
ファイル: VncDesktop.cs プロジェクト: cdhunt/EasyConnect
 /// <summary>
 /// Sends a keyboard combination that would otherwise be reserved for the client PC.
 /// </summary>
 /// <param name="keys">SpecialKeys is an enumerated list of supported keyboard combinations.</param>
 /// <remarks>Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.</remarks>
 /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not in the Connected state.</exception>
 public void SendSpecialKeys(SpecialKeys keys)
 {
     this.SendSpecialKeys(keys, true);
 }
コード例 #14
0
ファイル: SongGridViewControl.cs プロジェクト: pascalfr/MPfm
        public void KeyDown(char key, SpecialKeys specialKeys, ModifierKeys modifierKeys, bool isRepeat)
        {
            if (_columns == null || _songCache == null)
                return;

            int selectedIndex = -1;
            int scrollbarOffsetY = (_startLineNumber * _songCache.LineHeight) - VerticalScrollBar.Value;
            var startEndIndexes = GetStartIndexAndEndIndexOfSelectedRows();

            if (specialKeys == SpecialKeys.Enter)
            {
                OnItemDoubleClick(_items[startEndIndexes.Item1].AudioFile.Id, startEndIndexes.Item1);
                NowPlayingAudioFileId = _items [startEndIndexes.Item1].AudioFile.Id;
                return;
            }

            switch (specialKeys)
            {
                case SpecialKeys.Down:
                    if (startEndIndexes.Item1 < _items.Count - 1)
                    {
                        selectedIndex = startEndIndexes.Item1;
                        while (selectedIndex >= 0 && selectedIndex <= _items.Count - 1)
                        {
                            selectedIndex++;
                            if (!_items[selectedIndex].IsEmptyRow)
                                break;
                        }
                    }
                    break;
                case SpecialKeys.Up:
                    if (startEndIndexes.Item1 > 0)
                    {
                        selectedIndex = startEndIndexes.Item1;
                        while (selectedIndex >= 0 && selectedIndex <= _items.Count - 1)
                        {
                            selectedIndex--;
                            if (!_items[selectedIndex].IsEmptyRow)
                                break;
                        }
                    }
                    break;
                case SpecialKeys.PageDown:
                    selectedIndex = startEndIndexes.Item1 + _songCache.NumberOfLinesFittingInControl - 2; // 2 is header + scrollbar height
                    selectedIndex = Math.Min(selectedIndex, _items.Count - 1);

                    if (selectedIndex == _items.Count - 1)
                    {
                        // If we are to select the last item, make sure the item we're selecting is NOT an empty row
                        selectedIndex = _items.FindLastIndex(x => !x.IsEmptyRow);
                    } 
                    else
                    {
                        // Continue to interate until we find a selectable row
                        while (selectedIndex >= 0 && selectedIndex <= _items.Count - 1)
                        {
                            selectedIndex++;
                            if (!_items[selectedIndex].IsEmptyRow)
                                break;
                        }
                    }
                    break;
                case SpecialKeys.PageUp:
                    selectedIndex = startEndIndexes.Item1 - _songCache.NumberOfLinesFittingInControl + 2; 
                    selectedIndex = Math.Max(selectedIndex, 0);

                    if (selectedIndex > 0)
                    {
                        while (selectedIndex >= 0 && selectedIndex <= _items.Count - 1)
                        {
                            selectedIndex--;
                            if (!_items[selectedIndex].IsEmptyRow)
                                break;
                        }
                    }
                    break;
                case SpecialKeys.Home:
                    selectedIndex = 0; // First item cannot be empty
                    break;
                case SpecialKeys.End:
                    selectedIndex = _items.FindLastIndex(x => !x.IsEmptyRow);
                    break;
            }

            if (selectedIndex == -1)
                return;

            ResetSelection();
            _items[selectedIndex].IsSelected = true;

            // Check if new selection is out of bounds of visible area
            float y = ((selectedIndex - _startLineNumber + 1)*_songCache.LineHeight) + scrollbarOffsetY;
            //Console.WriteLine("SongGridViewControl - KeyDown - y: {0} scrollbarOffsetY: {1} VerticalScrollBar.Value: {2}", y, scrollbarOffsetY, VerticalScrollBar.Value);

            int newVerticalScrollBarValue = VerticalScrollBar.Value;
            switch (specialKeys)
            {
                case SpecialKeys.Down:
                    // Check for out of bounds
                    if (y > Frame.Height - HorizontalScrollBar.Height - _songCache.LineHeight)
                        newVerticalScrollBarValue = VerticalScrollBar.Value + _songCache.LineHeight;
                    break;
                case SpecialKeys.Up:
                    // Check for out of bounds
                    if (y < _songCache.LineHeight)
                        newVerticalScrollBarValue = VerticalScrollBar.Value - _songCache.LineHeight;
                    break;
                case SpecialKeys.PageDown:
                    int heightToScrollDown = ((startEndIndexes.Item1 - _startLineNumber) * _songCache.LineHeight) + scrollbarOffsetY;
                    newVerticalScrollBarValue = VerticalScrollBar.Value + heightToScrollDown;
                    break;
                case SpecialKeys.PageUp:
                    int heightToScrollUp = ((_startLineNumber + _songCache.NumberOfLinesFittingInControl - startEndIndexes.Item1 - 2) * _songCache.LineHeight) - scrollbarOffsetY;
                    newVerticalScrollBarValue = VerticalScrollBar.Value - heightToScrollUp;
                    break;
                case SpecialKeys.Home:
                    newVerticalScrollBarValue = 0;
                    break;
                case SpecialKeys.End:
                    newVerticalScrollBarValue = VerticalScrollBar.Maximum;
                    break;
            }

            // Make sure we don't scroll out of bounds
            if (newVerticalScrollBarValue > VerticalScrollBar.Maximum)
                newVerticalScrollBarValue = VerticalScrollBar.Maximum;
            if (newVerticalScrollBarValue < 0)
                newVerticalScrollBarValue = 0;
            VerticalScrollBar.Value = newVerticalScrollBarValue;

            // Is this necessary when scrolling the whole area? it will refresh all anyway
            //OnInvalidateVisualInRect(new BasicRectangle(albumArtCoverWidth - HorizontalScrollBar.Value, y, Frame.Width - albumArtCoverWidth + HorizontalScrollBar.Value, _songCache.LineHeight));
            OnInvalidateVisual();
        }
コード例 #15
0
ファイル: PressedKey.cs プロジェクト: philliphoff/RokuDotNet
 public PressedKey(SpecialKeys key)
 {
     this.specialKey = key;
     this.literalKey = null;
 }
コード例 #16
0
ファイル: SongGridViewControl.cs プロジェクト: pascalfr/MPfm
 public void KeyUp(char key, SpecialKeys specialKeys, ModifierKeys modifierKeys, bool isRepeat)
 {
 }
コード例 #17
0
ファイル: VNCConnection.cs プロジェクト: RSchwoerer/Terminals
 public void SendSpecialKeys(SpecialKeys Keys)
 {
     this.rd.SendSpecialKeys(Keys);
 }
コード例 #18
0
 /// <summary>
 /// Sends a keyboard combination that would otherwise be reserved for the client PC.
 /// </summary>
 /// <param name="keys">SpecialKeys is an enumerated list of supported keyboard combinations.</param>
 /// <remarks>Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.</remarks>
 /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not in the Connected state.</exception>
 public void SendSpecialKeys(SpecialKeys keys)
 {
     this.SendSpecialKeys(keys, true);
 }
コード例 #19
0
 // Constructor
 public KeyControl(SpecialKeys key, string name)
 {
     // Initialize
     this.key  = (int)key;
     this.name = name;
 }
コード例 #20
0
ファイル: VNCConnection.cs プロジェクト: RSchwoerer/Terminals
 public void SendSpecialKeys(SpecialKeys Keys)
 {
     this.rd.SendSpecialKeys(Keys);
 }