Ejemplo n.º 1
0
		protected override Infrustructure.Plans.Elements.ElementBaseRectangle CreateElement()
		{
			var element = new ElementRectangleTank();
			var propertiesViewModel = new TankPropertiesViewModel(element);
			DialogService.ShowModalWindow(propertiesViewModel);
			Helper.SetXDevice(element);
			return element;
		}
Ejemplo n.º 2
0
		public TankPropertiesViewModel(ElementRectangleTank element)
		{
			_element = element;
			Title = "Свойства фигуры: Бак";

			Devices = new ObservableCollection<XDevice>(XManager.Devices.Where(item => item.DriverType == XDriverType.RSR2_Bush));
			if (_element.XDeviceUID != Guid.Empty)
				SelectedDevice = Devices.FirstOrDefault(x => x.UID == _element.XDeviceUID);
		}
Ejemplo n.º 3
0
		public static XDevice GetXDevice(ElementRectangleTank element)
		{
			return XManager.Devices.FirstOrDefault(x => x.UID == element.XDeviceUID);
			//return element.XDeviceUID != Guid.Empty && _xdeviceMap != null && _xdeviceMap.ContainsKey(element.XDeviceUID) ? _xdeviceMap[element.XDeviceUID] : null;
		}
Ejemplo n.º 4
0
		public static string GetTankTitle(ElementRectangleTank element)
		{
			var device = GetXDevice(element);
			return device == null ? "Бак" : "Бак " + device.DottedAddress;
		}
Ejemplo n.º 5
0
		public static XDevice GetXDevice(ElementRectangleTank element)
		{
			return element.XDeviceUID == Guid.Empty ? null : XManager.DeviceConfiguration.Devices.Where(item => item.DriverType == XDriverType.RSR2_Bush && item.UID == element.XDeviceUID).FirstOrDefault();
		}
Ejemplo n.º 6
0
		public static void SetXDevice(ElementRectangleTank element)
		{
			XDevice xdevice = GetXDevice(element);
			SetXDevice(element, xdevice);
		}
Ejemplo n.º 7
0
		public static void SetXDevice(ElementRectangleTank element, XDevice device)
		{
			element.XDeviceUID = device == null ? Guid.Empty : device.UID;
			element.BackgroundColor = GetTankColor(device);
		}
Ejemplo n.º 8
0
		public override ElementBase Clone()
		{
			var elementBase = new ElementRectangleTank();
			Copy(elementBase);
			return elementBase;
		}