public async Task UpdateOrderAsync() { MobileServiceInvalidOperationException exception = null; string content; try { var table = AzureMobileService.CustomersService.GetTable <Order>(); var orders = await table.ToListAsync(); var item = orders.First(); item.Item = ItemValueUpdate; await table.UpdateAsync(item); Assert.IsNotNull(item); Assert.AreEqual(item.Item, ItemValueUpdate); Assert.AreEqual(item.Quantity, Quantity); var lookupItem = await table.LookupAsync(item.Id); Assert.IsNotNull(lookupItem); Assert.AreEqual(lookupItem.Item, ItemValueUpdate); } catch (MobileServiceInvalidOperationException mobileServiceInvalidOperationException) { exception = mobileServiceInvalidOperationException; } if (exception != null) { content = await exception.Response.Content.ReadAsStringAsync(); Debug.WriteLine(content); Assert.Fail(content); } }
private async void myListView_Loaded(object sender, RoutedEventArgs e) { MobileServiceInvalidOperationException exception = null; try { NavigationContext.QueryString.TryGetValue("ID_USER_ASIC", out ID_USER_ASIC); items = await App.MobileService.GetTable <post>().Where(todoItem => todoItem.id == ID_USER_ASIC).ToCollectionAsync(); post listitem = myListView.ItemsSource as post; var firstFromGroup = items.First(); txtValid_id.Text = firstFromGroup.id; txtValid_title.Text = firstFromGroup.title; txtxValid_status.Text = firstFromGroup.status; try { OnMessageReceived(firstFromGroup.description); txtDisplayText = null; } catch {} } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception == null) { myListView.DataContext = items; } }
public async Task RefreshVehiclesAsync() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems Items = await vehicles .OrderBy(x => x.Name) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { } }
public async Task DeleteOrderAsync() { MobileServiceInvalidOperationException exception = null; string content; try { var table = AzureMobileService.CustomersService.GetTable <Order>(); var orders = await table.ToListAsync(); var item = orders.First(); var id = orders.First().Id; await table.DeleteAsync(item); try { item = await table.LookupAsync(id); } catch (MobileServiceInvalidOperationException ex) { Assert.IsTrue(ex.Response.StatusCode == HttpStatusCode.NotFound); } } catch (MobileServiceInvalidOperationException mobileServiceInvalidOperationException) { exception = mobileServiceInvalidOperationException; } if (exception != null) { content = await exception.Response.Content.ReadAsStringAsync(); Debug.WriteLine(content); Assert.Fail(content); } }
private async void Button_Click(object sender, RoutedEventArgs e) { string name = unames.Text; pr.IsActive = true; upass = (await App.MobileService.GetTable <users>() .Where(users => users.userid == name) .Select(users => users.password) .ToEnumerableAsync()).FirstOrDefault(); MobileServiceInvalidOperationException e1 = null; pr.IsActive = false; try { if (pass.Password == upass) { await new MessageDialog("Login Successful").ShowAsync(); this.Frame.Navigate(typeof(Feed), name); } else { await new MessageDialog("Invalid Credentials").ShowAsync(); } } catch (MobileServiceInvalidOperationException e2) { e1 = e2; } if (e1 != null) { await new MessageDialog(e1.Message).ShowAsync(); } }
public async void RefreshMatches() { if (App.SelectedTeam == null) { return; } MobileServiceInvalidOperationException exception = null; MatchesCollection = null; try { MatchesCollection = await matchesTable.Where( match => match.TeamId.ToString() == App.SelectedTeam.Id.ToString()) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { OnCollectionLoaded(); } }
private static async Task RefreshUserAsync_ThrowsOnException(HttpStatusCode statusCode, string message) { string appUrl = MobileAppUriValidator.DummyMobileApp; string refreshUrl = appUrl + ".auth/refresh"; string userId = "sid:xxxxxxxxxxxxxxxxx"; TestHttpHandler hijack = new TestHttpHandler(); hijack.Response = TestHttpHandler.CreateResponse("error message from Mobile Apps refresh endpoint", statusCode); MobileServiceHttpClient.DefaultHandlerFactory = () => hijack; MobileServiceClient client = new MobileServiceClient(appUrl, hijack); client.CurrentUser = new MobileServiceUser(userId) { MobileServiceAuthenticationToken = "auth-token" }; MobileServiceInvalidOperationException exception = await AssertEx.Throws <MobileServiceInvalidOperationException>(() => client.RefreshUserAsync()); Assert.AreEqual(EnumValueAttribute.GetValue(MobileServiceFeatures.RefreshToken), hijack.Request.Headers.GetValues(MobileServiceHttpClient.ZumoFeaturesHeader).FirstOrDefault()); Assert.AreEqual(message, exception.Message); Assert.IsNotNull(exception.Request); Assert.AreEqual(statusCode, exception.Response.StatusCode); }
private async Task InitMindMaps() { MobileServiceInvalidOperationException exception = null; try { _mindmaps = await _mindmapTable.ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading mindmap data.").ShowAsync(); } else { Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { CurrentMindMap = _mindmaps[0]; dynamic json = JValue.Parse(_mindmaps[0].Content); RootNode = BuildTree(new Node(), json); ParentList = RootNode.Children; }); } }
private async Task RefreshTitleItems2() { MobileServiceInvalidOperationException exception = null; try { // This code sorts the title in descending order with entries from the todoitem table // The query excludes completed TodoItems items = await todoTable .Where(TodoItem => TodoItem.Complete == false) .OrderByDescending(todoItem => todoItem.Title) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { ListItems.ItemsSource = items; this.TitleSort2.IsEnabled = true; } }
public async void LoadComboBox() { MobileServiceInvalidOperationException exception = null; try { ProgressBarBefore(); deshidratadoras = await DeshTable .Select(Desh => Desh) .ToCollectionAsync(); comboBox.ItemsSource = deshidratadoras; ProgressBarAfter(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error al cargar!").ShowAsync(); } if (comboBox.SelectedItem == null) { BtnActualizar.IsEnabled = false; DatePickerToChart.IsEnabled = false; } else { BtnActualizar.IsEnabled = true; DatePickerToChart.IsEnabled = true; } }
async private void EditRecipe_Clicked(object sender, RoutedEventArgs e) { AddRecipeGrid.Visibility = Visibility.Collapsed; EditRecipeGrid.Visibility = Visibility.Visible; ViewRecipeGridHeader.Visibility = Visibility.Collapsed; ClearUpdate(); MobileServiceInvalidOperationException exception = null; try { singleRecipe = await recipesList .Where(RecipesList => RecipesList.userID == MainPage.SessionUser.sessionUsername) .OrderBy(RecipesList => RecipesList.recipeName) .ToCollectionAsync(); if (singleRecipe.Count == 0) { await new MessageDialog("No Recipes Available to Update").ShowAsync(); } else { editRecipeName.Items.Clear(); for (int i = 0; i < singleRecipe.Count; i++) { editRecipeName.Items.Add(singleRecipe[i].recipeName); } } } catch (MobileServiceInvalidOperationException ex) { exception = ex; } }
private async Task RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(TodoItem => TodoItem.Complete == false) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } //else //{ // ListItems.ItemsSource = items; // this.btnRefresh.IsEnabled = true; //} }
private async Task RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view items = await todoTable .Where(todoItem => todoItem.Complete == false) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { //ListItems.ItemsSource = items; this.ButtonSave.IsEnabled = true; } }
private async Task RefreshTodoItems() { foreach (var child in children) { if (child.Name == amountKidsList.SelectedItem) { LocalChildId = child.Id; } } MobileServiceInvalidOperationException exception = null; // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(todoItem => todoItem.Complete == false) .Where(todoItem => todoItem.IdChild == LocalChildId) .ToCollectionAsync(); if (items.Count == 0) { await new MessageDialog("all tasks completed").ShowAsync(); } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { ListItems.ItemsSource = items; this.ButtonSave.IsEnabled = true; } }
async private void DeleteCourseForm_Tapped(object sender, TappedRoutedEventArgs e) { //populated delete course form information for easy deletion. MobileServiceInvalidOperationException exception1 = null; try { if (deleteSelectedName.SelectedValue != null) { classList = await completedCourses .Where(CoursesComplete => CoursesComplete.courseName == deleteSelectedName.SelectedItem.ToString() && CoursesComplete.courseRemoved == false) .ToCollectionAsync(); deleteId.Text = classList[0].Id; deleteCourseName.Text = classList[0].courseName; deleteCourseNumber.Text = classList[0].courseNumber; deleteCreditsReceived.Text = classList[0].courseCredits; deleteGrade.Text = classList[0].gradeReceived; deleteQuarter.Text = classList[0].quarterComplete; deleteInstructor.Text = classList[0].instructorName; } else { await new MessageDialog("Course Name not selected").ShowAsync(); } } catch (MobileServiceInvalidOperationException e2) { exception1 = e2; } }
private async Task RefreshTeams() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems teams = await teamsTable.ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading teams").ShowAsync(); } else { TeamsListItems.ItemsSource = teams; AddTeamButton.IsEnabled = true; MyProgressRing.Visibility = Visibility.Collapsed; } }
public async Task <TodoItem> RefreshTodoItemAsync(string key) { MobileServiceInvalidOperationException exception = null; MobileServiceCollection <TodoItem, TodoItem> items = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(l => l.Id == key) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading item").ShowAsync(); } return(items.ToList <TodoItem>().FirstOrDefault()); }
// Referesh List Method private async Task RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems user = await todoTable .Where(TodoItem => TodoItem.Complete == false) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { var dialog = new MessageDialog("Successfully Updated"); await dialog.ShowAsync(); } }
private async Task RefreshTodoItems() { //App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount); MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(todoItem => todoItem.Complete == false) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { ListItems.ItemsSource = items; this.ButtonSave.IsEnabled = true; } }
private async void radioButtonEliminar_Checked(object sender, RoutedEventArgs e) { disableTexBox(); comboBoxIdTecnicoEditar.IsEnabled = true; buttonEliminar.Visibility = Visibility.Visible; textBlockTitleNewEdit.Text = "Eliminar Técnico"; comboBoxIdTecnicoEditar.DisplayMemberPath = "id"; comboBoxIdTecnicoEditar.SelectedValuePath = "id"; try { ProgressBarBefore(); usuarios = await UsuariosTable .Select(Tecnicos => Tecnicos) .Where(Tecnicos => Tecnicos.Tipo == "Tecnico") .ToCollectionAsync(); comboBoxIdTecnicoEditar.ItemsSource = usuarios; ProgressBarAfter(); if (usuarios.Count >= 1) { comboBoxIdTecnicoEditar.SelectedIndex = 0; } } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error al cargar!").ShowAsync(); } }
private async Task RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .OrderBy(todoItem => todoItem.Text) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { ListItems.ItemsSource = items; this.ButtonSave.IsEnabled = true; } }
// gegevens uit database halen private async Task RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems. items = await todoTable .Where(todoItem => todoItem.Complete == false) .ToCollectionAsync(); //gegevens database in observeble collection plaatsn foreach (TodoItem item in items) { //item.Add(item);//items tovoegen } } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { //ListItems.ItemsSource = items; //this.ButtonSave.IsEnabled = true; } }
async private void LoadEditRecipe_Clicked(object sender, RoutedEventArgs e) { MobileServiceInvalidOperationException exception1 = null; try { if (editRecipeName.SelectedValue != null) { singleRecipe = await recipesList .Where(RecipesList => RecipesList.recipeName == editRecipeName.SelectedItem.ToString()) .ToCollectionAsync(); editHiddenID.Text = singleRecipe[0].Id; editHiddenRecipeName.Text = singleRecipe[0].recipeName; editRecipeShareable.IsChecked = singleRecipe[0].isChecked; editingredient1.Text = singleRecipe[0].ingredient1; editingredient2.Text = singleRecipe[0].ingredient2; editingredient3.Text = singleRecipe[0].ingredient3; editingredient4.Text = singleRecipe[0].ingredient4; editingredient5.Text = singleRecipe[0].ingredient5; editingredient6.Text = singleRecipe[0].ingredient6; editingredient7.Text = singleRecipe[0].ingredient7; } else { await new MessageDialog("Recipe Name not selected.").ShowAsync(); } } catch (MobileServiceInvalidOperationException e1) { exception1 = e1; } }
private async Task RefreshAuthFName() { MobileServiceInvalidOperationException exception = null; try { // This code sorts the by authors first name in ascending order in the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(TodoItem => TodoItem.Complete == false) .OrderBy(todoItem => todoItem.FirstName) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { ListItems.ItemsSource = items; this.AuthFSort.IsEnabled = true; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); string title = (string)e.Parameter; MobileServiceInvalidOperationException exception = null; try { CommentsItems = await CommentsTable. Where(Comments => Comments.to == title). ToCollectionAsync(); } catch (MobileServiceInvalidOperationException ex) { exception = ex; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { int length = CommentsItems.Count(); for (int count = 0; count < length; count++) { ListItems.Items.Add(CommentsItems[count].title); } } Ring.IsActive = false; }
private async Task RefreshProducts() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the Products table. // The query excludes completed Products. items = await productTable .Where(Product => Product.SKU != null) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } else { //ListItems.ItemsSource = items; //this.ButtonSave.IsEnabled = true; } }
private async void RefreshTodoItems() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. // The query excludes completed TodoItems items = await todoTable .Where(todoItem => todoItem.Complete == false) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { MessageBox.Show(exception.Message, "Error loading items"); } else { ListItems.ItemsSource = items; } }
private async Task RefreshOrderList() { MobileServiceInvalidOperationException exception = null; try { orders = await ordersTable .OrderByDescending(x => x.Id) .ToCollectionAsync(); customers = await customersTable.CreateQuery().ToCollectionAsync(); ListItems.ItemsSource = orders; TextCustomer.ItemsSource = customers; } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); } }
private async void RefreshAsync() { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the TodoItems table. items = await todoTable.ToCollectionAsync(); myList = new List <string>(); foreach (ToDoItem item in items) { myList.Add(item.Text); } } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { } else { list.ItemsSource = myList; } }
public async Task <bool> RefreshSessionItems(dxevent _chosenSession) { MobileServiceInvalidOperationException exception = null; try { // This code refreshes the entries in the list view by querying the session table. items = await sessionTable .Where(sessionItem => sessionItem.eventid == _chosenSession.id) .ToCollectionAsync(); } catch (MobileServiceInvalidOperationException e) { exception = e; } if (exception != null) { //await new MessageDialog(exception.Message, "Error loading items").ShowAsync(); return(false); } else { return(true); } }
public async Task PushAsync_IsAborted_OnAuthenticationError() { var authError = new MobileServiceInvalidOperationException(String.Empty, new HttpRequestMessage(), new HttpResponseMessage(HttpStatusCode.Unauthorized)); await TestPushAbort(authError, MobileServicePushStatus.CancelledByAuthenticationError); }
private static void ValidateExpectedFailure(string attemptedAction, string tableName, bool crudShouldWork, bool tableRequiresAuth, MobileServiceInvalidOperationException innerException) { if (crudShouldWork) { string errorMessage; if (!tableRequiresAuth) { errorMessage = string.Format("Anonymous {0} to unprotected table {1} should have succeeded. Instead, found Status Code: {2}. Reason: {3}.", attemptedAction, tableName, innerException.Response.StatusCode, innerException.Response.ReasonPhrase); } else { errorMessage = string.Format("Authenticated {0} to protected table {1} should have succeeded. Instead, found Status Code: {2}. Reason: {3}.", attemptedAction, tableName, innerException.Response.StatusCode, innerException.Response.ReasonPhrase); } throw new Exception(errorMessage, innerException); } }
private bool VerifyRequestUri(MobileServiceInvalidOperationException ex, string expectedRequestUri) { string requestUri = ex.Response.RequestMessage.RequestUri.ToString(); if (ex.Response.StatusCode == HttpStatusCode.NotFound && requestUri == expectedRequestUri) { Log("Login request routed expected endpoint"); return true; } Log(string.Format("Expected request Uri: {0} Acutual request Uri: {1}"), expectedRequestUri, requestUri); return false; }