mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Added INotifyPropertyChanged interface and target kind to reference.
This commit is contained in:
		@@ -210,7 +210,7 @@ namespace RainmeterStudio.UI.Controller
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool Save(IDocumentEditor editor)
 | 
			
		||||
        {
 | 
			
		||||
            if (editor.AttachedDocument.Reference.IsOnStorage())
 | 
			
		||||
            if (editor.AttachedDocument.Reference != null)
 | 
			
		||||
            {
 | 
			
		||||
                DocumentManager.Save(editor.AttachedDocument);
 | 
			
		||||
                return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace RainmeterStudio.UI.Controller
 | 
			
		||||
            string key = "ProjectItem";
 | 
			
		||||
 | 
			
		||||
            // Is a file?
 | 
			
		||||
            if (File.Exists(item.StoragePath))
 | 
			
		||||
            if (item.TargetKind == Reference.ReferenceTargetKind.File || item.TargetKind == Reference.ReferenceTargetKind.Project)
 | 
			
		||||
            {
 | 
			
		||||
                if (String.IsNullOrEmpty(Path.GetExtension(item.StoragePath)))
 | 
			
		||||
                    key += "Unknown";
 | 
			
		||||
@@ -43,7 +43,7 @@ namespace RainmeterStudio.UI.Controller
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Not a file, try to figure out if a directory
 | 
			
		||||
            else if (item.Count > 0 || Directory.Exists(item.StoragePath))
 | 
			
		||||
            else if (item.TargetKind == Reference.ReferenceTargetKind.Directory)
 | 
			
		||||
            {
 | 
			
		||||
                key += "Directory";
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,17 +35,6 @@ namespace RainmeterStudio.UI.ViewModel
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the path
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Path
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return Reference.StoragePath;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets an enumerable of this object's children
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@@ -120,9 +109,16 @@ namespace RainmeterStudio.UI.ViewModel
 | 
			
		||||
        {
 | 
			
		||||
            Reference = reference;
 | 
			
		||||
            Reference.CollectionChanged += Reference_CollectionChanged;
 | 
			
		||||
            Reference.PropertyChanged += Reference_PropertyChanged;
 | 
			
		||||
            RefreshChildren();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Reference_PropertyChanged(object sender, PropertyChangedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.PropertyName == "Name" && PropertyChanged != null)
 | 
			
		||||
                PropertyChanged(this, new PropertyChangedEventArgs("Name"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Reference_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            List<ReferenceViewModel> newItems = new List<ReferenceViewModel>();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user