Example #1
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;
            }
        }
 //Load From MDB, SubTheme, overloads
 public ThemeNode(string name, TmNode parent, ThemeData data, Metadata metadata, string desc, DateTime? pubDate)
     : base(name, parent, metadata, desc)
 {
     IsInitialized = false;
     Data = data;
     PubDate = pubDate.HasValue ? pubDate.Value : DefaultPubDate;
     //Age is not a saved property, so calling the setter will not flag the node as edited
     Age = CalculateAge();
     IsInitialized = true;
 }
Example #3
0
 public TmNode(string name, TmNode parent, Metadata metadata, string desc)
 {
     IsInitialized = false;
     Name = name;
     Description = desc;
     Metadata = metadata;
     Parent = parent;
     if (parent != null)
         IsUpdating = parent.IsUpdating;
     IsInitialized = true;
     //FIXME: Check that I don't send messages or updates while Initializing.
 }
 // 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;
 }
Example #5
0
 internal static Metadata Load(XElement xele)
 {
     if (xele == null)
         throw new ArgumentNullException("xele");
     if (xele.Name != "metadata")
         throw new ArgumentException("Invalid Xelement");
     var data = new Metadata(
         xele.Value,
         (MetadataType)Enum.Parse(typeof(MetadataType), (string)xele.Attribute("type")),
         (MetadataFormat)Enum.Parse(typeof(MetadataFormat), (string)xele.Attribute("format")),
         (string)xele.Attribute("version"),
         (string)xele.Attribute("schema")
         );
     return data;
 }
Example #6
0
        internal static Metadata Find(ThemeData data)
        {
            if (data == null)
                return null;

            Meta myProps = ExpectedMetadataProperties(data);
            var metadata = new Metadata(myProps.Path, myProps.Type, myProps.Format);
            if (metadata.Validate())
                return metadata;
            return null;
        }
 //MDB Load, overloads
 public CategoryNode(string name, TmNode parent, Metadata metadata, string desc)
     : base(name, parent, metadata, desc)
 {
 }
 //Load from MDB, ThemeBuilder, overloads
 public SubThemeNode(string name, TmNode parent, ThemeData data, Metadata metadata, string desc, DateTime? pubDate)
     : base(name, parent, data, metadata, desc, pubDate)
 {
 }
Example #9
0
        internal static Metadata Find(ThemeData data)
        {
            if (data == null)
                return null;

            meta myProps = ExpectedMetadataProperties(data);
            Metadata metadata = new Metadata(myProps.path, myProps.type, myProps.format);
            if (metadata != null && metadata.Validate())
                return metadata;
            return null;
        }