예제 #1
0
        private void OnSignalGroupsChanged(FasenChangedMessage obj)
        {
            if (_fasenChanging)
            {
                return;
            }

            _fasenChanging = true;

            if (obj.RemovedFasen?.Any() == true)
            {
                foreach (var sg in obj.RemovedFasen)
                {
                    var vm = AllSignalGroups.FirstOrDefault(x => x.Naam == sg.Naam);
                    if (vm == null)
                    {
                        continue;
                    }
                    AllSignalGroups.Remove(vm);
                    AllSignalGroupStrings.Remove(vm.Naam);
                }
            }
            if (obj.AddedFasen?.Any() == true)
            {
                foreach (var sg in obj.AddedFasen)
                {
                    AllSignalGroups.Add(new FaseCyclusViewModel(sg));
                    AllSignalGroupStrings.Add(sg.Naam);
                }
            }
            AllSignalGroups.BubbleSort();
            AllSignalGroupStrings.BubbleSort();

            _fasenChanging = false;
        }
예제 #2
0
        private void OnNameChanged(NameChangedMessage obj)
        {
            switch (obj.ObjectType)
            {
            case TLCGenObjectTypeEnum.Fase:
                AllSignalGroupStrings.Remove(obj.OldName);
                AllSignalGroupStrings.Add(obj.NewName);
                AllSignalGroups.BubbleSort();
                AllSignalGroupStrings.BubbleSort();
                break;

            case TLCGenObjectTypeEnum.Detector:
                AllDetectorStrings.Remove(obj.OldName);
                AllDetectorStrings.Add(obj.NewName);
                AllDetectors.BubbleSort();
                AllDetectorStrings.BubbleSort();
                RefreshVecomDetectors();
                break;

            case TLCGenObjectTypeEnum.Input:
                AllIngangen.BubbleSort();
                break;

            case TLCGenObjectTypeEnum.SelectieveDetector:
                AllSelectiveDetectorStrings.Remove(obj.OldName);
                AllSelectiveDetectorStrings.Add(obj.NewName);
                AllSelectiveDetectorStrings.BubbleSort();
                break;
            }
            foreach (var detectorsCollectionView in _detectorsCollectionViews)
            {
                detectorsCollectionView.Value.Refresh();
            }
        }
예제 #3
0
        private void OnControllerLoaded(ControllerLoadedMessage obj)
        {
            AllIngangen.Clear();
            AllSignalGroups.Clear();
            AllSignalGroupStrings.Clear();
            AllDetectors.Clear();
            AllDetectorStrings.Clear();
            AllSelectiveDetectors.Clear();
            AllSelectiveDetectorStrings.Clear();
            AllVecomDetectors.Clear();
            AllVecomDetectorStrings.Clear();

            Controller = obj.Controller;

            if (obj.Controller == null)
            {
                return;
            }

            foreach (var sg in obj.Controller.Fasen)
            {
                AllSignalGroups.Add(new FaseCyclusViewModel(sg));
                AllSignalGroupStrings.Add(sg.Naam);
                foreach (var d in sg.Detectoren)
                {
                    AllDetectors.Add(new DetectorViewModel(d)
                    {
                        FaseCyclus = sg.Naam
                    });
                    AllDetectorStrings.Add(d.Naam);
                }
            }

            foreach (var d in obj.Controller.Detectoren)
            {
                AllDetectors.Add(new DetectorViewModel(d));
                AllDetectorStrings.Add(d.Naam);
            }
            foreach (var seld in obj.Controller.SelectieveDetectoren)
            {
                AllSelectiveDetectors.Add(new SelectieveDetectorViewModel(seld));
                AllSelectiveDetectorStrings.Add(seld.Naam);
            }
            foreach (var ingang in obj.Controller.Ingangen)
            {
                AllIngangen.Add(new IngangViewModel(ingang));
            }
        }