예제 #1
0
 private void button24_Click(object sender, EventArgs e)
 {
     // bool写入
     //MessageBox.Show( HslCommunication.BasicFramework.SoftBasic.ByteToHexString( SiemensPPI.BuildWriteCommand( siemensPPI.Station, textBox8.Text, new byte[] { 1 } ).Content, ' ' ) );
     //return;
     try
     {
         DemoUtils.WriteResultRender(siemensPPI.Write(textBox8.Text, bool.Parse(textBox7.Text)), textBox8.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        private void Test1( )
        {
            OperateResult <bool> read = siemensPPI.ReadBool("M100.4");

            if (read.IsSuccess)
            {
                bool m100_4 = read.Content;
            }
            else
            {
                // failed
                string err = read.Message;
            }

            OperateResult write = siemensPPI.Write("M100.4", true);

            if (write.IsSuccess)
            {
                // success
            }
            else
            {
                // failed
                string err = write.Message;
            }
        }
 private void button23_Click(object sender, EventArgs e)
 {
     // byte写入
     try
     {
         //byte[] buffer = new byte[500];
         //for (int i = 0; i < 500; i++)
         //{
         //    buffer[i] = (byte)i;
         //}
         //writeResultRender( siemensTcpNet.Write( textBox8.Text, buffer ), textBox8.Text );
         writeResultRender(siemensPPI.Write(textBox8.Text, byte.Parse(textBox7.Text)), textBox8.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #4
0
        private void button22_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(HslCommunication.BasicFramework.SoftBasic.ByteToHexString(SiemensPPI.BuildWriteCommand(2, textBox8.Text, new byte[] { 0x12, 0x34 }).Content, ' '));

            // short写入
            try
            {
                writeResultRender(siemensPPI.Write(textBox8.Text, short.Parse(textBox7.Text)), textBox8.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }