Implement IDisposable for CommandStream
This commit is contained in:
@@ -21,10 +21,7 @@ namespace PlantBox.Client.ViewModels
|
||||
|
||||
public HomeViewModel()
|
||||
{
|
||||
var ids = App.Settings.IDs.ToList();
|
||||
ids.Add(152);
|
||||
|
||||
Plants = LoadPlants(ids);
|
||||
Plants = LoadPlants(App.Settings.IDs);
|
||||
}
|
||||
|
||||
public ObservableCollection<PlantInfo> LoadPlants(IEnumerable<ulong> ids)
|
||||
@@ -42,8 +39,8 @@ namespace PlantBox.Client.ViewModels
|
||||
private IEnumerable<PlantInfo> GetPlantInfos(IEnumerable<ulong> ids)
|
||||
{
|
||||
using (var client = new TcpClient(App.Settings.BrokerIP, Connection.TCP_CLIENT_PORT))
|
||||
using (var stream = new CommandStream(client.GetStream()))
|
||||
{
|
||||
var stream = new CommandStream(client.GetStream());
|
||||
|
||||
foreach (ulong id in ids)
|
||||
{
|
||||
|
||||
@@ -123,8 +123,8 @@ namespace PlantBox.Client.ViewModels
|
||||
private void LoadValues()
|
||||
{
|
||||
using (var client = new TcpClient(App.Settings.BrokerIP, Connection.TCP_CLIENT_PORT))
|
||||
using (var stream = new CommandStream(client.GetStream()))
|
||||
{
|
||||
var stream = new CommandStream(client.GetStream());
|
||||
|
||||
// Captors info
|
||||
stream.Send(new CaptorsRequest().ToCommandPacket(PlantInfo.ID));
|
||||
|
||||
Reference in New Issue
Block a user