Пример #1
0
        /// <summary>
        /// Goes though a Cue and create ModbusTCP Master objects for every cue item.
        /// Sets up every cue item in the Cue so it is ready to be played.
        /// </summary>
        private void SetupMotors()
        {
            List <CueItem> ItemList = CurrentCue.GetList();

            foreach (CueItem Item in ItemList)
            {
                try
                {
                    Master MBmaster = new Master(Item.CueMotor.IPAddress, 502);
                    MBmaster.OnException += new ModbusTCP.Master.ExceptionData(MBmaster_OnException);
                    Logger.LogInfo("Successfully connected to: " + Item.CueMotor.Name + " at IP Address " + Item.CueMotor.IPAddress);
                    MasterList.Add(MBmaster);
                    Item.CueMotor.InputData.Control_I3.ControllerInhibit = false;
                    Item.UpdateInputFields();
                    Item.Running  = true;
                    Item.Stopping = false;
                }
                catch (SystemException error)
                {
                    Logger.LogError(error.Message);
                    Logger.LogError("Error connecting to: " + Item.CueMotor.Name + " at IP Address " + Item.CueMotor.IPAddress);
                    MessageBox.Show(error.Message);
                }
            }
        }
Пример #2
0
        private void cueManager_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (cueManager.SelectedIndex < 0)
            {
                return;
            }

            motorList.Items.Clear();
            HashSet <String> motors = new HashSet <String>();
            Cue CurrentCue          = playCueController1.GetCueList()[cueManager.SelectedIndex];

            //populate motor list with only UNIQUE motors
            foreach (CueItem Item in CurrentCue.GetList())
            {
                String CueMotorName = Item.CueMotor.Name;
                if (!(motors.Contains(CueMotorName)))
                {
                    motors.Add(CueMotorName);
                    motorList.Items.Add(CueMotorName);
                }
            }
            playCueController1.ChangeCurrentCueWithIndex(cueManager.SelectedIndex);

            //populate description text box
            cueDescription.Text = CurrentCue.Description;
        }