Beispiel #1
0
 private void RemovePartStatus(PartsModel.PartsGroup parts, SceneNode node)
 {
     if (!parts.CanClearStatus())
     {
         return;
     }
     foreach (PartInPartsExplorer partInPartsExplorer in (List <PartInPartsExplorer>)parts)
     {
         partInPartsExplorer.Status = PartStatus.Unused;
     }
     this.UpdateElementTimelineItem(node as SceneElement, parts[0]);
 }
Beispiel #2
0
 private void AddPartStatus(PartsModel.PartsGroup parts, SceneNode node)
 {
     if (!parts.CanSetStatus())
     {
         return;
     }
     foreach (PartInPartsExplorer partInPartsExplorer in (List <PartInPartsExplorer>)parts)
     {
         partInPartsExplorer.Status = partInPartsExplorer.TargetType.IsAssignableFrom((ITypeId)node.Type) ? PartStatus.Assigned : PartStatus.WrongType;
     }
     this.UpdateElementTimelineItem(node as SceneElement, parts[0]);
 }
Beispiel #3
0
 public void UpdatePartsFromMetadata()
 {
     if (!this.IsEnabled)
     {
         this.parts.Clear();
         this.PartsList.Clear();
         this.lastEditingContainer = (SceneNode)null;
     }
     else
     {
         List <TemplatePartAttributeRecord> list = new List <TemplatePartAttributeRecord>((IEnumerable <TemplatePartAttributeRecord>)ProjectAttributeHelper.GetTemplatePartAttributes(this.TargetTemplate.ProjectContext.ResolveType(this.TargetTemplate.ControlTemplateTargetTypeId), (ITypeResolver)ProjectContext.GetProjectContext(this.viewModel.ProjectContext)));
         list.Sort((Comparison <TemplatePartAttributeRecord>)((first, second) => string.Compare(first.NameAttribute, second.NameAttribute, StringComparison.CurrentCulture)));
         this.parts.Clear();
         this.PartsList.Clear();
         foreach (TemplatePartAttributeRecord partAttributeRecord in list)
         {
             if (!string.IsNullOrEmpty(partAttributeRecord.NameAttribute) && !(partAttributeRecord.TypeAttribute == (Type)null))
             {
                 ITypeId type = (ITypeId)this.TargetTemplate.ProjectContext.GetType(partAttributeRecord.TypeAttribute);
                 if (PlatformTypes.FrameworkElement.IsAssignableFrom(type))
                 {
                     PartInPartsExplorer partInPartsExplorer = new PartInPartsExplorer(partAttributeRecord.NameAttribute, type);
                     if (!this.parts.ContainsKey(partAttributeRecord.NameAttribute))
                     {
                         PartsModel.PartsGroup partsGroup = new PartsModel.PartsGroup();
                         partsGroup.Add(partInPartsExplorer);
                         this.parts.Add(partAttributeRecord.NameAttribute, partsGroup);
                     }
                     else
                     {
                         this.parts[partAttributeRecord.NameAttribute].Add(partInPartsExplorer);
                     }
                     this.PartsList.Add(partInPartsExplorer);
                 }
             }
         }
         this.lastEditingContainer = this.viewModel.ActiveEditingContainer;
     }
 }