예제 #1
0
파일: Form1.cs 프로젝트: RoBoardGod/RoBoME
 private void gotobutton(object sender, EventArgs e)
 {
     TriggerSet ts = new TriggerSet(((ME_Goto)((ME_Motion)ME_Motionlist[MotionCombo.SelectedIndex]).Events[Motionlist.SelectedIndex]).key);
     ts.ShowDialog();
     if (ts.DialogResult == DialogResult.OK)
     {
         ((ME_Goto)((ME_Motion)ME_Motionlist[MotionCombo.SelectedIndex]).Events[Motionlist.SelectedIndex]).key = ts.Keyvalue.Text;
     }
 }
예제 #2
0
파일: Form1.cs 프로젝트: RoBoardGod/RoBoME
 private void triggerlistevent(object sender, ToolStripItemClickedEventArgs e)
 {
     if (String.Compare(e.ClickedItem.Text, "New Trigger") == 0) {
         ME_Trigger t = new ME_Trigger();
         t.motion = null;
         t.key = "";
         ME_Triggerlist.Insert(triggerlist.SelectedIndex+1,t);
         if(t.motion != null)
             triggerlist.Items.Insert(triggerlist.SelectedIndex+1, "Trigger: " + t.key + "\tMotion: " + t.motion.name);
         else
             triggerlist.Items.Insert(triggerlist.SelectedIndex + 1, "Trigger: " + t.key + "\tMotion: ");
     }
     else if (String.Compare(e.ClickedItem.Text, "Delete Trigger") == 0)
     {
         ME_Triggerlist.RemoveAt(triggerlist.SelectedIndex);
         triggerlist.Items.RemoveAt(triggerlist.SelectedIndex);
     }
     else if (String.Compare(e.ClickedItem.Text, "Set Trigger") == 0)
     {
         TriggerSet ts = new TriggerSet(((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).key);
         ts.ShowDialog();
         if (ts.DialogResult == DialogResult.OK)
         {
             ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).key = ts.Keyvalue.Text;
             if (((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).motion != null)
             {
                 triggerlist.Items.Insert(triggerlist.SelectedIndex, "Trigger: " + ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).key + "\tMotion: " + ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).motion.name);
                 triggerlist.Items.RemoveAt(triggerlist.SelectedIndex);
             }
             else
             {
                 triggerlist.Items.Insert(triggerlist.SelectedIndex, "Trigger: " + ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).key + "\tMotion: ");
                 triggerlist.Items.RemoveAt(triggerlist.SelectedIndex);
             }
         }
     }
     else if (String.Compare(e.ClickedItem.Text, "Link Motion") == 0)
     {
         if (MotionCombo.SelectedIndex >= 0)
         {
             ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).motion = (ME_Motion)ME_Motionlist[MotionCombo.SelectedIndex];
             triggerlist.Items.Insert(triggerlist.SelectedIndex, "Trigger: " + ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).key + "\tMotion: " + ((ME_Trigger)ME_Triggerlist[triggerlist.SelectedIndex]).motion.name);
             triggerlist.Items.RemoveAt(triggerlist.SelectedIndex);
         }
         else {
             MessageBox.Show("Please choose a Motion.");
         }
     }
 }