MOGeneral.xaml.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using Aitex.Core.Util;
  15. using Aitex.Core.RT.Log;
  16. using Aitex.Core.UI.ControlDataContext;
  17. namespace Aitex.Core.UI.Control
  18. {
  19. /// <summary>
  20. /// Interaction logic for MOGeneral.xaml
  21. /// </summary>
  22. public partial class MOGeneral : UserControl
  23. {
  24. MOLineDataItem MoLineData { get { return (this.DataContext as MOSourceDataItem).LineData; } }
  25. public MOGeneral()
  26. {
  27. InitializeComponent();
  28. }
  29. public static readonly DependencyProperty IsManualModeProperty = DependencyProperty.Register(
  30. "IsManualModeValve3", typeof(bool), typeof(MOGeneral),
  31. new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
  32. /// <summary>
  33. /// Valve_Top on/off status
  34. /// </summary>
  35. public bool IsManualModeValve3
  36. {
  37. get
  38. {
  39. return (bool)GetValue(IsManualModeProperty);
  40. }
  41. set
  42. {
  43. SetValue(IsManualModeProperty, value);
  44. }
  45. }
  46. private void RecMOSource_MouseEnter(object sender, MouseEventArgs e)
  47. {
  48. RecMOSource.Opacity = 0.5;
  49. if (MoLineData != null)
  50. {
  51. string tooltipStr = string.Format("{0}\n\n原始重量:{1}克\n已使用量:{2}克\n剩余重量:{3}克\n剩余比例:{4}\n余量状态:{5}",
  52. MoLineData.DisplayName,
  53. MoLineData.MoTotalWeight.ToString("F2"),
  54. MoLineData.MoUsedWeight.ToString("F2"),
  55. MoLineData.MoRemainedWeight.ToString("F2"),
  56. (MoLineData.MoRemainedPercentage * 100).ToString("F1") + "%",
  57. MoLineData.IsMoRemainedWeightAlarm ? "报警" : "正常");
  58. this.ToolTip = tooltipStr;
  59. }
  60. }
  61. private void RecMOSource_MouseLeave(object sender, MouseEventArgs e)
  62. {
  63. RecMOSource.Opacity = 1;
  64. }
  65. }
  66. }