示例#1
0
 private void button_end_Click(object sender, EventArgs e)
 {
     rbtnet_.sendEndAnswer();
     foreach (var item in dicMac2DrawForm_)
     {
         item.Value.UpdateJDNum(0);
     }
 }
示例#2
0
        /// <summary>
        /// 答题开始或结束按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_answer_Click(object sender, EventArgs e)
        {
            if (this.button_answer.Text == "开始答题")
            {
                int    totalTopic = 1;
                byte[] topicType;
                bool   bRes = false;

                int index = comboBox1.SelectedIndex;
                switch (index)
                {
                case 0:
                {
                    topicType    = new byte[totalTopic];
                    topicType[0] = 1;
                    break;
                }

                case 1:
                {
                    topicType    = new byte[totalTopic];
                    topicType[0] = 2;
                    break;
                }

                case 2:
                {
                    topicType    = new byte[totalTopic];
                    topicType[0] = 3;
                    break;
                }

                case 3:
                {
                    totalTopic   = 3;
                    topicType    = new byte[totalTopic];
                    topicType[0] = 3;
                    topicType[1] = 2;
                    topicType[2] = 1;
                    break;
                }

                default:
                    totalTopic   = 3;
                    topicType    = new byte[totalTopic];
                    topicType[0] = 1;
                    topicType[1] = 2;
                    topicType[2] = 3;
                    break;
                }
                IntPtr ptr = Marshal.AllocHGlobal(totalTopic);
                Marshal.Copy(topicType, 0, ptr, totalTopic);

                bRes = rbtnet_.sendStartAnswer(1, totalTopic, ptr);
                if (bRes)
                {
                    this.button_answer.Text = "结束答题";
                }
                else
                {
                    MessageBox.Show("发送开始答题失败");
                }

                Marshal.FreeHGlobal(ptr);
                this.label3.Text = "进入答题模式,按键事件失效,只接收手写板确认提交答案的事件";
            }
            else
            {
                rbtnet_.sendEndAnswer();
                this.button_answer.Text = "开始答题";
                this.label3.Text        = "恢复到正常模式,开始响应按键事件";
            }
        }