diff --git a/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs b/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs index c94d132b..aaf874e6 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs @@ -35,6 +35,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls public SwitchButton() { + ResourceDictionary languageResDic = new ResourceDictionary(); + languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute); + this.Resources.MergedDictionaries.Add(languageResDic); SetCurrentValue(WidthProperty, 120d); SetCurrentValue(HeightProperty, 40d); } @@ -100,7 +103,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls public static readonly DependencyProperty DKColorProperty = DependencyProperty.Register("DKColor", typeof(Brush), typeof(SwitchButton), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); TranslateTransform transX; - Ellipse ellipse; + public Ellipse ellipse; public override void OnApplyTemplate() { base.OnApplyTemplate(); @@ -119,6 +122,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls } void Refresh() { + if (ellipse == null) { return; @@ -160,6 +164,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls { Class_DataBus.GetInstance().BindingAction += BindingActionHeader; this.Click += SwitchButton_Click; + if (this.IsChecked == true) Config.GetInstance().RunJsScipt(CheckedExec); + else Config.GetInstance().RunJsScipt(UnCheckedExec); + Refresh(); } public void BindingActionHeader(object sender, EventArgs e) { diff --git a/BPASmartClient.SCADAControl/Themes/Generic.xaml b/BPASmartClient.SCADAControl/Themes/Generic.xaml index f334aa56..d8d24a76 100644 --- a/BPASmartClient.SCADAControl/Themes/Generic.xaml +++ b/BPASmartClient.SCADAControl/Themes/Generic.xaml @@ -197,6 +197,40 @@ +