| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Input;
- using System.Windows.Media.Imaging;
- namespace DeviceManagement.Controls;
- public partial class DevicePlot : UserControl
- {
- public DevicePlot()
- {
- InitializeComponent();
- }
- public DeviceInfo_VM DeviceInfo
- {
- get { return (DeviceInfo_VM)GetValue(DeviceInfoProperty); }
- set { SetValue(DeviceInfoProperty, value); }
- }
- public static readonly DependencyProperty DeviceInfoProperty =
- DependencyProperty.Register("DeviceInfo", typeof(DeviceInfo_VM), typeof(DevicePlot), new PropertyMetadata(default));
- public ICommand SettingCommand
- {
- get { return (ICommand)GetValue(SettingCommandProperty); }
- set { SetValue(SettingCommandProperty, value); }
- }
- public static readonly DependencyProperty SettingCommandProperty =
- DependencyProperty.Register("SettingCommand", typeof(ICommand), typeof(DevicePlot), new PropertyMetadata(default));
- public ICommand DetailCommand
- {
- get { return (ICommand)GetValue(DetailCommandProperty); }
- set { SetValue(DetailCommandProperty, value); }
- }
- public static readonly DependencyProperty DetailCommandProperty =
- DependencyProperty.Register("DetailCommand", typeof(ICommand), typeof(DevicePlot), new PropertyMetadata(default));
- }
- internal class DeviceImageConverter : IValueConverter
- {
- public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is not DeviceModel deviceModel)
- return null;
- return deviceModel switch
- {
- DeviceModel.JetKepler => new BitmapImage(new Uri("/DeviceManagement;component/Resources/Kepler.png", UriKind.Relative)),
- DeviceModel.Proxima => new BitmapImage(new Uri("/DeviceManagement;component/Resources/Furnace.png", UriKind.Relative)),
- _ => null
- };
- }
- public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return null;
- }
- }
|