SubStationView.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using NEIntelligentControl2.Service.Station;
  2. using SVGViewer.Models.Info;
  3. using SVGViewer.Views;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace NEIntelligentControl2.Views.BoostStation
  19. {
  20. /// <summary>
  21. /// 二次图视图
  22. /// </summary>
  23. public partial class SubStationView : UserControl
  24. {
  25. private ShapeInfo _ShapeInfo;
  26. /// <summary>
  27. /// 右键菜单事件
  28. /// </summary>
  29. public Action<SubStationView, ShapeInfo, string> ContentMenuAction { get; set; }
  30. private Dictionary<string, ShapeInfo> _CustomizeShapes;
  31. private StationManager _StationManager;
  32. public SubStationView()
  33. {
  34. InitializeComponent();
  35. }
  36. public SubStationView(ShapeInfo v) : this()
  37. {
  38. this._ShapeInfo = v;
  39. _StationManager = App.ServiceProvider.GetService(typeof(StationManager)) as StationManager;
  40. _CustomizeShapes = _StationManager.GetCustomizeShapesDic();
  41. }
  42. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  43. {
  44. //_svg.InitInfo(_ShapeInfo);
  45. var sv = new SVGCanvas(_ShapeInfo, _CustomizeShapes, false);
  46. _vb.Child = sv;
  47. _TBTitle.Text = _ShapeInfo.Name;
  48. }
  49. private void MenuItem_Click(object sender, RoutedEventArgs e)
  50. {
  51. ContentMenuAction?.Invoke(this, _ShapeInfo, ((Control)sender).Tag as string);
  52. }
  53. internal void SwitchInfo(ShapeInfo info)
  54. {
  55. var sv = new SVGCanvas(info, _CustomizeShapes, false);
  56. _vb.Child = sv;
  57. }
  58. }
  59. }