private async void button_read_ushort_Click(object sender, EventArgs e)
 {
     // ushort
     if (isAsync)
     {
         button_read_ushort.Enabled = false;
         if (textBox5.Text == "1")
         {
             DemoUtils.ReadResultRender(await readWriteNet.ReadUInt16Async(textBox3.Text), textBox3.Text, textBox4);
         }
         else
         {
             DemoUtils.ReadResultRender(await readWriteNet.ReadUInt16Async(textBox3.Text, ushort.Parse(textBox5.Text)), textBox3.Text, textBox4);
         }
         button_read_ushort.Enabled = true;
     }
     else
     {
         if (textBox5.Text == "1")
         {
             DemoUtils.ReadResultRender(readWriteNet.ReadUInt16(textBox3.Text), textBox3.Text, textBox4);
         }
         else
         {
             DemoUtils.ReadResultRender(readWriteNet.ReadUInt16(textBox3.Text, ushort.Parse(textBox5.Text)), textBox3.Text, textBox4);
         }
     }
 }
예제 #2
0
        private async void button_read_ushort_Click(object sender, EventArgs e)
        {
            // ushort
            if (isAsync)
            {
                button_read_ushort.Enabled = false;
                if (textBox5.Text == "1")
                {
                    DateTime start = DateTime.Now;
                    OperateResult <ushort> read = await readWriteNet.ReadUInt16Async(textBox3.Text);

                    SetTimeSpend(Convert.ToInt32((DateTime.Now - start).TotalMilliseconds));
                    DemoUtils.ReadResultRender(read, textBox3.Text, textBox4);
                }
                else
                {
                    DateTime start = DateTime.Now;
                    OperateResult <ushort[]> read = await readWriteNet.ReadUInt16Async(textBox3.Text, ushort.Parse(textBox5.Text));

                    SetTimeSpend(Convert.ToInt32((DateTime.Now - start).TotalMilliseconds));
                    DemoUtils.ReadResultRender(read, textBox3.Text, textBox4);
                }
                button_read_ushort.Enabled = true;
            }
            else
            {
                if (textBox5.Text == "1")
                {
                    DateTime start = DateTime.Now;
                    OperateResult <ushort> read = readWriteNet.ReadUInt16(textBox3.Text);
                    SetTimeSpend(Convert.ToInt32((DateTime.Now - start).TotalMilliseconds));
                    DemoUtils.ReadResultRender(read, textBox3.Text, textBox4);
                }
                else
                {
                    DateTime start = DateTime.Now;
                    OperateResult <ushort[]> read = readWriteNet.ReadUInt16(textBox3.Text, ushort.Parse(textBox5.Text));
                    SetTimeSpend(Convert.ToInt32((DateTime.Now - start).TotalMilliseconds));
                    DemoUtils.ReadResultRender(read, textBox3.Text, textBox4);
                }
            }
        }