From 79b66d177f9180f37d7217eeaa331c3d2957cbf9 Mon Sep 17 00:00:00 2001 From: CodeCasterNL Date: Thu, 21 Jul 2022 22:31:01 +0200 Subject: [PATCH] Client initialization --- .../ConfigurationControls/GoodWeApiConfigurator.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CodeCaster.PVBridge.ConfigurationUI.WinForms/ConfigurationControls/GoodWeApiConfigurator.cs b/src/CodeCaster.PVBridge.ConfigurationUI.WinForms/ConfigurationControls/GoodWeApiConfigurator.cs index 8315dfd..3b370f2 100644 --- a/src/CodeCaster.PVBridge.ConfigurationUI.WinForms/ConfigurationControls/GoodWeApiConfigurator.cs +++ b/src/CodeCaster.PVBridge.ConfigurationUI.WinForms/ConfigurationControls/GoodWeApiConfigurator.cs @@ -99,6 +99,8 @@ private async Task ReadDeviceInfoAsync() SetStatus(GoodWeStatus.Authorized); + _client = client; + var firstPlant = plantList.Data.list?.FirstOrDefault(); if (firstPlant?.inverters?.Any() != true) @@ -112,7 +114,6 @@ private async Task ReadDeviceInfoAsync() plantComboBox.ValueMember = nameof(AddressWithInverters.id); plantComboBox.DisplayMember = nameof(AddressWithInverters.DisplayString); - _client = client; plantComboBox.DataSource = plantList.Data.list; plantComboBox.SelectedIndex = 0; @@ -132,8 +133,6 @@ private async void PlantComboBox_SelectedValueChanged(object sender, EventArgs e if (plantComboBox.SelectedItem == null) { - _client = null; - SetStatus(GoodWeStatus.Uninitialized); return;