コード例 #1
0
 private async void button_read_bool_Click(object sender, EventArgs e)
 {
     // bool
     if (isAsync)
     {
         button_read_bool.Enabled = false;
         if (textBox5.Text == "1")
         {
             DemoUtils.ReadResultRender(await readWriteNet.ReadBoolAsync(textBox3.Text), textBox3.Text, textBox4);
         }
         else
         {
             DemoUtils.ReadResultRender(await readWriteNet.ReadBoolAsync(textBox3.Text, ushort.Parse(textBox5.Text)), textBox3.Text, textBox4);
         }
         button_read_bool.Enabled = true;
     }
     else
     {
         if (textBox5.Text == "1")
         {
             DemoUtils.ReadResultRender(readWriteNet.ReadBool(textBox3.Text), textBox3.Text, textBox4);
         }
         else
         {
             DemoUtils.ReadResultRender(readWriteNet.ReadBool(textBox3.Text, ushort.Parse(textBox5.Text)), textBox3.Text, textBox4);
         }
     }
 }
コード例 #2
0
        private async void button_read_bool_Click(object sender, EventArgs e)
        {
            // bool
            if (isAsync)
            {
                button_read_bool.Enabled = false;
                if (textBox5.Text == "1")
                {
                    DateTime             start = DateTime.Now;
                    OperateResult <bool> read  = await readWriteNet.ReadBoolAsync(textBox3.Text);

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

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