终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

TheSlider.cs 1.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using BPASmartClient.Compiler;
  2. using BPASmartClient.SCADAControl;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace BPASmartClient.SCADAControl.CustomerControls
  18. {
  19. public class TheSlider : Slider, IExecutable
  20. {
  21. public event EventHandler PropertyChange; //声明一个事件
  22. static TheSlider()
  23. {
  24. DefaultStyleKeyProperty.OverrideMetadata(typeof(TheSlider), new FrameworkPropertyMetadata(typeof(TheSlider)));
  25. }
  26. public string ControlType => "控件";
  27. private bool isExecuteState;
  28. public bool IsExecuteState
  29. {
  30. get { return isExecuteState; }
  31. set
  32. {
  33. isExecuteState = value;
  34. if (IsExecuteState)
  35. {
  36. Register();
  37. }
  38. }
  39. }
  40. public string ValueChangedExecute
  41. {
  42. get { return (string)GetValue(ValueChangedExecuteProperty); }
  43. set { SetValue(ValueChangedExecuteProperty, value); }
  44. }
  45. public static readonly DependencyProperty ValueChangedExecuteProperty =
  46. DependencyProperty.Register("ValueChangedExecute", typeof(string), typeof(TheSlider), new PropertyMetadata(string.Empty));
  47. public void Register()
  48. {
  49. ValueChanged += TheSlider_ValueChanged;
  50. }
  51. private void TheSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
  52. {
  53. Config.GetInstance().RunJsScipt(ValueChangedExecute);
  54. }
  55. public void Dispose()
  56. {
  57. }
  58. }
  59. }