Beispiel #1
0
		public GKDoorPainter(CommonDesignerCanvas designerCanvas, ElementGKDoor elementGKDoor)
			: base(designerCanvas, elementGKDoor)
		{
			_elementGKDoor = elementGKDoor;
			_toolTip = new ImageTextTooltipViewModel();
			_toolTip.ImageSource = "/Controls;component/Images/Door.png";
		}
		public GKDoorPropertiesViewModel(ElementGKDoor elementGKDoor, CommonDesignerCanvas designerCanvas)
		{
			Title = "Свойства фигуры: Точка доступа";
			_elementGKDoor = elementGKDoor;
			PositionSettingsViewModel = new PositionSettingsViewModel(_elementGKDoor as ElementBase, designerCanvas);
			CreateCommand = new RelayCommand(OnCreate);
			EditCommand = new RelayCommand(OnEdit, CanEdit);
			GKDoors = new ObservableCollection<GKDoor>(GKManager.Doors);
			if (elementGKDoor.DoorUID != Guid.Empty)
				SelectedGKDoor = GKDoors.FirstOrDefault(door => door.UID == elementGKDoor.DoorUID);

		}
Beispiel #3
0
		void OnCreateDragObjectCommand(DataObject dataObject)
		{
			DoorsViewModel.Current.SelectedDoor = this;
			var plansElement = new ElementGKDoor
			{
				DoorUID = Door.UID
			};
			dataObject.SetData("DESIGNER_ITEM", plansElement);
		}
Beispiel #4
0
		private void Initialize(ElementGKDoor element)
		{
			var door = PlanPresenter.Cache.Get<GKDoor>(element.DoorUID);
			AddState(door);
		}
Beispiel #5
0
		public static PlanElement FromGkDoor(ElementGKDoor item)
		{
			var strings = EmbeddedResourceLoader.LoadResource("GKWebService.Content.SvgIcons.GKDoor.txt")
												.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
			var result = Dispatcher.CurrentDispatcher.Invoke(
				() =>
				{
					Debug.WriteLine(
						"App thread is {0}, with appartment = {1}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.GetApartmentState());
					return item.GetRectangle();
				});
			var rect = result;
			var geometry = Geometry.Parse(strings[0]);
			var flatten = geometry.GetFlattenedPathGeometry();
			flatten.Transform = new TranslateTransform(rect.TopLeft.X, rect.TopRight.Y);
			KnownColor color1;
			Enum.TryParse(strings[1], true, out color1);
			KnownColor color2;
			Enum.TryParse(strings[2], true, out color2);
			var shape1 = new PlanElement
			{
				Path = flatten.GetFlattenedPathGeometry().ToString(CultureInfo.InvariantCulture),
				Border = System.Drawing.Color.FromKnownColor(color1),
				Fill = System.Drawing.Color.FromKnownColor(color2),
				BorderMouseOver = InternalConverter.ConvertColor(Colors.Transparent),
				FillMouseOver = InternalConverter.ConvertColor(Colors.Transparent),
				Name = item.PresentationName,
				BorderThickness = item.BorderThickness,
				Type = ShapeTypes.Path.ToString(),
				HasOverlay = false
			};
			geometry = Geometry.Parse(strings[3]);
			flatten = geometry.GetFlattenedPathGeometry();
			flatten.Transform = new TranslateTransform(rect.TopLeft.X, rect.TopRight.Y);
			Enum.TryParse(strings[4], true, out color1);
			Enum.TryParse(strings[5], true, out color2);

			var shape2 = new PlanElement
			{
				Path = flatten.GetFlattenedPathGeometry().ToString(CultureInfo.InvariantCulture),
				Border = System.Drawing.Color.FromKnownColor(color1),
				Fill = System.Drawing.Color.FromKnownColor(color2),
				BorderMouseOver = InternalConverter.ConvertColor(Colors.Transparent),
				FillMouseOver = InternalConverter.ConvertColor(Colors.Transparent),
				Name = item.PresentationName,
				BorderThickness = item.BorderThickness,
				Type = ShapeTypes.Path.ToString(),
				HasOverlay = false
			};

			var planElement = new PlanElement
			{
				ChildElements = new[] { shape1, shape2 },
				Id = "pe" + item.UID,
				Hint = GetElementHint(item),
				Type = ShapeTypes.Group.ToString(),
				Width = 30,
				Height = 30,
				Name = item.PresentationName,
				HasOverlay = true,
				BorderMouseOver = InternalConverter.ConvertColor(Colors.Orange),
				X = rect.Left,
				Y = rect.Top
			};
			return planElement;
		}