private void Load_Click(object sender, RoutedEventArgs e)
 {
     TbInput.Clear();
     //Indexes = new List<int>();
     using (var sw = new StreamReader(LoadTextPath, Encoding.Unicode))
     {
         TbInput.Text = sw.ReadToEnd();
     }
     //MainText = TbInput.Text.ToLower();
     _timerCallback = RefreshText;
     _timer         = new Timer(_timerCallback, null, 0, 5000);
 }
Ejemplo n.º 2
0
        private void SendData()
        {
            if (!_portopen)
            {
                return;
            }

            if (InputMode.SelectedIndex == 0)
            {
                if (RbASCII.IsChecked == true)
                {
                    byte[] b = StringToBytes(TbInput.Text);
                    _port.Write(b, 0, b.Length);
                    LbSend.Items.Add("Send text: " + TbInput.Text + "\r\n");
                }
                else
                {
                    string[] values = TbInput.Text.Split(' ');
                    if (RbByte.IsChecked == true)
                    {
                        List <byte> bval = new List <byte>();
                        try { foreach (var v in values)
                              {
                                  bval.Add(Convert.ToByte(v));
                              }
                        }
                        catch (Exception) { MessageBox.Show("Error parsing input", "Error", MessageBoxButton.OK); }
                        _port.Write(bval.ToArray(), 0, bval.Count);
                        LbSend.Items.Add("Send bytes: " + TbInput.Text);
                    }
                }
                if (CbClear.IsChecked == true)
                {
                    TbInput.Clear();
                }
            }
            else
            {
                byte[] data = HexInput.GetBytes();
                _port.Write(data, 0, data.Length);
                LbSend.Items.Add("Send bytes: " + ByteArrayToString(data));
                HexInput.CreateDefault();
            }
        }
Ejemplo n.º 3
0
 private void BtnKlikHer_Click(object sender, EventArgs e)
 {
     MessageBox.Show("Advarsel!! " + TbInput.Text);
     TbInput.Clear();
 }