void AddIngangCommand_Executed(object prm)
        {
            IngangModel dm       = new IngangModel();
            string      newname  = "i001";
            int         inewname = 1;

            foreach (IngangViewModel ivm in Ingangen)
            {
                if (Regex.IsMatch(ivm.Naam, @"[0-9]+"))
                {
                    Match  m    = Regex.Match(ivm.Naam, @"[0-9]+");
                    string next = m.Value;
                    if (Int32.TryParse(next, out inewname))
                    {
                        newname = "i" + inewname.ToString("000");
                        while (!TLCGenModelManager.Default.IsElementIdentifierUnique(TLCGenObjectTypeEnum.Input, newname))
                        {
                            inewname++;
                            newname = "i" + inewname.ToString("000");
                        }
                    }
                }
            }
            dm.Naam = newname;
            DefaultsProvider.Default.SetDefaultsOnModel(dm, dm.Type.ToString());
            IngangViewModel dvm1 = new IngangViewModel(dm);

            Ingangen.Add(dvm1);
            Messenger.Default.Send(new IngangenChangedMessage());
        }
 private void RebuildIngangenList()
 {
     Ingangen.CollectionChanged -= Ingangen_CollectionChanged;
     Ingangen.Clear();
     foreach (IngangModel dm in base.Controller.Ingangen)
     {
         var dvm = new IngangViewModel(dm);
         dvm.PropertyChanged += Ingang_PropertyChanged;
         Ingangen.Add(dvm);
     }
     Ingangen.CollectionChanged += Ingangen_CollectionChanged;
     RaisePropertyChanged("");
 }
예제 #3
0
        private void CollectAllIO()
        {
            Uitgangen.Clear();
            Ingangen.Clear();

            foreach (FaseCyclusModel fcm in _Controller.Fasen)
            {
                Uitgangen.Add(new BitmappedItemViewModel(fcm as IOElementModel, fcm.Naam, BitmappedItemViewModel.Type.Fase));
                foreach (DetectorModel dm in fcm.Detectoren)
                {
                    Ingangen.Add(new BitmappedItemViewModel(dm as IOElementModel, dm.Naam, BitmappedItemViewModel.Type.Detector));
                }
            }

            foreach (DetectorModel dm in _Controller.Detectoren)
            {
                Ingangen.Add(new BitmappedItemViewModel(dm as IOElementModel, dm.Naam, BitmappedItemViewModel.Type.Detector));
            }
        }
예제 #4
0
 private void Ingangen_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     Ingangen.RebuildList();
     MessengerInstance.Send(new ControllerDataChangedMessage());
 }