using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BPASmart.Model; using Microsoft.Toolkit.Mvvm.Input; using System.Collections.ObjectModel; using System.Windows.Forms; using System.IO; using BPA.Helper; using System.Diagnostics; using BeDesignerSCADA; using BeDesignerSCADA.Controls; using System.Windows; using System.Reflection; using System.Collections.Concurrent; using System.IO.Pipes; using BPA.Communication; using System.Threading; using BeDesignerSCADA.ViewModel; namespace BPASmart.ConfigurationSoftware { public class MainWindowViewModel : NoticeBase { public MainWindowViewModel() { NewProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenNewProjectWindow(); }); NewPageCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenNewPageWindow(); }); OpenVarManagerCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenVariableManagerTool(); }); SelectedPageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.SelectedPage(o); }); SaveProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ProjectSave(); }); GengrateCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ApplicationBale(); }); RemovePageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.RemovePageCommand(o); }); ReNameCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.ReNameCommand(o); }); SetStartPageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); }); ServiceCenter.GetInstance.PageChange = new Action((f) => { MainContent = f; }); ServiceCenter.GetInstance.ProjectNameChange = new Action((s) => { Head = s; }); mainCanvasPanels = ServiceCenter.GetInstance.mainCanvasPanels; Pages = ServiceCenter.GetInstance.Pages; Message = ServiceCenter.GetInstance.Message; ServiceCenter.GetInstance.Init(); } public RelayCommand NewProjectCommand { get; set; } public RelayCommand OpenVarManagerCommand { get; set; } public RelayCommand SelectedPageCommand { get; set; } public RelayCommand SaveProjectCommand { get; set; } public RelayCommand NewPageCommand { get; set; } public RelayCommand GengrateCommand { get; set; } public RelayCommand RemovePageCommand { get; set; } public RelayCommand SetStartPageCommand { get; set; } public RelayCommand ReNameCommand { get; set; } public string Head { get { return _mHead; } set { _mHead = value; OnPropertyChanged(); } } private string _mHead; public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } } private FrameworkElement _mMainContent; public List mainCanvasPanels { get; set; } public ObservableCollection Pages { get; set; } public ObservableCollection Message { get; set; } } }