コード例 #1
0
 public UserCommandMapping(List <EventObject> events, List <string> context, List <UserCommand> com, List <ExcludedKey> exKeys)
 {
     this.events       = events;
     this.context      = context;
     this.excludedKeys = exKeys;
     foreach (UserCommand comm in com)
     {
         UserCommand uc = comm.Clone(this);
         this.commands.Add(uc);
     }
     foreach (ExcludedKey eKey in exKeys)
     {
         eKey.KeyCode      = ParseStringToKeyCode(eKey.Key);
         eKey.ModifierCode = ParseModifierToCode(eKey.Modifier);
     }
 }
コード例 #2
0
 public void editButton_clicked(object sender, EventArgs ea)
 {
     if (eventsTreeView.SelectedNode.Tag is UserCommand)
     {
         if (!(eventsTreeView.SelectedNode.Tag as UserCommand).Event.MouseButtonEvent && (Keys.LButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) || Keys.RButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) ||
                                                                                          Keys.MButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string)))
         {
             MessageBox.Show("Mouse related events must be mapped to mouse buttons", "Problem with mapping event", MessageBoxButtons.OK);
             return;
         }
         UserCommand com = (eventsTreeView.SelectedNode.Tag as UserCommand);
         com.Key      = keyComboBox.SelectedItem as string;
         com.Modifier = modifierComboBox.SelectedItem as string;
         com.Activity = activityComboBox.SelectedItem as string;
         eventsTreeView.SelectedNode.Text = parseCommandForString(com);
     }
 }
コード例 #3
0
        public void addButton_clicked(object sender, EventArgs ea)
        {
            if (eventsTreeView.SelectedNode.Tag is EventObject)
            {
                if ((eventsTreeView.SelectedNode.Tag as EventObject).MouseButtonEvent && !(Keys.LButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) || Keys.RButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) ||
                    Keys.MButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string)))
                {
                    MessageBox.Show("Mouse related events must be mapped to mouse buttons", "Problem with mapping event", MessageBoxButtons.OK);
                    return;
                }

                UserCommand newCommand = new UserCommand(eventsTreeView.SelectedNode.Tag as EventObject, keyComboBox.SelectedItem as string, activityComboBox.SelectedItem as string, modifierComboBox.SelectedItem as string, (eventsTreeView.SelectedNode.Tag as EventObject).EvString, mapping);
                TreeNode newNode = new TreeNode(parseCommandForString(newCommand));
                mapping.Commands.Add(newCommand);
                newNode.Tag = newCommand;
                eventsTreeView.SelectedNode.Nodes.Add(newNode);
                eventsTreeView.ExpandAll();
            }
        }
コード例 #4
0
        public void addButton_clicked(object sender, EventArgs ea)
        {
            if (eventsTreeView.SelectedNode.Tag is EventObject)
            {
                if ((eventsTreeView.SelectedNode.Tag as EventObject).MouseButtonEvent && !(Keys.LButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) || Keys.RButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string) ||
                                                                                           Keys.MButton == mapping.ParseStringToKeyCode(keyComboBox.SelectedItem as string)))
                {
                    MessageBox.Show("Mouse related events must be mapped to mouse buttons", "Problem with mapping event", MessageBoxButtons.OK);
                    return;
                }

                UserCommand newCommand = new UserCommand(eventsTreeView.SelectedNode.Tag as EventObject, keyComboBox.SelectedItem as string, activityComboBox.SelectedItem as string, modifierComboBox.SelectedItem as string, (eventsTreeView.SelectedNode.Tag as EventObject).EvString, mapping);
                TreeNode    newNode    = new TreeNode(parseCommandForString(newCommand));
                mapping.Commands.Add(newCommand);
                newNode.Tag = newCommand;
                eventsTreeView.SelectedNode.Nodes.Add(newNode);
                eventsTreeView.ExpandAll();
            }
        }
コード例 #5
0
 private string parseCommandForString(UserCommand command)
 {
     string text = "";
     if (!String.Equals(command.Modifier, "none"))
     {
         text = String.Format("{0}+{1}", command.Modifier, command.Key);
     }
     else
     {
         text = command.Key;
     }
     return text;
 }
コード例 #6
0
 private void fromXml(XmlReader r)
 {
     while (r.Read())
     {
         switch(r.Name)
         {
             case "CommandBinding":
                 UserCommand uc = new UserCommand(r, this);
                 this.commands.Add(uc);
                 break;
         }
     }
 }
コード例 #7
0
 public UserCommand Clone(UserCommandMapping par)
 {
     UserCommand rv = new UserCommand(ev, keystring, activity, modifier, evstring, par);
     return rv;
 }
コード例 #8
0
        public UserCommand Clone(UserCommandMapping par)
        {
            UserCommand rv = new UserCommand(ev, keystring, activity, modifier, evstring, par);

            return(rv);
        }