private bool CheckToken(string host, LoginWithResponse loginWith) { if (loginWith == null) { return(false); } var path = host + @"/API/REST/Authorization/CheckToken?token=" + loginWith.AuthToken; try { var response = connectionService.SendGet(path, null); if (response.Contains("Запуск сервера ELMA")) { return(false); } loginWith = serializationService.Deserialize <LoginWithResponse>(response); return(true); } catch (Exception ex) { return(false); } }
private string LoginWith(GlobalSettings settings) { var path = settings.Host + @"/API/REST/Authorization/LoginWith?username="******"Запуск сервера ELMA")) { return("Не удалось подключиться к серверу ELMA: " + "Запуск сервера ELMA"); } loginWith = serializationService.Deserialize <LoginWithResponse>(response); return(string.Empty); } catch (WebException ex) { return("Не удалось найти сервер ELMA"); } catch (Exception ex) { return("Не удалось подключиться к серверу ELMA: " + ex.Message); } return("Не удалось подключиться к серверу ELMA: " + "Неизвестная ошибка"); }
public async void ResetConnection() { loginWith = null; }