private void _service_Connected(object sender, PviEventArgs e) { string serviceName = String.Empty; if (sender is Service service) { serviceName = service.FullName; } var cpuWrapper = new CpuWrapper(_service, _eventNotifier); var variableWrapper = new VariableWrapper(_service, _eventNotifier); var fw = new FileWrapper(); var cpuManager = new CpuManager(cpuWrapper); var variableInfo = new VariableInfoCollection(fw); var variableManager = new VariableManager(variableWrapper, variableInfo); var pviEventMsg = Utils.FormatPviEventMessage($"ServiceWrapper._service_Connected; ServiceName={serviceName}", e); _eventNotifier.OnPviServiceConnected(sender, new PviApplicationEventArgs() { Message = pviEventMsg, ServiceWrapper = this, CpuManager = cpuManager, CpuWrapper = cpuWrapper, VariableManager = variableManager, VariableWrapper = variableWrapper }); _pollingService = new PollingService(_service, cpuManager); _pollingService.Start(); }
public async Task UpdateVariables(string cpuName, string[] variableNames) { var fw = new FileWrapper(); var variableCollection = new VariableInfoCollection(fw); await Task.Run(() => { variableCollection.UpdateCpuVariables(cpuName, variableNames); }); }
private void btnRemove_Click(object sender, EventArgs e) { var filepath = ConfigurationProvider.VariableSettingsFile; var collection = new VariableInfoCollection(); collection.Open(filepath); var cpuName = txtCpuName.Text; var names = txtVariables.Lines; collection.RemoveRange(cpuName, names); collection.Save(filepath); }
private void btnAddVariables_Click(object sender, EventArgs e) { var filepath = AppSettings.VariableSettingsFile; var collection = new VariableInfoCollection(new FileWrapper()); collection.Open(filepath); var cpuName = txtCpuName.Text; var names = txtVariables.Lines; collection.AddRange(cpuName, names); collection.Save(filepath); }