Inheritance: Microsoft.Practices.Prism.ViewModel.NotificationObject
Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the EntryEditorViewModel class.
        /// </summary>
        public EntryEditorViewModel(Entry entry, ManifestEditorViewModel manifestEditor)
        {
            Entry           = entry;
            _manifestEditor = manifestEditor;

            Descriptor = _manifestEditor.GetDescriptor(entry.Type, true);
            if (Descriptor == null)
            {
                IsEditable = false;
                Categories = new List <PropertyEntryCategoryEditorViewModel>();
                return;
            }

            IsArtifact = Descriptor.Interfaces.Contains("udm.DeployableArtifact");

            var categoryQuery = from p in Descriptor.Properties
                                where !p.Hidden
                                orderby p.Category ascending
                                let categoryName = p.Category ?? "Common"
                                                   let propertyViewModel = GetPropertyEditor(p)
                                                                           where propertyViewModel != null
                                                                           group propertyViewModel by categoryName into category
                                                                           select new PropertyEntryCategoryEditorViewModel(category.Key, category);

            Categories            = categoryQuery.ToList();
            CurrentViewedCategory = Categories[0];

            IsEditable = true;
        }
		/// <summary>
		/// Initializes a new instance of the EntryEditorViewModel class.
		/// </summary>
		public EntryEditorViewModel(Entry entry, ManifestEditorViewModel manifestEditor)
		{
			Entry = entry;
			_manifestEditor = manifestEditor;

		    Descriptor = _manifestEditor.GetDescriptor(entry.Type, true);
            if (Descriptor == null)
            {
                IsEditable = false;
				Categories = new List<PropertyEntryCategoryEditorViewModel>();
                return;
            }

			IsArtifact = Descriptor.Interfaces.Contains("udm.DeployableArtifact");

			var categoryQuery = from p in Descriptor.Properties
								where !p.Hidden
								orderby p.Category ascending
								let categoryName = p.Category ?? "Common"
								let propertyViewModel = GetPropertyEditor(p)
								where propertyViewModel != null
								group propertyViewModel by categoryName into category
								select new PropertyEntryCategoryEditorViewModel(category.Key, category);

			Categories = categoryQuery.ToList();
			CurrentViewedCategory = Categories[0];

			IsEditable = true;
		}