public static IEnumerable <TreeKey> GetButtonSeiralTreeData() {//构造列表树 List <TreeKey> Nodes = new List <TreeKey>(); TreeKey buttonDataKey0 = new TreeKey(); buttonDataKey0.Text = "左键"; TreeKey buttonDataKey0_Sub1 = new TreeKey(); buttonDataKey0_Sub1.Text = "左键触摸"; buttonDataKey0.Children.Add(buttonDataKey0_Sub1); buttonDataKey0_Sub1._treeTag = new KeyTreeNodeTag(); buttonDataKey0_Sub1._treeTag.keyType = 0x01; TreeKey buttonDataKey0_Sub2 = new TreeKey(); buttonDataKey0_Sub2.Text = "左键按压"; buttonDataKey0.Children.Add(buttonDataKey0_Sub2); buttonDataKey0_Sub2._treeTag = new KeyTreeNodeTag(); buttonDataKey0_Sub2._treeTag.keyType = 0x11; TreeKey buttonDataKey1 = new TreeKey(); buttonDataKey1.Text = "右键"; TreeKey buttonDataKey1_Sub1 = new TreeKey(); buttonDataKey1_Sub1.Text = "左键触摸"; buttonDataKey1.Children.Add(buttonDataKey1_Sub1); buttonDataKey1_Sub1._treeTag = new KeyTreeNodeTag(); buttonDataKey1_Sub1._treeTag.keyType = 0x02; TreeKey buttonDataKey1_Sub2 = new TreeKey(); buttonDataKey1_Sub2.Text = "左键按压"; buttonDataKey1.Children.Add(buttonDataKey1_Sub2); buttonDataKey1_Sub2._treeTag = new KeyTreeNodeTag(); buttonDataKey1_Sub2._treeTag.keyType = 0x12; TreeKey buttonDataKey2 = new TreeKey(); buttonDataKey2.Text = "中键"; TreeKey buttonDataKey2_Sub1 = new TreeKey(); buttonDataKey2_Sub1.Text = "左键触摸"; buttonDataKey2.Children.Add(buttonDataKey2_Sub1); buttonDataKey2_Sub1._treeTag = new KeyTreeNodeTag(); buttonDataKey2_Sub1._treeTag.keyType = 0x03; TreeKey buttonDataKey2_Sub2 = new TreeKey(); buttonDataKey2_Sub2.Text = "左键按压"; buttonDataKey2.Children.Add(buttonDataKey2_Sub2); buttonDataKey2_Sub2._treeTag = new KeyTreeNodeTag(); buttonDataKey2_Sub2._treeTag.keyType = 0x13; TreeKey buttonDataKey3 = new TreeKey(); buttonDataKey3.Text = "上键"; TreeKey buttonDataKey3_Sub1 = new TreeKey(); buttonDataKey3_Sub1.Text = "左键触摸"; buttonDataKey3.Children.Add(buttonDataKey3_Sub1); buttonDataKey3_Sub1._treeTag = new KeyTreeNodeTag(); buttonDataKey3_Sub1._treeTag.keyType = 0x04; TreeKey buttonDataKey3_Sub2 = new TreeKey(); buttonDataKey3_Sub2.Text = "左键按压"; buttonDataKey3.Children.Add(buttonDataKey3_Sub2); buttonDataKey3_Sub2._treeTag = new KeyTreeNodeTag(); buttonDataKey3_Sub2._treeTag.keyType = 0x14; TreeKey buttonDataKey4 = new TreeKey(); buttonDataKey4.Text = "下键"; TreeKey buttonDataKey4_Sub1 = new TreeKey(); buttonDataKey4_Sub1.Text = "左键触摸"; buttonDataKey4.Children.Add(buttonDataKey4_Sub1); buttonDataKey4_Sub1._treeTag = new KeyTreeNodeTag(); buttonDataKey4_Sub1._treeTag.keyType = 0x05; TreeKey buttonDataKey4_Sub2 = new TreeKey(); buttonDataKey4_Sub2.Text = "左键按压"; buttonDataKey4.Children.Add(buttonDataKey4_Sub2); buttonDataKey4_Sub2._treeTag = new KeyTreeNodeTag(); buttonDataKey4_Sub2._treeTag.keyType = 0x15; Nodes.Add(buttonDataKey0); Nodes.Add(buttonDataKey1); Nodes.Add(buttonDataKey2); Nodes.Add(buttonDataKey3); Nodes.Add(buttonDataKey4); return(Nodes); }
public static IEnumerable <TreeKey> GetSeiralTreeData() {//构造列表树 List <TreeKey> Nodes = new List <TreeKey>(); TreeKey rootNode0 = new TreeKey(); rootNode0.Text = "串口连接"; TreeKey rootNode1 = new TreeKey(); rootNode1.Text = "鼠标设置"; TreeKey rootNode1Sub0 = new TreeKey(); rootNode1Sub0.Text = "触摸"; rootNode1.Children.Add(rootNode1Sub0); TreeKey rootNode1Sub0_Sub0 = new TreeKey(); rootNode1Sub0_Sub0.Text = "左键"; rootNode1Sub0.Children.Add(rootNode1Sub0_Sub0); rootNode1Sub0_Sub0._treeTag = new KeyTreeNodeTag(); rootNode1Sub0_Sub0._treeTag.keyType = 0x01; // ShortCutInfo shortCut0 = new ShortCutInfo(); shortCut0.AppShowName = "notepad.exe"; // ShortCutInfo shortCut1 = new ShortCutInfo(); shortCut1.AppShowName = "Foxit Reader.exe"; // ShortCutInfo shortCut2 = new ShortCutInfo(); shortCut2.AppShowName = "chrome.exe"; // rootNode1Sub0_Sub0._treeTag.userShortcutMap.Add(shortCut0); // rootNode1Sub0_Sub0._treeTag.userShortcutMap.Add(shortCut1); // rootNode1Sub0_Sub0._treeTag.userShortcutMap.Add(shortCut2); TreeKey rootNode1Sub0_Sub1 = new TreeKey(); rootNode1Sub0_Sub1.Text = "右键"; rootNode1Sub0.Children.Add(rootNode1Sub0_Sub1); rootNode1Sub0_Sub1._treeTag = new KeyTreeNodeTag(); rootNode1Sub0_Sub1._treeTag.keyType = 0x02; TreeKey rootNode1Sub0_Sub2 = new TreeKey(); rootNode1Sub0_Sub2.Text = "中键"; rootNode1Sub0.Children.Add(rootNode1Sub0_Sub2); rootNode1Sub0_Sub2._treeTag = new KeyTreeNodeTag(); rootNode1Sub0_Sub2._treeTag.keyType = 0x03; TreeKey rootNode1Sub0_Sub3 = new TreeKey(); rootNode1Sub0_Sub3.Text = "上键"; rootNode1Sub0.Children.Add(rootNode1Sub0_Sub3); rootNode1Sub0_Sub3._treeTag = new KeyTreeNodeTag(); rootNode1Sub0_Sub3._treeTag.keyType = 0x04; TreeKey rootNode1Sub0_Sub4 = new TreeKey(); rootNode1Sub0_Sub4.Text = "下键"; rootNode1Sub0.Children.Add(rootNode1Sub0_Sub4); rootNode1Sub0_Sub4._treeTag = new KeyTreeNodeTag(); rootNode1Sub0_Sub4._treeTag.keyType = 0x05; TreeKey rootNode1Sub1 = new TreeKey(); rootNode1Sub1.Text = "按压"; rootNode1.Children.Add(rootNode1Sub1); TreeKey rootNode1Sub1_Sub0 = new TreeKey(); rootNode1Sub1_Sub0.Text = "左键"; rootNode1Sub1.Children.Add(rootNode1Sub1_Sub0); rootNode1Sub1_Sub0._treeTag = new KeyTreeNodeTag(); rootNode1Sub1_Sub0._treeTag.keyType = 0x11; TreeKey rootNode1Sub1_Sub1 = new TreeKey(); rootNode1Sub1_Sub1.Text = "右键"; rootNode1Sub1.Children.Add(rootNode1Sub1_Sub1); rootNode1Sub1_Sub1._treeTag = new KeyTreeNodeTag(); rootNode1Sub1_Sub1._treeTag.keyType = 0x12; TreeKey rootNode1Sub1_Sub2 = new TreeKey(); rootNode1Sub1_Sub2.Text = "中键"; rootNode1Sub1.Children.Add(rootNode1Sub1_Sub2); rootNode1Sub1_Sub2._treeTag = new KeyTreeNodeTag(); rootNode1Sub1_Sub2._treeTag.keyType = 0x13; TreeKey rootNode1Sub1_Sub3 = new TreeKey(); rootNode1Sub1_Sub3.Text = "上键"; rootNode1Sub1.Children.Add(rootNode1Sub1_Sub3); rootNode1Sub1_Sub3._treeTag = new KeyTreeNodeTag(); rootNode1Sub1_Sub3._treeTag.keyType = 0x14; TreeKey rootNode1Sub1_Sub4 = new TreeKey(); rootNode1Sub1_Sub4.Text = "下键"; rootNode1Sub1.Children.Add(rootNode1Sub1_Sub4); rootNode1Sub1_Sub4._treeTag = new KeyTreeNodeTag(); rootNode1Sub1_Sub4._treeTag.keyType = 0x15; Nodes.Add(rootNode0); Nodes.Add(rootNode1); return(Nodes); }
private void ToggleButton_Checked(object sender, RoutedEventArgs e) { ToggleButton button = sender as ToggleButton; if (button != null && button.IsChecked == true) { TreeKey treeKey = button.DataContext as TreeKey; TreeKey treeKey0 = treeKey.Children[0]; TreeKey treeKey1 = treeKey.Children[1]; if (treeKey0 != null && treeKey1 != null) { _subForm1._subListViewTouch.ItemsSource = treeKey0._treeTag.userShortcutMap; _subForm1._subListViewTouch.Tag = treeKey0._treeTag; _subForm1._subListViewPress.ItemsSource = treeKey1._treeTag.userShortcutMap; _subForm1._subListViewPress.Tag = treeKey1._treeTag; } } }
private void _mainTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (e.NewValue != null && e.NewValue.GetType() == typeof(TreeKey)) { TreeKey treeKey = e.NewValue as TreeKey; if (treeKey.Text == "串口连接") { _subForm0.Visibility = Visibility.Visible; _subForm1.Visibility = Visibility.Hidden; } else { _subForm0.Visibility = Visibility.Hidden; _subForm1.Visibility = Visibility.Visible; if (treeKey._treeTag != null) { _subForm1._subListViewTouch.ItemsSource = treeKey._treeTag.userShortcutMap; _subForm1._subListViewTouch.Tag = treeKey._treeTag; } } } }