예제 #1
0
        public TerminalForm(SubViewControl tmp)
        {
            subViewCtrl = tmp;

            InitializeComponent();

            lineEndingComboBox.Items.Clear();

            LineEndingItem item;

            item          = new LineEndingItem();
            item.Name     = "No line ending";
            item.Delimter = "";
            lineEndingComboBox.Items.Add(item);

            item          = new LineEndingItem();
            item.Name     = "New line";
            item.Delimter = "\n";
            lineEndingComboBox.Items.Add(item);

            item          = new LineEndingItem();
            item.Name     = "Carriage return";
            item.Delimter = "\r";
            lineEndingComboBox.Items.Add(item);

            item          = new LineEndingItem();
            item.Name     = "Both NL & CR";
            item.Delimter = "\r\n";
            lineEndingComboBox.Items.Add(item);

            lineEndingComboBox.SelectedIndex = 1;
        }
예제 #2
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            if (subViewCtrl.IsCommunicationActive == false)
            {
                return;
            }

            var    text      = sendTextBox.Text;
            string delimiter = "";

            if (lineEndingComboBox.SelectedItem != null)
            {
                LineEndingItem item = (LineEndingItem)lineEndingComboBox.SelectedItem;
                delimiter = item.Delimter;
            }

            var result = System.Text.Encoding.ASCII.GetBytes(text + delimiter);

            subViewCtrl.Logic.SendText(result);
        }