private void txtThumbPos_KeyDown(object sender, KeyEventArgs e) { if (handManualState) { if (e.KeyCode == Keys.Enter) { Console.WriteLine(SendMessageConfig.SendToHand(Int16.Parse(txtThumbPos.Text == string.Empty ? "0" : txtThumbPos.Text), Int16.Parse(txtIndexPos.Text == string.Empty ? "0" : txtIndexPos.Text) , Int16.Parse(txtMiddlePos.Text == string.Empty ? "0" : txtMiddlePos.Text), Int16.Parse(txtRingPos.Text == string.Empty ? "0" : txtRingPos.Text), Int16.Parse(txtPinkyPos.Text == string.Empty ? "0" : txtPinkyPos.Text) , 100, 100, 100, 100, 100)); } if (e.KeyCode == Keys.Enter && hand.IsConnected()) { hand.SendMessage(SendMessageConfig.SendToHand(Int16.Parse(txtThumbPos.Text == string.Empty ? "0" : txtThumbPos.Text), Int16.Parse(txtIndexPos.Text == string.Empty ? "0" : txtIndexPos.Text) , Int16.Parse(txtMiddlePos.Text == string.Empty ? "0" : txtMiddlePos.Text), Int16.Parse(txtRingPos.Text == string.Empty ? "0" : txtRingPos.Text), Int16.Parse(txtPinkyPos.Text == string.Empty ? "0" : txtPinkyPos.Text) , 100, 100, 100, 100, 100)); trThumb.Value = Int16.Parse(txtThumbPos.Text == string.Empty ? "0" : txtThumbPos.Text); trIndex.Value = Int16.Parse(txtIndexPos.Text == string.Empty ? "0" : txtIndexPos.Text); trMiddle.Value = Int16.Parse(txtMiddlePos.Text == string.Empty ? "0" : txtMiddlePos.Text); trRing.Value = Int16.Parse(txtRingPos.Text == string.Empty ? "0" : txtRingPos.Text); trPinky.Value = Int16.Parse(txtPinkyPos.Text == string.Empty ? "0" : txtPinkyPos.Text); Console.WriteLine(SendMessageConfig.SendToHand((Int16)trThumb.Value, (Int16)trIndex.Value, (Int16)trMiddle.Value, (Int16)trRing.Value, (Int16)trPinky.Value, 100, 100, 100, 100, 100)); } } }
private void btnDemoHand_Click(object sender, EventArgs e) { if (!demoFlag) { hand.SendMessage(SendMessageConfig.SendToHand(100, 100, 100, 100, 100, 100, 100, 100, 100, 100)); demoFlag = true; btnDemoHand.Text = "StopDemo"; Task.Run(() => { Thread.Sleep(1000); while (demoFlag) { Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(100, 70, 80, 100, 100, 100, 100, 100, 100, 100)); Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(70, 30, 40, 100, 70, 100, 100, 100, 100, 100)); Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(30, 60, 20, 70, 40, 100, 100, 100, 100, 100)); Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(60, 90, 50, 40, 20, 100, 100, 100, 100, 100)); Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(90, 100, 100, 20, 50, 100, 100, 100, 100, 100)); Thread.Sleep(450); hand.SendMessage(SendMessageConfig.SendToHand(100, 100, 100, 60, 80, 100, 100, 100, 100, 100)); } }); } else { btnDemoHand.Text = "Demo"; demoFlag = false; } }
private void trPinky_Scroll(object sender, EventArgs e) { if (btnStartHand.Text == "AutoReceive") { hand.SendMessage(SendMessageConfig.SendToHand((Int16)trThumb.Value, (Int16)trIndex.Value, (Int16)trMiddle.Value, (Int16)trRing.Value, (Int16)trPinky.Value, 100, 100, 100, 100, 100)); Console.WriteLine(SendMessageConfig.SendToHand((Int16)trThumb.Value, (Int16)trIndex.Value, (Int16)trMiddle.Value, (Int16)trRing.Value, (Int16)trPinky.Value, 100, 100, 100, 100, 100)); setScrollTextBoxes(); } }