ScreenToGif/Util/SimpleKeyGesture.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
using System.Windows.Input;
using System.Windows.Markup;

namespace ScreenToGif.Util
{
    ///<summary>
    ///Defines a keyboard combination that can be used to invoke a command.
    ///</summary>
    [DataContract]
    [ValueSerializer(typeof(KeyGestureValueSerializer))]
    [TypeConverter(typeof(KeyGestureConverter))]
    public class SimpleKeyGesture// : InputGesture
    {
        [IgnoreDataMember]
        private static readonly TypeConverter KeyGestureConverter = new KeyGestureConverter();

        /// <summary>Gets the modifier keys associated with this <see cref="T:System.Windows.Input.KeyGesture" />.</summary>
        /// <returns>The modifier keys associated with the gesture. The default value is <see cref="F:System.Windows.Input.ModifierKeys.None" />.</returns>
        [DataMember(EmitDefaultValue = false, Name = "Mod")]
        public ModifierKeys Modifiers { get; set; }

        /// <summary>Gets the key associated with this <see cref="T:System.Windows.Input.KeyGesture" />.</summary>
        /// <returns>The key associated with the gesture.  The default value is <see cref="F:System.Windows.Input.Key.None" />.</returns>
        [DataMember]
        public Key Key { get; set; }

        /// <summary>Gets a string representation of this <see cref="T:System.Windows.Input.KeyGesture" />.</summary>
        /// <returns>The display string for this <see cref="T:System.Windows.Input.KeyGesture" />. The default value is <see cref="F:System.String.Empty" />.</returns>
        [IgnoreDataMember]
        public string DisplayString { get; }

        /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Input.KeyGesture" /> class with the specified <see cref="T:System.Windows.Input.Key" />. </summary>
        /// <param name="key">The key associated with this gesture.</param>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">
        /// <paramref name="key" /> is not a valid <see cref="T:System.Windows.Input.Key" />.</exception>
        /// <exception cref="T:System.NotSupportedException">
        /// <paramref name="key" /> is not a valid <see cref="T:System.Windows.Input.KeyGesture" />.</exception>
        public SimpleKeyGesture(Key key) : this(key, ModifierKeys.None)
        { }

        /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Input.KeyGesture" /> class with the specified <see cref="T:System.Windows.Input.Key" /> and <see cref="T:System.Windows.Input.ModifierKeys" />.</summary>
        /// <param name="key">The key associated with the gesture.</param>
        /// <param name="modifiers">The modifier keys associated with the gesture.</param>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">
        /// <paramref name="modifiers" /> is not a valid <see cref="T:System.Windows.Input.ModifierKeys" />-or-<paramref name="key" /> is not a valid <see cref="T:System.Windows.Input.Key" />.</exception>
        /// <exception cref="T:System.NotSupportedException">
        /// <paramref name="key" /> and <paramref name="modifiers" /> do not form a valid <see cref="T:System.Windows.Input.KeyGesture" />.</exception>
        public SimpleKeyGesture(Key key, ModifierKeys modifiers) : this(key, modifiers, string.Empty)
        { }

        /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Input.KeyGesture" /> class with the specified <see cref="T:System.Windows.Input.Key" />, <see cref="T:System.Windows.Input.ModifierKeys" />, and display string.</summary>
        /// <param name="key">The key associated with the gesture.</param>
        /// <param name="modifiers">The modifier keys associated with the gesture.</param>
        /// <param name="displayString">A string representation of the <see cref="T:System.Windows.Input.KeyGesture" />.</param>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">
        /// <paramref name="modifiers" /> is not a valid <see cref="T:System.Windows.Input.ModifierKeys" />-or-<paramref name="key" /> is not a valid <see cref="T:System.Windows.Input.Key" />.</exception>
后面还有 121 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。