using Bro.Common.Helper;
|
using Bro.Common.Interface;
|
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.Controls;
|
using System.Windows.Data;
|
using System.Windows.Documents;
|
using System.Windows.Input;
|
using System.Windows.Media;
|
using System.Windows.Media.Imaging;
|
using System.Windows.Navigation;
|
using System.Windows.Shapes;
|
using static Bro.Common.Helper.EnumHelper;
|
|
namespace Bro.UI.Ctrls
|
{
|
/// <summary>
|
/// DeviceStatusCtrl.xaml 的交互逻辑
|
/// </summary>
|
public partial class DeviceStatusCtrl : UserControl
|
{
|
public DeviceStatusCtrl()
|
{
|
InitializeComponent();
|
|
lbDevices.ItemsSource = DeviceList;
|
}
|
|
public static readonly DependencyProperty DeviceListProperty;
|
|
public IEnumerable<IDevice> DeviceList
|
{
|
get => GetValue(DeviceListProperty) as List<IDevice>;
|
set => SetValue(DeviceListProperty, value);
|
}
|
|
static DeviceStatusCtrl()
|
{
|
DeviceListProperty = DependencyProperty.Register("DeviceList", typeof(IEnumerable<IDevice>), typeof(DeviceStatusCtrl), new PropertyMetadata(new List<IDevice>(), OnDeviceListPropertyChanged));
|
}
|
|
private static void OnDeviceListPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
{
|
DeviceStatusCtrl ctrl = d as DeviceStatusCtrl;
|
if (ctrl != null)
|
{
|
IEnumerable<IDevice> list = e.NewValue as IEnumerable<IDevice>;
|
|
if (list != null)
|
{
|
ctrl.lbDevices.ItemsSource = list;
|
}
|
}
|
}
|
}
|
}
|