TimeSpanButton.xaml.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using MuchInfo.Chart.Data.EnumTypes;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. namespace MuchInfo.Chart.WPF.Controls.QuickTimeSpan
  5. {
  6. /// <summary>
  7. /// TimeSpanButton.xaml 的交互逻辑
  8. /// </summary>
  9. public partial class TimeSpanButton : UserControl
  10. {
  11. #region Fields
  12. private TimeSpanPicker _parentTimeSpanControl;
  13. #endregion Fields
  14. #region Constructors
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="TimeSpanButton"/> class.
  17. /// </summary>
  18. /// <param name="text">The text.</param>
  19. /// <param name="cycleType">Type of the cycle.</param>
  20. /// <param name="parent">The parent.</param>
  21. public TimeSpanButton(string text, CycleType cycleType, TimeSpanPicker parent)
  22. {
  23. this.InitializeComponent();
  24. Text = text;
  25. CycleType = cycleType;
  26. _parentTimeSpanControl = parent;
  27. }
  28. #endregion Constructors
  29. #region Properties
  30. #region Public Properties
  31. /// <summary>
  32. /// Gets or sets the type of the cycle.
  33. /// </summary>
  34. /// <value>The type of the cycle.</value>
  35. public CycleType CycleType
  36. {
  37. get;
  38. set;
  39. }
  40. /// <summary>
  41. /// Gets or sets the text.
  42. /// </summary>
  43. /// <value>The text.</value>
  44. public string Text
  45. {
  46. get
  47. {
  48. return this.lblMain.Text;
  49. }
  50. set
  51. {
  52. this.lblMain.Text = value;
  53. }
  54. }
  55. #endregion Public Properties
  56. #endregion Properties
  57. #region Methods
  58. #region Private Methods
  59. /// <summary>
  60. /// 选择显示区间后执行
  61. /// </summary>
  62. private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  63. {
  64. this._parentTimeSpanControl.UpdateCyleType(this.CycleType);
  65. }
  66. #endregion Private Methods
  67. #endregion Methods
  68. }
  69. }