public App() { InitializeComponent(); //For https connexion System.Net.ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; //Read config file to load server URL ApplicationConstants.ReadConfigFile(); //Load and send json which were not sended to server Task.Run(() => { try { EvaluationSender.LoadJsons(); EvaluationSender.SendJsonEvalToServer(); } catch (Exception e) { Console.WriteLine(e.ToString()); } }); //Display the first Page of the app (MainPage => LoginPage) MainPage = new NavigationPage(new Onek.MainPage()); }
protected override void OnSleep() { // Handle when your app sleeps //Load and send json which were not sended to server Task.Run(() => { try { EvaluationSender.LoadJsons(); EvaluationSender.SendJsonEvalToServer(); } catch (Exception) { } }); }
/// <summary> /// Called when user clicks on disconnect button, redirect to login page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> async void OnButtonDeconnexionClicked(object sender, EventArgs e) { bool answer = await DisplayAlert("Deconnexion", "Voulez-vous vraiment vous deconnecter ?", "Oui", "Non"); if (answer) { if (CrossConnectivity.Current.IsConnected) { //Load and send json which were not sended to server Task.Run(() => { try { EvaluationSender.LoadJsons(); EvaluationSender.SendJsonEvalToServer(); } catch (Exception) { } }); } await Navigation.PopAsync(); } }