public async Task Login() { using (ComosWeb cw = GetComosWeb()) { var task = cw.Login(); Console.WriteLine(string.Format("heartbeat = {0}", task.Result.HeartBeat)); Console.WriteLine(string.Format("Id = {0}", task.Result.Id)); Console.WriteLine(string.Format("UserId = {0}", task.Result.UserId)); var value = await cw.Logout(); } }
public async Task <CSession> Login() { if (m_Platform.IsOnline) { var tmp = await m_ComosWebOnline.Login(); if (tmp != null) { string url = m_Url + "sessions/actions/Login"; string output = Newtonsoft.Json.JsonConvert.SerializeObject(tmp); m_Database.WriteUrlCache(url, output); return(tmp); } } return(await m_ComosWebOffline.Login()); }
private ComosWeb GetComosWeb(bool login = false) { if (m_ComosWeb != null) { return(m_ComosWeb); } ComosHttp m_Http = new ComosHttp(); m_ComosWeb = new ComosWeb(m_Http, url); if (m_ComosWeb.Connect("comos", "gert.denul", "45erYU&*11").Result != System.Net.HttpStatusCode.OK) { Assert.Fail(); } if (login == true) { var task = m_ComosWeb.Login(); task.Wait(); } return(m_ComosWeb); }