public FAPamtekBarcodeScannerPart(FASequenceManager aSequenceManager)
        {
            CheckReadyStatus = new FASequence(aSequenceManager);

            CheckReadyStatus.AddItem(delegate(object sender) { ReadReadyStatus(); });
            CheckReadyStatus.AddItem(ConfirmReadyStatus);
        }
        public FAPrintronix5000TRPart(FASequenceManager aSequenceManager)
        {
            CheckStatus = new FASequence(aSequenceManager);

            CheckStatus.Steps.Add("Start", new StepInfo());
            CheckStatus.OnStart += EventHandlerOnCheckStatus;

            CheckStatus.Steps["Start"].StepIndex = CheckStatus.AddItem(GetStatus);
            CheckStatus.AddItem(ConfirmStatus);
        }
        private void MakeLowerPrinterCharging(FASequence seq, VT5080.SubUnits.FAPrinterUnit printerUnit, FALabelPrinterModule printerModule)
        {
            seq.AddWatcher(
                delegate
                {
                    if (seq.IsStartable())
                    {
                        if (printerUnit.LowerPrinterDoorLock.Status ==
                        printerUnit.LowerPrinterDoorLock.StatusList.Lock)
                            printerUnit.LowerDoorOpenSwitchLamp.DoTurnOff(this);
                        else
                            printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(this);
                    }
                    else
                        return;

                    if (VT5080Equipment.State == VT5080Equipment.StateStop ||
                        VT5080Equipment.State == VT5080Equipment.StateRun ||
                        VT5080Equipment.State == VT5080Equipment.StateRundown)
                    {
                        if (printerUnit.LowerDoorOpenSwitch.IsOn ||
                            printerModule.LowerPrinterStatus == FALabelPrinterModule.PrinterStatus.ChargingPaper)
                        {
                            seq.Start();
                        }
                    }
                });

            seq.Steps.Add("ConfirmChargingable", new StepInfo());
            seq.Steps.Add("ConfirmDoorOpenCheck", new StepInfo());

            seq.Steps["ConfirmChargingable"].StepIndex =
                seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (printerModule.PrintLabel.IsStartable() ||
                        printerModule.LowerPrinterStatus == FALabelPrinterModule.PrinterStatus.ChargingPaper)
                    {
                        printerModule.LowerPrinterStatus = FALabelPrinterModule.PrinterStatus.ChargingPaper;
                        printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(actor);
                        printerUnit.LowerPrinterDoorLock.DoTurnOff(actor);
                        printerUnit.LowerPrinterStackerLock.DoTurnOff(actor);
                        actor.NextStep();
                    }
                    else if (TimeBlinkLampTime.Time < time)
                    {
                        if (printerUnit.LowerDoorOpenSwitchLamp.IsOn)
                            printerUnit.LowerDoorOpenSwitchLamp.DoTurnOff(actor);
                        else
                            printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(actor);

                        actor.NextStep("ConfirmChargingable");
                    }
                });
            seq.Steps["ConfirmDoorOpenCheck"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (printerUnit.LowerPrinterDoorCloseSensor.IsOff)
                        actor.NextStep();
                });
            seq.AddItem(new FATime(FATimeType.second, 1));
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (printerUnit.LowerPrinterDoorCloseSensor.IsOn)
                        actor.NextStep();
                });
            seq.AddItem(new FATime(FATimeType.second, 1));
            seq.AddItem(
                delegate(object obj)
                {
                    printerUnit.LowerPrinterDoorLock.DoTurnOn(this);
                    printerUnit.LowerPrinterStackerLock.DoTurnOn(this);
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (printerUnit.LowerPrinterDoorLock.Status == printerUnit.LowerPrinterDoorLock.StatusList.Lock &&
                        printerUnit.LowerPrinterStackerLock.Status == printerUnit.LowerPrinterStackerLock.StatusList.Lock)
                    {
                        printerModule.LowerPrinterStatus = FALabelPrinterModule.PrinterStatus.None;
                        actor.NextStep();
                    }
                    else if (TimeDoorLockTimeout.Time < time)
                    {
                        int alarm = 0;
                        if (printerUnit.LowerPrinterDoorLock.Status != printerUnit.LowerPrinterDoorLock.StatusList.Lock)
                            alarm = AlarmLowerPrinterDoorLockFail;
                        else
                            alarm = AlarmLowerPrinterStackerLockFail;

                        printerUnit.LowerPrinterDoorLock.DoTurnOff(actor);
                        printerUnit.LowerPrinterStackerLock.DoTurnOff(actor);

                        string windowName = string.Empty;
                        var alarmObj = Utility.AlarmUtility.GetAlarm(alarm, "DOOR WARNING");
                        Manager.MessageWindowManager.Instance.Show(Equipment, "DOOR WARNING", out windowName, alarmObj, printerModule.Name, false);
                        actor.NextStep("ConfirmDoorOpenCheck");
                    }
                });
        }
        public void InitializeSequence(FASequence sequence)
        {
            Sequence = sequence;

            var seq = Sequence;

            seq.Steps.Add("ConfirmQueue", new StepInfo());

            seq.Steps["ConfirmQueue"].StepIndex = Sequence.AddItem(ConfirmQueue);
            seq.AddItem(StartSequenceList);
            seq.AddItem(StartCurrentSequence);
            seq.AddItem(ConfirmTerminatedCurrentSequence);
            seq.AddItem("ConfirmQueue");
        }
        private void MakeDetectLightCurtanSensor(FASequence seq, FAPartOnOffSensor sensor, FATime warningDelayTime, string alarmPropertyName)
        {
            string windowName = string.Empty;

            seq.AddWatcher(
                delegate
                {
                    if (sensor.IsOff)
                    {
                        Manager.MessageWindowManager.Instance.CloseWindow(windowName);
                    }
                });

            seq.Steps.Add("LoopHead", new StepInfo());
            seq.Steps.Add("ConfirmElapsedTime", new StepInfo());
            seq.Steps.Add("ConfirmSafetySensorOff", new StepInfo());

            seq.Steps["LoopHead"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (sensor.IsOn)
                    {
                        SuspendedFromState = Equipment.State;
                        actor.NextStep();
                    }
                });
            seq.Steps["ConfirmElapsedTime"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (sensor.IsOff)
                    {
                        Manager.MessageWindowManager.Instance.CloseWindow(windowName);
                        actor.NextStep();
                    }
                    else if (warningDelayTime.Time < time)
                    {
                        int alarmNo = 0;
                        Type type = this.GetType();
                        var info = type.GetProperty(alarmPropertyName);
                        if (info == null)
                            alarmNo = 0;
                        else
                        {
                            try
                            {
                                alarmNo = (int)info.GetValue(this, null);
                            }
                            catch
                            {
                            }
                        }

                        string defaultAlarmName = "DetectedLightCurtan";
                        var alarm = Utility.AlarmUtility.GetAlarm(alarmNo, defaultAlarmName);
                        Manager.MessageWindowManager.Instance.Show(Equipment, defaultAlarmName, out windowName, alarm, string.Empty, true);
                        Equipment.SetSuspend();
                        actor.NextStep("ConfirmSafetySensorOff");
                    }
                });
            seq.AddItem("LoopHead");

            seq.Steps["ConfirmSafetySensorOff"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (sensor.IsOff)
                    {
                        Equipment.ReleaseSuspend();
                        actor.NextStep();
                    }
                });
            seq.AddItem("LoopHead");
        }