Beispiel #1
0
 private void buttonConnectInSignal_Click(object sender, EventArgs e)
 {
     if (listViewInSignals.SelectedItems.Count > 0)
     {
         FormHiCoreChannels hiCoreChannels = new FormHiCoreChannels(_hiCore.GetChannelNames("HiModels"), _selectedModel.GetInSignals()[listViewInSignals.SelectedIndices[0]].GetSignalName());
         var result = hiCoreChannels.ShowDialog();
         if (result == DialogResult.OK)
         {
             string channelName = hiCoreChannels.selectedChannel;
             _selectedModel.GetInSignals()[listViewInSignals.SelectedIndices[0]].SetChannelName(channelName);
             _selectedModel.GetInSignals()[listViewInSignals.SelectedIndices[0]].Update();
             ShowSignals(_selectedModel);
         }
     }
     else
     {
         string            message = "Select a insignal to connect to a channel.";
         string            title   = "Message";
         MessageBoxButtons buttons = MessageBoxButtons.OK;
         MessageBox.Show(message, title, buttons);
     }
 }
Beispiel #2
0
        private void btnConnectOutsignal_Click(object sender, EventArgs e)
        {
            List <string> channelsTaken = new List <string>();

            foreach (var model in _modelsDictionary.Values)
            {
                List <ISignal> signals = model.GetOutSignals();
                foreach (var signal in signals)
                {
                    channelsTaken.Add(signal.GetChannelName());
                }
            }

            List <string> channelsNotTaken = _hiCore.GetChannelNames("HiModels").Except(channelsTaken).ToList();

            if (listViewOutSignals.SelectedItems.Count > 0)
            {
                FormHiCoreChannels hiCoreChannels = new FormHiCoreChannels(channelsNotTaken, _selectedModel.GetOutSignals()[listViewOutSignals.SelectedIndices[0]].GetSignalName());
                var result = hiCoreChannels.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string channelName = hiCoreChannels.selectedChannel;
                    _selectedModel.GetOutSignals()[listViewOutSignals.SelectedIndices[0]].SetChannelName(channelName);

                    ShowSignals(_selectedModel);
                }
            }

            else
            {
                string            message = "Select a insignal to connect to a channel.";
                string            title   = "Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons);
            }
        }