async public void Refresh() { textSection.Clear(); NetAtmo.Gadget gadget = new NetAtmo.Gadget(Config.Id, Config.Secret, Config.UserName, Config.Password); if (await gadget.ClientCredentials.ExecuteAsync()) { textSection.Add(new StringElement("RefreshToken {0}", gadget.ClientCredentials.Executed.Result.Data.RefreshToken.ToString())); textSection.Add(new StringElement("AccessToken {0}", gadget.ClientCredentials.Executed.Result.Data.AccessToken.ToString())); if (await gadget.DeviceList.ExecuteAsync()) { foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) textSection.Add(new StringElement("Station", device.StationName)); foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) textSection.Add(new StringElement(device.ModuleName, device.DashboardData.Temperature.ToString())); foreach (var module in gadget.DeviceList.Executed.Result.Data.Body.Modules) textSection.Add(new StringElement(module.ModuleName, module.DashboardData.Temperature.ToString())); } else if (gadget.DeviceList.Executed.IsException) textSection.Add(new StringElement("Exception gadget.DeviceList {0}", gadget.DeviceList.Executed.Exception.ToString())); else textSection.Add(new StringElement("Error gadget.DeviceList")); } else if (gadget.ClientCredentials.Executed.IsException) textSection.Add(new StringElement("Exception gadget.ClientCredentials {0}", gadget.ClientCredentials.Executed.Exception.ToString())); else textSection.Add(new StringElement("Error gadget.ClientCredentials")); }
async public void View() { Clear(); NetAtmo.Gadget gadget = new NetAtmo.Gadget(Config.Id, Config.Secret, Config.UserName, Config.Password); if (await gadget.ClientCredentials.ExecuteAsync()) { if (await gadget.DeviceList.ExecuteAsync()) { foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) WriteLine("Station={0}", device.StationName); foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) WriteLine("Name={0} Temp={1}", device.ModuleName, device.DashboardData.Temperature.ToString()); foreach (var module in gadget.DeviceList.Executed.Result.Data.Body.Modules) WriteLine("Name={0} Temp={1}", module.ModuleName, module.DashboardData.Temperature.ToString()); } else if (gadget.DeviceList.Executed.IsException) WriteLine("Exception gadget.DeviceList {0}", gadget.DeviceList.Executed.Exception.ToString()); else WriteLine("Error gadget.DeviceList"); } else if (gadget.ClientCredentials.Executed.IsException) WriteLine("Exception gadget.ClientCredentials {0}", gadget.ClientCredentials.Executed.Exception.ToString()); else WriteLine("Error gadget.ClientCredentials"); }
async public void Refresh() { textSection.Clear(); NetAtmo.Gadget gadget = new NetAtmo.Gadget(Config.Id, Config.Secret, Config.UserName, Config.Password); if (await gadget.ClientCredentials.ExecuteAsync()) { textSection.Add(new StringElement("RefreshToken {0}", gadget.ClientCredentials.Executed.Result.Data.RefreshToken.ToString())); textSection.Add(new StringElement("AccessToken {0}", gadget.ClientCredentials.Executed.Result.Data.AccessToken.ToString())); if (await gadget.DeviceList.ExecuteAsync()) { foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) { textSection.Add(new StringElement("Station", device.StationName)); } foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) { textSection.Add(new StringElement(device.ModuleName, device.DashboardData.Temperature.ToString())); } foreach (var module in gadget.DeviceList.Executed.Result.Data.Body.Modules) { textSection.Add(new StringElement(module.ModuleName, module.DashboardData.Temperature.ToString())); } } else if (gadget.DeviceList.Executed.IsException) { textSection.Add(new StringElement("Exception gadget.DeviceList {0}", gadget.DeviceList.Executed.Exception.ToString())); } else { textSection.Add(new StringElement("Error gadget.DeviceList")); } } else if (gadget.ClientCredentials.Executed.IsException) { textSection.Add(new StringElement("Exception gadget.ClientCredentials {0}", gadget.ClientCredentials.Executed.Exception.ToString())); } else { textSection.Add(new StringElement("Error gadget.ClientCredentials")); } }
async public void View() { Clear(); NetAtmo.Gadget gadget = new NetAtmo.Gadget(Config.Id, Config.Secret, Config.UserName, Config.Password); if (await gadget.ClientCredentials.ExecuteAsync()) { if (await gadget.DeviceList.ExecuteAsync()) { foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) { WriteLine("Station={0}", device.StationName); } foreach (var device in gadget.DeviceList.Executed.Result.Data.Body.Devices) { WriteLine("Name={0} Temp={1}", device.ModuleName, device.DashboardData.Temperature.ToString()); } foreach (var module in gadget.DeviceList.Executed.Result.Data.Body.Modules) { WriteLine("Name={0} Temp={1}", module.ModuleName, module.DashboardData.Temperature.ToString()); } } else if (gadget.DeviceList.Executed.IsException) { WriteLine("Exception gadget.DeviceList {0}", gadget.DeviceList.Executed.Exception.ToString()); } else { WriteLine("Error gadget.DeviceList"); } } else if (gadget.ClientCredentials.Executed.IsException) { WriteLine("Exception gadget.ClientCredentials {0}", gadget.ClientCredentials.Executed.Exception.ToString()); } else { WriteLine("Error gadget.ClientCredentials"); } }
public ClientCredentials(NetAtmo.Gadget gadget) : base(gadget) { }
public DeviceList(NetAtmo.Gadget gadget) : base(gadget) { }
public GetUser(NetAtmo.Gadget gadget) : base(gadget) { }
public RefreshToken(NetAtmo.Gadget gadget) : base(gadget) { }
public Core(NetAtmo.Gadget gadget) { Gadget = gadget; }