Ejemplo n.º 1
0
		public void Update()
		{
			var list = new List<LayoutPartDescriptionGroupViewModel>();
			_map = new Dictionary<Guid, LayoutPartDescriptionViewModel>();
			var groups = Enum.GetValues(typeof(LayoutPartDescriptionGroup)).Cast<LayoutPartDescriptionGroup>().
				Where(item => item != LayoutPartDescriptionGroup.Root).
				ToDictionary(item => item, item => new LayoutPartDescriptionGroupViewModel(item));
			foreach (var module in ApplicationService.Modules)
			{
				var layoutDeclarationModule = module as ILayoutDeclarationModule;
				if (layoutDeclarationModule != null)
					foreach (var layoutPartDescription in layoutDeclarationModule.GetLayoutPartDescriptions())
					{
						var layoutPartDescriptionViewModel = new LayoutPartDescriptionViewModel(layoutPartDescription);
						if (layoutPartDescription.Group == LayoutPartDescriptionGroup.Root)
							list.Add(layoutPartDescriptionViewModel);
						else
							groups[layoutPartDescription.Group].AddChild(layoutPartDescriptionViewModel);
						_map.Add(layoutPartDescription.UID, layoutPartDescriptionViewModel);
					}
			}
			list.AddRange(groups.Values.Where(item => item.ChildrenCount > 0));
			list.Sort(Comparer);
			LayoutParts = new ObservableCollection<LayoutPartDescriptionGroupViewModel>(list);
		}
Ejemplo n.º 2
0
		public LayoutPartViewModel(LayoutPartDescriptionViewModel layoutPartDescriptionViewModel)
		{
			LayoutPartDescriptionViewModel = layoutPartDescriptionViewModel;
			LayoutPart = new LayoutPart()
			{
				DescriptionUID = LayoutPartDescriptionViewModel.LayoutPartDescription.UID,
				UID = Guid.NewGuid(),
			};
			Initialize();
			LayoutPart.Properties = Content.Properties;
		}
Ejemplo n.º 3
0
		public void Update(Layout layout)
		{
			_layout = layout;
			var map = new Dictionary<Guid, int>();
			if (_layout != null)
				foreach (var layoutPart in _layout.Parts)
					if (map.ContainsKey(layoutPart.DescriptionUID))
						map[layoutPart.DescriptionUID]++;
					else
						map.Add(layoutPart.DescriptionUID, 1);
			foreach (var layoutPart in LayoutParts)
				if (map.ContainsKey(layoutPart.LayoutPartDescription.UID))
					layoutPart.Count = map[layoutPart.LayoutPartDescription.UID];
				else
					layoutPart.Count = 0;
			SelectedLayoutPart = LayoutParts.FirstOrDefault();
		}
Ejemplo n.º 4
0
		public void AddLayoutPart(LayoutPartDescriptionViewModel layoutPartDescriptionViewModel, bool dragging)
		{
			var layoutPartViewModel = new LayoutPartViewModel(layoutPartDescriptionViewModel);
			LayoutParts.Add(layoutPartViewModel);
			ActiveLayoutPart = layoutPartViewModel;
			if (dragging)
				Manager.StartDragging(layoutPartViewModel);
		}