private void Fill() { plcConnection = new PLConnection(SelectedCPU, SelectedMachine); Slot = plcConnection.Slot; Rack = plcConnection.Rack; CPUBox = new ObservableCollection <CpuType>() { CpuType.S71200, CpuType.S71500, CpuType.S7200, CpuType.S7300, CpuType.S7400, }; MachineBox = new ObservableCollection <string> { Data.IP1, Data.IP2, Data.IP3, Data.IP4, Data.IP5, }; IPText = Data.IP1; }
public ViewPLCViewModel(ICSVWritter csvWritter, ICSVReader csvReader, IPLCMethods plcMethods, PLConnection pLConnection, IPlcServices plcServices) { #region RelayCommands _refreshCommand = new RelayCommand(Refresh); _exportCommand = new RelayCommand(Export); _writteArticleCommand = new RelayCommand(WritteArticle); _writteOrderCommand = new RelayCommand(WritteOrder); _writtePositionCommand = new RelayCommand(WrittePosition); _writteMetersCommand = new RelayCommand(WritteMeters); _backToMenuCommand = new RelayCommand(BacktoMenu); #endregion #region Interfaces _csvReader = csvReader; _csvWritter = csvWritter; _plcMethods = plcMethods; _plcServices = plcServices; #endregion #region Services _messageViewModel = new MessageViewModel(); #endregion #region Connection _pLConnection = pLConnection; //plc = new Plc(pLConnection.CPUType, pLConnection.CurrentIp, pLConnection.Rack, pLConnection.Slot); //_plcMethods.StartNewConnection(plc); #endregion #region Fill Data Fill(plc); #endregion #region ViewsModels #endregion }
private void View() { PLConnection connection = new PLConnection(_selectedCPU, _selectedMachine) { Rack = 2, Slot = 0, }; teufelbergerConnection = _plcServices.GetPathList(); _viewPLCViewModel = new ViewPLCViewModel(_csvWritter, _csvReader, _plcMethods, connection, _plcServices) { path = teufelbergerConnection.MachinePaths[MachineIndex], }; var view = new ViewPLC { DataContext = _viewPLCViewModel, }; _viewPLCViewModel.IP = _selectedMachine; plcConnection.CurrentIp = _selectedMachine; view.Show(); }