コード例 #1
0
        public IEnumerable <ElementModelViewModel> GetLeafEnumerator()
        {
            if (IsLeaf)
            {
                return(new[] { this });
            }

            return(ChildrenViewModels.SelectMany(x => x.GetLeafEnumerator()));
        }
コード例 #2
0
 public void RemoveSchema(ISchemaViewModel schema)
 {
     ChildrenViewModels.Remove(schema);
     if (typeof(FolderSchemaViewModel) == schema.GetType())
     {
         Schema.Children.Remove((schema as FolderSchemaViewModel)._schema);
     }
     if (typeof(FileSchemaViewModel) == schema.GetType())
     {
         Schema.Children.Remove((schema as FileSchemaViewModel).XmlSchema);
     }
 }
コード例 #3
0
 public void AddSchema(string mode, ObservableCollection <Models.XmlAnything <Models.ISchema> > schemaList)
 {
     if ("file" == mode)
     {
         FileSchemaViewModel newSchema = new FileSchemaViewModel(_mainSettings, new Models.FileSchema(), this, _log);
         Models.XmlAnything <Models.ISchema> xmlAnything = new Models.XmlAnything <Models.ISchema>();
         xmlAnything.Value = newSchema.Schema;
         ChildrenViewModels.Add(newSchema);
         schemaList.Add(xmlAnything);
     }
     if ("folder" == mode)
     {
         FolderSchemaViewModel newSchema = new FolderSchemaViewModel(_mainSettings, new Models.FolderSchema(), this, _log);
         Models.XmlAnything <Models.ISchema> xmlAnything = new Models.XmlAnything <Models.ISchema>();
         xmlAnything.Value = newSchema.Schema;
         ChildrenViewModels.Add(newSchema);
         schemaList.Add(xmlAnything);
     }
 }