终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

85 regels
3.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using BPASmart.Model;
  7. using Microsoft.Toolkit.Mvvm.Input;
  8. using System.Collections.ObjectModel;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using BPA.Helper;
  12. using System.Diagnostics;
  13. using BeDesignerSCADA;
  14. using BeDesignerSCADA.Controls;
  15. using System.Windows;
  16. using System.Reflection;
  17. using System.Collections.Concurrent;
  18. using System.IO.Pipes;
  19. using BPA.Communication;
  20. using System.Threading;
  21. using BeDesignerSCADA.ViewModel;
  22. namespace BPASmart.ConfigurationSoftware
  23. {
  24. public class MainWindowViewModel : NoticeBase
  25. {
  26. public MainWindowViewModel()
  27. {
  28. NewProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenNewProjectWindow(); });
  29. NewPageCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenNewPageWindow(); });
  30. OpenVarManagerCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenVariableManagerTool(); });
  31. SelectedPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SelectedPage(o); });
  32. SaveProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ProjectSave(); });
  33. GengrateCommand = new RelayCommand(async () => { await ServiceCenter.GetInstance.ApplicationBaleAsync(); });
  34. RemovePageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.RemovePageCommand(o); });
  35. ReNameCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.ReNameCommand(o); });
  36. SetStartPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); });
  37. RunCommand = new RelayCommand(async () => { await ServiceCenter.GetInstance.RunProjectAsync(); });
  38. OpenProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenProject(); });
  39. ServiceCenter.GetInstance.PageChange = new Action<FrameworkElement>((f) => { MainContent = f; });
  40. ServiceCenter.GetInstance.ProjectNameChange = new Action<string>((s) => { Head = s; });
  41. mainCanvasPanels = ServiceCenter.GetInstance.mainCanvasPanels;
  42. Pages = ServiceCenter.GetInstance.Pages;
  43. Message = ServiceCenter.GetInstance.Message;
  44. ServiceCenter.GetInstance.Init();
  45. }
  46. public RelayCommand NewProjectCommand { get; set; }
  47. public RelayCommand OpenVarManagerCommand { get; set; }
  48. public RelayCommand<object> SelectedPageCommand { get; set; }
  49. public RelayCommand SaveProjectCommand { get; set; }
  50. public RelayCommand NewPageCommand { get; set; }
  51. public RelayCommand GengrateCommand { get; set; }
  52. public RelayCommand OpenProjectCommand { get; set; }
  53. public RelayCommand<object> RemovePageCommand { get; set; }
  54. public RelayCommand<object> SetStartPageCommand { get; set; }
  55. public RelayCommand<object> ReNameCommand { get; set; }
  56. public RelayCommand RunCommand { get; set; }
  57. public string Head { get { return _mHead; } set { _mHead = value; OnPropertyChanged(); } }
  58. private string _mHead;
  59. public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
  60. private FrameworkElement _mMainContent;
  61. public List<MainCanvasPageModel> mainCanvasPanels { get; set; }
  62. public ObservableCollection<string> Pages { get; set; }
  63. public ObservableCollection<string> Message { get; set; }
  64. }
  65. }