/// <summary>
 /// Creates a new Theme List Node based on the contents of the current Category Node
 /// </summary>
 /// <param name="path">File system location for the new theme list.</param>
 /// <returns>A new theme list node</returns>
 /// <exception cref="System.IO.IOException">Path is not valid, or cannot be written to</exception>
 public ThemeListNode ToThemeList(string path)
 {
     var newNode = new ThemeListNode(this.Name, path, this.Metadata.DeepCopy(), this.Description);
     var author = new ThemeListAuthor();
     author["Name"] = Environment.UserName;
     newNode.Author = author;
     foreach (var child in Children)
         newNode.Add(child.DeepCopy());
     newNode.SaveAs(path);
     return newNode;
 }
 // Category.ToThemeList, overloads
 public ThemeListNode(string name, string path, Metadata metadata, string desc)
     : base(name, null, metadata, desc)
 {
     IsInitialized = false;
     FilePath = path;
     Author = new ThemeListAuthor();
     _status = ThemeListStatus.Created;
     GetDataSource();
     // TryToGetDataStore() will set _readonly for theme
     ThemeList = this;
     IsInitialized = true;
 }
示例#3
0
 /// <summary>
 /// Creates a new Theme List Node based on the contents of the current Category Node
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 internal TmNode CopyAsThemeList(string path)
 {
     Debug.Assert(this.IsCategory, "Should only be called on a Category Node");
     TmNode newNode = new TmNode(TmNodeType.ThemeList, this.Name, null, new ThemeData(path), this.Metadata.Clone() as Metadata, this.Description, null);
     ThemeListAuthor author = new ThemeListAuthor();
     author["Name"] = Environment.UserName;
     newNode.Author = author;
     foreach (var child in Children)
         newNode.Add(child.Copy());
     newNode.SaveAs(path);
     return newNode;
 }
示例#4
0
        public TmNode(TmNodeType nodeType, string name, TmNode parent, ThemeData data, Metadata metadata, string desc, DateTime? pubDate)
        {
            _type = nodeType;
            _name = name;
            Parent = parent;

            _pubDate = pubDate.HasValue ? pubDate.Value : DefaultPubDate;
            //_readonly = (Parent == null) ? false : Parent._readonly;

            _description = desc;

            // Always create a data and Metadata object, else data binding in properties form won't work.
            _data = data ?? new ThemeData();
            _data.PropertyChanged += Data_PropertyChanged;
            Metadata = metadata ?? new Metadata();
            Metadata.PropertyChanged += Metadata_PropertyChanged;

            if (_type == TmNodeType.ThemeList)
            {
                Author = new ThemeListAuthor();
                _status = ThemeListStatus.Created;
                _dataStore = TryToGetDataStore();
                // TryToGetDataStore() will set _readonly for theme
                ThemeList = this;
            }
        }