Ejemplo n.º 1
0
        public GuiVFlashPathBank(VFlashTypeBank vFlashTypeBank)
        {
            _vFlashTypeBank = vFlashTypeBank;

            InitializeComponent();

            VersionDataGrid.ItemsSource = _vFlashTypeBank.Children;
            VersionDataGrid.Foreground = Brushes.Black;

            SequenceDataGrid.Foreground = Brushes.Black;

            _save = true;
        }
Ejemplo n.º 2
0
        public VFlashHandler(uint id, string name, CommunicationInterfaceHandler communicationInterfaceHandler, VFlashTypeBank vFlashTypeBank, VFlashHandlerInterfaceAssignmentFile vFlashHandlerInterfaceAssignmentFile)
            : base(id, name, communicationInterfaceHandler)
        {
            VFlashHandlerInterfaceAssignmentFile = vFlashHandlerInterfaceAssignmentFile;

            _vFlashErrorCollector = new VFlashErrorCollector();
            _vFlashTypeBank = vFlashTypeBank;

            _vFlashThread = new Thread(VFlashPlcCommunicationThread);
            _vFlashThread.SetApartmentState(ApartmentState.STA);
            _vFlashThread.IsBackground = true;

            if (VFlashHandlerInterfaceAssignmentFile.Assignment == null) VFlashHandlerInterfaceAssignmentFile.Assignment = new string[9][];
            Assignment = VFlashHandlerInterfaceAssignmentFile.Assignment[Header.Id];
            CreateInterfaceAssignment();
        }
Ejemplo n.º 3
0
        public bool ExecuteSequence(VFlashTypeBank.VFlashTypeComponent sequence)
        {
            Logger.Log("VFlash: Channel nr. " + ChannelId + " : Sequence " + sequence.Version + " has started");

            for (var i = 1; i < sequence.Steps.Count + 1; i++)
            {
                var id = i;
                FlashingStep = sequence.Steps.First(step => step.Id == id);

                //Unloading
                Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Unloading");

                Status = VFlashStatus.Unloading;
                if (UnloadProject())
                {
                    Status = VFlashStatus.Unloaded;
                    Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Unloaded succesfully");

                    //Loading
                    Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Loading");

                    FlashProjectPath = FlashingStep.Path;
                    Status = VFlashStatus.Loading;
                    if (LoadProject())
                    {
                        Status = VFlashStatus.Loaded;
                        Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Loaded succesfully");

                        //Flashing
                        Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Flashing start");

                        Status = VFlashStatus.Flashing;
                        if (StartFlashing(VFlashCommand.Sequence))
                        {
                            Status = VFlashStatus.Flashing;
                        }

                        while (Status == VFlashStatus.Flashing)
                        {
                            Thread.Sleep(250);
                        }

                        if (Status != VFlashStatus.Flashed)
                        {
                            Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Flashing failed");
                            return false;
                        }

                        Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Flashed succesfully");
                        Thread.Sleep(FlashingStep.TransitionDelay);
                    }
                    else
                    {
                        Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Loading failed");
                        return false;
                    }
                }
                else
                {
                    Logger.Log("VFlash: Channel nr. " + ChannelId + " : Step " + i + " : Unloading failed");
                    return false;
                }
            }

            Status = VFlashStatus.SequenceDone;
            return true;
        }
Ejemplo n.º 4
0
        public void SetProjectSequence(uint chanId, VFlashTypeBank.VFlashTypeComponent component)
        {
            var channelFound = (VFlashChannel)VFlashStationControllerContext.VFlashStationController.Children.FirstOrDefault(channel => channel.ChannelId == chanId);
            if (channelFound == null) throw new FlashHandlerException("Error: Channel to be set was not found");
            channelFound.FlashingSequence = component;
            Logger.Log("ID: " + Header.Id + " VFlash: Channel nr. " + chanId + " : New sequence assigned : \n" + component.Version);

            if (CommunicationInterfaceHandler.WriteInterfaceComposite != null)
            {
                CommunicationInterfaceHandler.WriteInterfaceComposite.ModifyValue(InterfaceAssignmentCollection.GetAssignment("Version"), "N/L     ");
            }
        }