コード例 #1
0
            public DataST(string name,
                          string path,
                          string id,
                          ImageSource _is         = null,
                          byte[] icon             = null,
                          string arguments        = "",
                          int isuesd              = 0,
                          int runas               = 0,
                          int autorun             = 0,
                          int levels              = 0,
                          string workingdirectory = "",
                          string tagname          = "",
                          HotKeyItem hotkey       = null,
                          bool enablehotkey       = false)

            {
                Name             = name;
                Path             = path;
                ID               = id;
                IS               = _is;
                Icon             = icon;
                Arguments        = arguments;
                IsUesd           = isuesd;
                RunAs            = runas;
                AutoRun          = autorun;
                Levels           = levels;
                WorkingDirectory = workingdirectory;
                tagName          = tagname;
                HotKey           = hotkey;
                EnableHotKey     = enablehotkey;
            }
コード例 #2
0
ファイル: Manage.cs プロジェクト: vidalouiswang/Anything_wpf
        /// <summary>
        /// 检测是否冲突并注册热键
        /// </summary>
        /// <param name="HKI">HotKeyItem</param>
        /// <returns></returns>
        public static bool CheckAndRegisterHotKey(HotKeyItem HKI)
        {
            if (HKI.ID == 0x0000)
            {
                HKI.ID = ++HotKey.CurrentID;
            }

            if (HotKey.TestHotKey(HKI.ModifiersValue, HKI.KeyValue, HKI.ID, false))
            {
                listOfApplicationHotKey.Add(HKI);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public void AddHotKey(UserControls.HotKeyVisualItem HKVI)
        {
            int Set = -1;

            if (!EnableHotKey)
            {
                Set = 0;
            }
            else
            {
                if (data.HotKey.KeyValue != HKVI.KeyValue || data.HotKey.ModifiersValue != HKVI.ModifiersValue)
                {
                    Set = 1;
                }
            }
            if (Set > 0)
            {
                int id = 0;
                if (Set == 0)
                {
                    id = ++Anything_wpf_main_.cls.HotKey.CurrentID;
                }
                else if (Set == 1)
                {
                    id = this.data.HotKey.ID;
                }

                HotKeyItem hki = new HotKeyItem(this, HKVI.KeyValue, HKVI.ModifiersValue, id, HotKeyItem.HotKeyParentType.Item);

                this.HotKey = hki;

                if (Manage.CheckAndRegisterHotKey(hki))
                {
                    objDB.Insert("HotKey", data.HotKey.KeyValue.ToString() + "," + data.HotKey.ModifiersValue.ToString() + "," + data.HotKey.ID.ToString());
                }
                EnableHotKey = true;
            }
        }
コード例 #4
0
ファイル: Manage.cs プロジェクト: vidalouiswang/Anything_wpf
        /// <summary>
        /// 检查待注册的热键是否冲突,若不冲突则注册,否则返回false
        /// </summary>
        /// <param name="HKVI">HotKeyVisualItem</param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool CheckAndRegisterHotKey(HotKeyVisualItem HKVI, object iParent, int id = -65536)
        {
            bool StatusAvailable = true;

            if (HKVI.Available)
            {
                if (id == -65536)
                {
                    id = ++HotKey.CurrentID;
                }

                HotKeyItem hki = new HotKeyItem(iParent, HKVI.KeyValue, HKVI.ModifiersValue, id, HotKeyItem.HotKeyParentType.Item);

                foreach (HotKeyItem h in listOfApplicationHotKey)
                {
                    if (hki.ID == h.ID)
                    {
                        StatusAvailable = false;
                        break;
                    }
                }

                if (StatusAvailable)
                {
                    listOfApplicationHotKey.Add(hki);
                    HotKey.RegisterHotKey(new System.Windows.Interop.WindowInteropHelper(WindowMain).Handle, hki.ID, hki.ModifiersValue, (uint)hki.KeyValue);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }