protected async override void OnStart() { if (!wifi.IsActive()) { await wifi.Activate(); } await wifi.Scan(); var net = wifi.ScanResult(); var savedNetowrk = net.Where(x => wifi.IsAPInfoStored(x.Name)).FirstOrDefault(); if (savedNetowrk != null) { if (savedNetowrk.State.ToLower() != "connected") { await wifi.Connect(savedNetowrk.Name, string.Empty); } var result = await api.Login(Constants.Email, Constants.Password); if (result) { MainPage = new Garage(api); } else { MainPage = loggedInFail; } } else { MainPage = noInternetPage; } }
static void Main(string[] args) { var api = new MyQApi(); var result = api.Login(Constants.Email, Constants.Password).Result; var garageDoor = api.GetDevices().Result.Where(x => x.DeviceFamily == "garagedoor").FirstOrDefault(); var doorstate = api.GetDoorState(garageDoor.SerialNumber).Result; var setting = api.SetDoorState(garageDoor.SerialNumber, Constants.ActionClose).Result; }