private async void getQuotes() { StorageFolder path1 = ApplicationData.Current.LocalFolder; StorageFile sr = await path1.GetFileAsync("quotes.json"); ObservableCollection <string> list = new ObservableCollection <string>(); IList <String> allQuotes = await FileIO.ReadLinesAsync(sr); foreach (var json in allQuotes) { if (json != "") { Deskquote dq1 = JsonConvert.DeserializeObject <Deskquote>(json); string myListItem = "Order: " + dq1.custName + ", "; myListItem = myListItem + dq1.custDesk.width + "'' wide X " + dq1.custDesk.depth + "'' deep, "; myListItem = myListItem + dq1.custDesk.drawers + " drawers, "; myListItem = myListItem + dq1.custDesk.surface.ToString() + " desktop, "; myListItem = myListItem + dq1.orderDate + ", "; myListItem = myListItem + "$" + dq1.price + ", "; myListItem = myListItem + dq1.prodDays + " days to deliver."; list.Add(myListItem); // var dialog = new MessageDialog(myListItem); // dialog.Commands.Add(new UICommand { Label = "OK", Id = 0 }); // var res = await dialog.ShowAsync(); } } quoteGridView.ItemsSource = list; }
private async void submitButton_clickAsync(object sender, RoutedEventArgs e) { try { string name = custNameBox.Text; int wide = Convert.ToInt32(widthBox.Text); int deep = Convert.ToInt32(depthBox.Text); int draw = Convert.ToInt32(drawSlider.Value); int days; if (rushCheckBox.IsChecked == true) { days = Convert.ToInt32(((ComboBoxItem)rushComboBox.SelectedItem).Content); } else { days = 14; } DesktopMaterial surface = (DesktopMaterial)surfaceComboBox.SelectedValue; Deskquote dq = new Deskquote(name, days, wide, deep, draw, surface); dq.writeQuote(); var dialog = new MessageDialog("Your order submitted successfully. We will complete the order in " + days + " days.", "Order Submitted"); dialog.Commands.Add(new UICommand { Label = "OK", Id = 0 }); var res = await dialog.ShowAsync(); Frame.Navigate(typeof(MainPage)); } catch (Exception ex) { var dialog = new MessageDialog(ex.Message, "Submit Failed"); dialog.Commands.Add(new UICommand { Label = "OK", Id = 0 }); var res = await dialog.ShowAsync(); } }