Пример #1
0
		public DevicePropertiesViewModel(ElementGKDevice elementDevice, CommonDesignerCanvas designerCanvas)
		{
			Title = "Свойства фигуры: Устройство ГК";
			_elementGKDevice = elementDevice;
			PositionSettingsViewModel = new PositionSettingsViewModel(_elementGKDevice as ElementBase, designerCanvas);

			RootDevice = AddDeviceInternal(GKManager.DeviceConfiguration.RootDevice, null);
			if (SelectedDevice != null)
				SelectedDevice.ExpandToThis();
		}
Пример #2
0
		public Painter(CommonDesignerCanvas designerCanvas, ElementGKDevice elementGKDevice)
			: base(designerCanvas, elementGKDevice)
		{
			_elementGKDevice = elementGKDevice;
			_toolTip = new ImageTextTooltipViewModel();
		}
Пример #3
0
		private void Initialize(ElementGKDevice element)
		{
			var device = PlanPresenter.Cache.Get<GKDevice>(element.DeviceUID);
			AddState(device);
		}
Пример #4
0
		public static PlanElement FromDevice(ElementGKDevice item)
		{
			// Находим девайс и набор его состояний
			var device =
				GKManager.Devices.FirstOrDefault(d => d.UID == item.DeviceUID);
			if (device == null)
			{
				return null;
			}

			// Создаем элемент плана
			var shape = new PlanElement
			{
				Id = "pe" + device.UID,
				SubElementId = device.UID.ToString(),
				Name = device.PresentationName,
				Image = GetDeviceStatePic(device, device.State),
				X = item.Left - 7,
				Y = item.Top - 7,
				Height = 30,
				Width = 30,
				Type = ShapeTypes.GkDevice.ToString(),
				HasOverlay = false
			};
			// Добавляем рамку хинта
			var planElement = new PlanElement
			{
				ChildElements = new[] { shape },
				Id = "pe" + device.UID,
				SubElementId = device.UID + "GroupElement",
				Hint = GetElementHint(item),
				Type = ShapeTypes.Group.ToString(),
				Width = 30,
				Height = 30,
				HasOverlay = true,
				Name = device.PresentationName,
				Device = new Device(device),
				GkObject = new Device(device),
				BorderMouseOver = InternalConverter.ConvertColor(Colors.Orange),
				X = item.Left - 7,
				Y = item.Top - 7
			};
			return planElement;
		}