コード例 #1
0
 public void RegenerateViewContainer()
 {
     if (CurrentContainer != null)
     {
         CurrentViewContainer         = ViewModelRootContainer.Create(CurrentContainer, CurrentSubject);
         CurrentViewContainer.Enabled = CurrentSubject != null;
     }
 }
コード例 #2
0
        public static ViewModelRootContainer Create(IModelRootContainer container, IModelSubject subject)
        {
            ViewModelRootContainer viewContainer = new ViewModelRootContainer()
            {
                ContainerID = container.ContainerID, DisplayText = container.DisplayText, IsRepeating = container.IsRepeating
            };
            int nextInstanceID = -1;

            foreach (IModelInstance instance in container.Instances)
            {
                ViewModelInstance viewInstance = ViewModelInstance.Create(container, subject, instance, null, ref nextInstanceID);

                viewContainer.Instances.Add(viewInstance);
            }

            if (container.IsRepeating || !viewContainer.Instances.Any())
            {
                ViewModelInstance viewInstance = ViewModelInstance.Create(container, subject, null, null, ref nextInstanceID);

                viewContainer.Instances.Add(viewInstance);
            }

            return(viewContainer);
        }