|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPA.Helper;
- using BPA.Helper;
-
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
-
- namespace BPASmartClient.CustomResource.Pages.ViewModel
- {
- public class VariableViewModel : NotifyBase
- {
- public ObservableCollection<PlcVariableInfoModel> Variables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
-
- public ObservableCollection<PlcVariableInfoModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
- public ObservableCollection<PlcVariableInfoModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
- public ObservableCollection<PlcVariableInfoModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
- public ObservableCollection<PlcVariableInfoModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
- public ObservableCollection<PlcVariableInfoModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
-
- public List<string> DeviceName { get; set; } = new List<string> { "滚筒输送线", "炒锅1", "炒锅2", "炒锅3", "炒锅4", "炒锅5" };
- public BPARelayCommand SaveDataCommand { get; set; }
-
- public VariableViewModel()
- {
- Json<PlcVariableInfoManage>.Read();
-
- try
- {
- if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count>0)
- {
- Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"];
- FryOneVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"];
- FryTwoVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"];
- FryThreeVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"];
- FryFourVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"];
- FryFiveVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"];
- }
- }
- catch (Exception)
- {
-
-
- }
- SaveDataCommand = new BPARelayCommand(() =>
- {
- Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"] = Variables;
- Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"] = FryOneVariables;
- Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"]=FryTwoVariables;
- Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"] = FryThreeVariables;
- Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"]= FryFourVariables;
- Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"] = FryFiveVariables;
- Json<PlcVariableInfoManage>.Save();
- MessageBox.Show("保存成功","提示",MessageBoxButton.OK,MessageBoxImage.Information);
- });
-
- }
-
-
- }
- }
|