using ivf_tl_Operate.Converts; using System; using System.Collections.Generic; 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; namespace ivf_tl_Operate.CustomUserControls { /// /// StatusControl.xaml 的交互逻辑 /// public partial class StatusControl : UserControl { public StatusControl() { InitializeComponent(); } /// /// 系统正在报警数量 /// public int Count { get { return (int)GetValue(CountProperty); } set { SetValue(CountProperty, value); } } public static readonly DependencyProperty CountProperty = DependencyProperty.Register("Count", typeof(int), typeof(StatusControl), new PropertyMetadata(0, new PropertyChangedCallback(OnCountPropertyChangedCallback))); private static void OnCountPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var source = d as StatusControl; var number = (int)e.NewValue; if (number > 0) { //source._abnormalText.Content = $"系统异常({number})"; source._abnormalText.Content = $"{KeyToStringConvert.GetLanguageStringByKey("C0270")}({number})"; source._normal.Visibility = Visibility.Collapsed; source._abnormal.Visibility = Visibility.Visible; } else { source._normal.Visibility = Visibility.Visible; source._abnormal.Visibility = Visibility.Collapsed; } } } }