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 { } ); } } }
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); } }
public RepositoryInterface.Models.Lamp[] GetAllLamps() { var client = new LampClient(); var a = client.GetAll(); client.Close(); return(a); }
static void ChangeLampColor(LampColor color) { LampClient.TurnLampToColor(color); }
static void TurnLightsOff() { LampClient.TurnLightsOff(); }