public void Connect(SerialPortViewModel serialPort)
        {
            if (serialPort == null)
            {
                throw new ArgumentNullException("serialPort");
            }

            SerialPort = serialPort;
            _simulationForm = new SimulatedSerialPortForm
            {
                SerialPortDescription = string.Format("{0} (DtrEnable: {1})", serialPort.DisplayValue, serialPort.DtrEnable)
            };
            _simulationForm.Show();
        }
コード例 #2
0
        public MainViewModel()
        {
            SerialPort = new SerialPortViewModel();
            Receiver   = new MessageReceiver();
            Sender     = new MessageSender();
            Messages   = new MessagesViewModel();

            // hmm
            Receiver.Messages = Messages;
            Messages.Sender   = Sender;
            Sender.Messages   = Messages;

            SerialPort.Receiver = Receiver;
            SerialPort.Sender   = Sender;
            SerialPort.Messages = Messages;

            Receiver.Port = SerialPort.Port;
            Sender.Port   = SerialPort.Port;
        }
コード例 #3
0
        private void HandleSelectedPortChanged(object sender, System.EventArgs e)
        {
            var viewModel          = DataContext as SerialPortSelectorViewModel;
            var viewModelSelection = viewModel.SelectedSerialPortViewModel;
            var selection          = sender as Gtk.TreeSelection;
            var selectedItemPaths  = selection.GetSelectedRows();
            SerialPortViewModel newSelectedItem = null;

            foreach (var path in selectedItemPaths)
            {
                Gtk.TreeIter iter;
                if (selection.TreeView.Model.GetIter(out iter, path))
                {
                    var item = selection.TreeView.Model.GetValue(iter, 0) as SerialPortViewModel;
                    newSelectedItem = item;
                    if (newSelectedItem != null)
                    {
                        break;
                    }
                }
            }
            viewModel.SelectedSerialPortViewModel = newSelectedItem;
            INTV.Shared.ComponentModel.CommandManager.InvalidateRequerySuggested();
        }
コード例 #4
0
 public SerialPortWindow()
 {
     InitializeComponent();
     viewModel = new SerialPortViewModel();
 }
コード例 #5
0
 private void cboSerialPort_SelectedValueChanged(object sender, EventArgs e)
 {
     SerialPort           = (SerialPortViewModel)cboSerialPort.SelectedValue;
     chkDtrEnable.Checked = SerialPort.DtrEnable;
 }
コード例 #6
0
 private void cmdConnect_Click(object sender, EventArgs e)
 {
     SerialPort           = (SerialPortViewModel)cboSerialPort.SelectedValue;
     SerialPort.DtrEnable = chkDtrEnable.Checked;
 }
コード例 #7
0
 private void InitailizeSerialPort(SerialPortViewModel serialPort)
 {
     _serialPortAdapter.Connect(serialPort);
     LogMessage(string.Format("Connected to {0}", serialPort.DisplayValue));
 }
コード例 #8
0
 private void cmdConnect_Click(object sender, EventArgs e)
 {
     SerialPort = (SerialPortViewModel)cboSerialPort.SelectedValue;
     SerialPort.DtrEnable = chkDtrEnable.Checked;
 }
コード例 #9
0
 private void cboSerialPort_SelectedValueChanged(object sender, EventArgs e)
 {
     SerialPort = (SerialPortViewModel)cboSerialPort.SelectedValue;
     chkDtrEnable.Checked = SerialPort.DtrEnable;
 }
コード例 #10
0
 private void InitailizeSerialPort(SerialPortViewModel serialPort)
 {
     _serialPortAdapter.Connect(serialPort);
     LogMessage(string.Format("Connected to {0}", serialPort.DisplayValue));
 }