protected override ElementBaseRectangle CreateElement(double left, double top)
		{
			var element = new ElementRectangleTank() { Left = left, Top = top };
			var propertiesViewModel = new TankPropertiesViewModel(element);
			DialogService.ShowModalWindow(propertiesViewModel);
			Helper.SetGKDevice(element);
			return element;
		}
		public TankPropertiesViewModel(ElementRectangleTank element)
		{
			_element = element;
			Title = "Свойства фигуры: Бак";

			Devices = new ObservableCollection<GKDevice>(GKManager.Devices.Where(item => item.DriverType == GKDriverType.RSR2_Bush_Drenazh));
			if (_element.DeviceUID != Guid.Empty)
				SelectedDevice = Devices.FirstOrDefault(x => x.UID == _element.DeviceUID);
		}
Beispiel #3
0
		public static string GetTankTitle(ElementRectangleTank element)
		{
			var device = GetGKDevice(element);
			return device == null ? "Бак" : "Бак " + device.DottedAddress;
		}
Beispiel #4
0
		public static GKDevice GetGKDevice(ElementRectangleTank element)
		{
			return element.DeviceUID == Guid.Empty ? null : GKManager.DeviceConfiguration.Devices.Where(item => item.DriverType == GKDriverType.RSR2_Bush_Drenazh && item.UID == element.DeviceUID).FirstOrDefault();
		}
Beispiel #5
0
		public static void SetGKDevice(ElementRectangleTank element)
		{
			GKDevice device = GetGKDevice(element);
			SetGKDevice(element, device);
		}
Beispiel #6
0
		public static void SetGKDevice(ElementRectangleTank element, GKDevice device)
		{
			element.DeviceUID = device == null ? Guid.Empty : device.UID;
			element.BackgroundColor = GetTankColor(device);
		}