Esempio n. 1
0
        /// <summary> 将按下的按键转换为键盘上的按键名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KeyName_textBox_KeyDown(object sender, KeyEventArgs e)
        {
            TextBox CurrentControl = (TextBox)sender;

            CurrentEntity.ShortCutKey = e.KeyValue.ToString();
            CurrentControl.Text       = UniversalMethod.GetKeyName(CurrentEntity.ShortCutKey);
        }
Esempio n. 2
0
        /// <summary> 特殊按钮被点击
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SpecialKey_button_Click(object sender, EventArgs e)
        {
            frmShortcutKey_Edit_SpecialKey frm = new frmShortcutKey_Edit_SpecialKey();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                string KeyNum = frm.KeyNum;
                CurrentEntity.ShortCutKey = KeyNum;
                KeyName_textBox.Text      = UniversalMethod.GetKeyName(CurrentEntity.ShortCutKey);
            }
        }
Esempio n. 3
0
        /// <summary> 刷新DataGridView
        ///
        /// </summary>
        private void RefreshDataGridView()
        {
            string CurrentSelectID = CurrentNode_dataGridView.GetSelectedRowValue("ShortCutKeyID");


            TreeNode            CurrentNode          = ShortcutKey_otTreeView.SelectedNode;
            List <tShortCutKey> tShortCutKeyListTemp = new List <tShortCutKey>();

            if (CurrentNode == null || CurrentNode.Name == "BaseNode")
            {
                tShortCutKeyListTemp = tShortCutKeyDataSource.Where(T1 => string.IsNullOrEmpty(T1.ParentID)).ToList();
            }
            else
            {
                tShortCutKeyListTemp = tShortCutKeyDataSource.Where(T1 => CurrentNode.Name == T1.ParentID).ToList();
            }

            List <vShortCutKey> vShortCutKeyListTemp = new List <vShortCutKey>();//最终的数据源

            foreach (tShortCutKey tShortCutKeyItem in tShortCutKeyListTemp)
            {
                vShortCutKey vShortCutKeyTemp = UniversalMethod.ClassToClass <tShortCutKey, vShortCutKey>(tShortCutKeyItem, new vShortCutKey());
                vShortCutKeyTemp.Icon                = tShortCutKeyItem.ShortCutKeyImg.ToImage();
                vShortCutKeyTemp.TargetIcon          = tShortCutKeyItem.TargetProgramImg.ToImage();
                vShortCutKeyTemp.KeyName             = UniversalMethod.GetKeyName(tShortCutKeyItem.ShortCutKey);
                vShortCutKeyTemp.ShortCutKeyTypeName = UniversalMethod.GetTypeName(tShortCutKeyItem.ShortCutKeyType);
                vShortCutKeyTemp.OwningChidrenNode   = OwningChidren(vShortCutKeyTemp);
                vShortCutKeyListTemp.Add(vShortCutKeyTemp);
            }
            CurrentNode_dataGridView.DataSource = vShortCutKeyListTemp;

            #region  子节点的话就用颜色区分出来
            foreach (DataGridViewRow Rowitem in CurrentNode_dataGridView.Rows)
            {
                if (Rowitem.Cells["IsChidren"].Value.ToString() == "True")
                {
                    DataGridViewCellStyle CellStyleTemp = Rowitem.DefaultCellStyle;
                    CellStyleTemp.BackColor = Color.Blue;
                    //CellStyleTemp.SelectionBackColor = ShortcutKeyItem_Box.ShortcutKeyItem_Box_StateColor.OwiningChidren.Click;
                }
            }
            #endregion  子节点的话就用颜色区分出来

            CurrentNode_dataGridView.SetSelectedRowByValue("ShortCutKeyID", CurrentSelectID);
        }
        private void FillContent()
        {
            if (CurrentEntity == null)
            {
                return;
            }
            Img_pictureBox.Image = CurrentEntity.ShortCutKeyImg.ToImage();
            Name_textBox.Text    = CurrentEntity.ShortCutKeyName;


            Target_pictureBox.Image = CurrentEntity.TargetProgramImg.ToImage();
            Program_textBox.Text    = CurrentEntity.TargetProgramName;

            KeyName_textBox.Text  = UniversalMethod.GetKeyName(CurrentEntity.ShortCutKey);
            TypeName_textBox.Text = UniversalMethod.GetTypeName(CurrentEntity.ShortCutKeyType);


            if (CurrentEntity.ShortCutKeyType == 2)
            {
                Path_panel.Visible          = false;
                SysShortcutKey_textBox.Text = CurrentEntity.ShortCutKeyPath;
            }
            else
            {
                Path_panel.Visible = true;
                Path_textBox.Text  = CurrentEntity.ShortCutKeyPath;
            }
            LongPress_checkBox.Checked = CurrentEntity.LongPress == 2;

            string ParentName = "根目录";

            if (!string.IsNullOrEmpty(CurrentEntity.ParentID))
            {
                tShortCutKey tShortCutKeyTemp = new ShortcutKeyManageService().GettShortCutKeyList(new tShortCutKey()
                {
                    ShortCutKeyID = CurrentEntity.ParentID
                }).FirstOrDefault();
                if (tShortCutKeyTemp != null)
                {
                    ParentName = tShortCutKeyTemp.ShortCutKeyName;
                }
            }
            ParentNode_textBox.Text = ParentName;
        }
Esempio n. 5
0
        /// <summary> 将按下的按键转换为键盘上的按键名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SysShortcutKey_textBox_KeyDown(object sender, KeyEventArgs e)
        {
            List <string> KeyList = new List <string>();

            if (e.Control)
            {
                KeyList.Add("Control");
            }
            if (e.Alt)
            {
                KeyList.Add("Alt");
            }
            if (e.Shift)
            {
                KeyList.Add("Shift");
            }

            List <Keys> KeysEnumList = new List <Keys>();

            KeysEnumList.Add(Keys.Control);
            KeysEnumList.Add(Keys.ControlKey);
            KeysEnumList.Add(Keys.LControlKey);
            KeysEnumList.Add(Keys.RControlKey);
            KeysEnumList.Add(Keys.Shift);
            KeysEnumList.Add(Keys.ShiftKey);
            KeysEnumList.Add(Keys.LShiftKey);
            KeysEnumList.Add(Keys.RShiftKey);
            KeysEnumList.Add(Keys.Alt);
            KeysEnumList.Add(Keys.Menu);
            KeysEnumList.Add(Keys.LMenu);
            KeysEnumList.Add(Keys.RMenu);

            if (!KeysEnumList.Contains(e.KeyCode))
            {
                KeyList.Add(UniversalMethod.GetKeyName(e.KeyValue.ToString()));
            }
            SysShortcutKey_textBox.Text = string.Join("+", KeyList);
        }