コード例 #1
0
        public void SetControls(Dictionary <string, ButtonState> controls)
        {
            try
            {
                //this.myLog.LogAlert(AlertType.System, this.line.Id.ToString(), this.GetType().ToString(), "SetControls()", "Method started ...", "system");

                Button           aButton;
                TimedLineStation station = this;

                //this.myLog.LogAlert(AlertType.System, this.line.Id.ToString(), this.GetType().ToString(), "SetControls()", "Method bookmark #2 ...", "system");

                foreach (KeyValuePair <string, ButtonState> item in controls)
                {
                    aButton = (Button)station.StationControls[item.Key];
                    if (aButton != null)
                    {
                        //this.opcProvider.SetButtonSignal(station.Index, aButton.Name, Convert.ToBoolean(item.Value));
                    }
                }
            }
            catch (Exception ex)
            {
                this.myLog.LogAlert(AlertType.Error, "SetControls()", ex.Message);
            }
        }
コード例 #2
0
        public override void ResetControls(ResetControlsType resetType)
        {
            try
            {
                base.ResetControls(resetType);

                Button           aButton;
                TimedLineStation station = this;

                if (resetType == ResetControlsType.All)
                {
                    station.Timers.StopAll();
                }
                else if (resetType == ResetControlsType.Release)
                {
                    station.Timers.StopForRelease();
                }


                aButton = (Button)station.StationControls["FINISH"];
                if (aButton != null && aButton.State == "1")
                {
                    aButton.Reset();
                    this.myLog.LogAlert(AlertType.System, this.line.Id.ToString(), this.GetType().ToString(), "ResetControls()",
                                        "station.Index=" + station.Index.ToString() + ", aButton.Name=" + aButton.Name.ToString(), "system");
                    this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                }

                aButton = (Button)station.StationControls["STOP"];
                if (aButton != null && aButton.State == "1")
                {
                    aButton.Reset();
                    this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                }

                aButton = (Button)station.StationControls["FAIL"];
                if (aButton != null && aButton.State == "1")
                {
                    aButton.Reset();
                    this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                }


                if (resetType == ResetControlsType.All)
                {
                    aButton = (Button)station.StationControls["HELP"];
                    if (aButton != null && aButton.State == "1")
                    {
                        aButton.Reset();
                        this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                    }


                    aButton = (Button)station.StationControls["PART1"];
                    if (aButton != null && aButton.State == "1")
                    {
                        aButton.Reset();
                        this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                    }

                    aButton = (Button)station.StationControls["PART2"];
                    if (aButton != null && aButton.State == "1")
                    {
                        aButton.Reset();
                        this.opcProvider.ResetButtonSignal(station.Index, aButton.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                this.myLog.LogAlert(AlertType.Error, "resetButtons()", ex.Message);
            }
        }