예제 #1
0
        private void BtnWrite_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;

            string register = btn.Name.Substring(12, 2);

            byte registerParsed = byte.Parse(register, NumberStyles.HexNumber);

            Screen screen = (Screen)cmbxScreenList.SelectedItem;

            BitArray ba = new BitArray(new byte[] { 0 });

            for (int pos = 0; pos <= 7; pos++)
            {
                ToggleButton btnRegister = FindChild <ToggleButton>(this, "btnRegisterR" + register + "P" + pos);

                ba[pos] = btnRegister.IsChecked ?? false;
            }

            byte[] bytes = new byte[1];
            ba.CopyTo(bytes, 0);

            Connector.Action24GetRegister(screen, registerParsed, bytes[0]);
        }