| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Prism;
- using Prism.Ioc;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- using TeamAAS_VP.Core;
- using TeamAAS_VP.Enums;
- namespace TeamAAS_VP.ValueConverter
- {
- public class RobotIdToVisibiltyConverter : IValueConverter
- {
- public bool Inverse { get; set; } = false;
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null && value is Guid id && id != Guid.Empty)
- {
- var app = (PrismApplicationBase)App.Current;
- Management management = app.Container.Resolve<Management>();
- var rbt = management.DeviceConfig.Robots.FirstOrDefault(p => p.Id == id);
- if (rbt != null)
- {
- if (rbt.RobotBrand == RobotBrand.XYZ_Platform || rbt.RobotBrand == RobotBrand.XYZU_Platform)
- {
- return Inverse ? Visibility.Visible : Visibility.Collapsed;
- }
- return Inverse ? Visibility.Collapsed : Visibility.Visible;
- }
- else
- {
- return Visibility.Collapsed;
- }
-
- }
- else
- {
- return Visibility.Collapsed;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return Binding.DoNothing;
- }
- }
- }
|