void AddVersieCommand_Executed(object prm) { VersieModel vm = new VersieModel(); vm.Datum = DateTime.Now; string nextver = null; if (Versies != null && Versies.Count > 0) { Match m = Regex.Match(Versies[Versies.Count - 1].Versie, @"([0-9]+)\.([0-9]+)\.([0-9]+)"); if (m.Groups.Count == 4) { string midver = m.Groups[2].Value; int nextmidver; if (Int32.TryParse(midver, out nextmidver)) { nextver = m.Groups[1].Value + "." + (nextmidver + 1).ToString() + ".0"; } } } vm.Versie = nextver == null ? "1.0.0" : nextver; vm.Ontwerper = Environment.UserName; VersieViewModel vvm = new VersieViewModel(vm); Versies.Add(vvm); }
public AlgemeenTabViewModel(ControllerModel controller, ControllerDataModel controllerdata) : base(controller) { _ControllerData = controllerdata; foreach (VersieModel vm in _ControllerData.Versies) { VersieViewModel vvm = new VersieViewModel(vm); Versies.Add(vvm); } Versies.CollectionChanged += Versies_CollectionChanged; }