private void Logout() { Task <bool> task = DialogHelper.ShowConfirm(AppResources.APP_TITLE, AppResources.LOGOUT_CONFIRM); task.ContinueWith(t => { if (t.IsCompleted && t.Result) { Application.Current.Properties[Const.CONFIG_API_KEY] = null; Application.Current.SavePropertiesAsync().Wait(); Pkcs12FileHelper.DeleteFile(); Device.BeginInvokeOnMainThread(() => { Application.Current.MainPage = new LoginPage(); }); } }); }