|
@@ -52,6 +52,8 @@ public partial class BuzzerLight : UserControl
|
|
|
if (e.NewValue is not BuzzerLightEnum lightEnum)
|
|
if (e.NewValue is not BuzzerLightEnum lightEnum)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ _warningTimer?.Dispose();
|
|
|
|
|
+
|
|
|
light.Red.Width = DisableWidth;
|
|
light.Red.Width = DisableWidth;
|
|
|
light.Yellow.Width = DisableWidth;
|
|
light.Yellow.Width = DisableWidth;
|
|
|
light.Green.Width = DisableWidth;
|
|
light.Green.Width = DisableWidth;
|
|
@@ -79,8 +81,8 @@ public partial class BuzzerLight : UserControl
|
|
|
if (border is null)
|
|
if (border is null)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
- border.Width=EnableWidth;
|
|
|
|
|
- border.Height=EnableHeight;
|
|
|
|
|
|
|
+ border.Width = EnableWidth;
|
|
|
|
|
+ border.Height = EnableHeight;
|
|
|
border.IsEnabled = true;
|
|
border.IsEnabled = true;
|
|
|
|
|
|
|
|
border.Background = lightEnum switch
|
|
border.Background = lightEnum switch
|
|
@@ -92,6 +94,30 @@ public partial class BuzzerLight : UserControl
|
|
|
_ => null
|
|
_ => null
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ if (lightEnum == BuzzerLightEnum.Red)
|
|
|
|
|
+ {
|
|
|
|
|
+ _warningTimer = new(WarningTimerCallBack, light, 2000, 2000);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static Timer? _warningTimer;
|
|
|
|
|
+ private static void WarningTimerCallBack(object? state)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (state is not BuzzerLight light)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ App.Current.Dispatcher?.Invoke(() =>
|
|
|
|
|
+ {
|
|
|
|
|
+ light.Red.Background = (SolidColorBrush)App.Current.FindResource("LightEmergencyColor");
|
|
|
|
|
+ });
|
|
|
|
|
+ Thread.Sleep(500);
|
|
|
|
|
+ App.Current.Dispatcher?.Invoke(() =>
|
|
|
|
|
+ {
|
|
|
|
|
+ light.Red.Background = (SolidColorBrush)App.Current.FindResource("EmergencyColor");
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|