private async void _StartApplication_ClickedEvent(Object sender, EventArgs e) { try { _StartApplication.IsEnabled = false; var TargetPath = ATISMobileWebApiMClassManagement.GetTargetPath(); if (System.IO.File.Exists(TargetPath) == false) { System.IO.File.WriteAllText(TargetPath, ""); } string AMUStatus = System.IO.File.ReadAllText(TargetPath); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, new Uri("/api/DataBase/ConfirmAMUStatus")); request.Content = new StringContent(JsonConvert.SerializeObject(AMUStatus), Encoding.UTF8, "application/json"); HttpResponseMessage response = await HttpClientOnlyInstance.HttpClientInstance().SendAsync(request); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); bool Confirmed = JsonConvert.DeserializeObject <bool>(content); if (!Confirmed) { ActivateSoftwareUser(); return; } else { MenuPage _MenuPage = new MenuPage(true); await Navigation.PushAsync(_MenuPage); return; } } else { await DisplayAlert("ATISMobile-Failed", JsonConvert.DeserializeObject <string>(response.Content.ReadAsStringAsync().Result), "تایید"); } } catch (Exception ex) { await DisplayAlert("ATISMobile-Error", ex.Message, "OK"); } }
private async void ActivateSoftwareUser() { System.IO.File.WriteAllText(ATISMobileWebApiMClassManagement.GetTargetPath(), ""); MobileEntryPage _MobileEntryPage = new MobileEntryPage(false); await Navigation.PushAsync(_MobileEntryPage); }