Example #1
0
        static async Task RegisterDevice()
        {
            LampResponse response = await LampClient.RegisterDevice();

            if (response.IsOk)
            {
                ContentView.Indicator.IsConnected = true;
                Accounts.Add(new Account(LampClient.IP, LampClient.REGISTEREDUSERNAME));
                LocalStorage.Instance.Write(Accounts);
            }
            else
            {
                if (response.LinkNotPressedError)
                {
                    CreateLinkAlert();
                }
                else
                {
                    CreateAlert(response.Error.Description, "Something went terribly wrong",
                                delegate { },
                                delegate { }
                                );
                }
            }
        }
Example #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ContentView = new MainView();

            Device.Measure(ContentView);

            ContentView.Frame = WindowSize;

            Accounts = LocalStorage.Instance.Read();

            LampClient.IPConfigured       += RegisterDevice;
            LampClient.FailedToRegisterIP += EpicFail;

            ContentView.CorrectKeyPressed += OnCorrectKeyPress;

            LampClient.ConfigureIP(Accounts);

            try
            {
                Application.Run(ContentView);
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION! -" + e.Message);
            }
        }
Example #3
0
        public RepositoryInterface.Models.Lamp[] GetAllLamps()
        {
            var client = new LampClient();

            var a = client.GetAll();

            client.Close();

            return(a);
        }
Example #4
0
 static void ChangeLampColor(LampColor color)
 {
     LampClient.TurnLampToColor(color);
 }
Example #5
0
 static void TurnLightsOff()
 {
     LampClient.TurnLightsOff();
 }