private async void performAuthentication() { flurlClient = FlurlClient_Singleton.GetInstance(); //loadCustomerPath string firma = Application.Current.Properties["firma"] as string; string urlCus = String.Format("http://myqreg.dk/qreg/{0}", firma); Task <string> getStringTask = urlCus.WithClient(flurlClient).GetStringAsync(); string responseString = await getStringTask; if (responseString != null) { string server = Application.Current.Properties["SERVER"] as string; string brugernavn = Application.Current.Properties["brugernavn"] as string; string password = Application.Current.Properties["password"] as string; string url = String.Format("{0}/names.nsf?login&username={1}&password={2}", server, brugernavn, password); Task <string> getStringTask1 = url.WithClient(flurlClient).GetStringAsync(); string responseString1 = await getStringTask1; if (responseString1 != null) { FlurlClient_Singleton.setFlurlClient(flurlClient); PostToURL(); } } }
private void Button_Clicked(object sender, EventArgs e) { //Clears properties Application.Current.Properties.Clear(); //Clears templateDictionary TemplateDictionary.setDictionary(new Dictionary <string, string>()); //Dispose FlurlClient FlurlClient_Singleton.DisposeInstance(); Application.Current.SavePropertiesAsync(); //Returns to loginPage Application.Current.MainPage.Navigation.PushAsync(new MainPage()); //Unsubscribe to all MessagingCenters MessagingCenter.Unsubscribe <JSONFetcher, string>(this, "loginResponseString"); MessagingCenter.Unsubscribe <JSONFetcher, string>(this, "CUST_PATH_LOADED"); MessagingCenter.Unsubscribe <JSONFetcher>(this, "JSON_ACTION_GET_KEYWORDS_LOADED"); MessagingCenter.Unsubscribe <JSONFetcher>(this, "TEMPLATES_LOADED"); //Clears navigation stack var existingPages = Navigation.NavigationStack.ToList(); foreach (var page in existingPages) { Navigation.RemovePage(page); } }
internal void disposeFlurlClient() { FlurlClient_Singleton.DisposeInstance(); _flurlClient = FlurlClient_Singleton.GetInstance(); }