Пример #1
0
        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"));
        }
Пример #2
0
        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");
        }
Пример #3
0
        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"));
            }
        }
Пример #4
0
        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");
            }
        }
Пример #5
0
 public ClientCredentials(NetAtmo.Gadget gadget)
     : base(gadget)
 {
 }
Пример #6
0
 public DeviceList(NetAtmo.Gadget gadget)
     : base(gadget)
 {
 }
Пример #7
0
 public GetUser(NetAtmo.Gadget gadget)
     : base(gadget)
 {
 }
Пример #8
0
 public RefreshToken(NetAtmo.Gadget gadget)
     : base(gadget)
 {
 }
Пример #9
0
 public Core(NetAtmo.Gadget gadget)
 {
     Gadget = gadget;
 }