private async void LatestOrders_Tap(object sender, System.Windows.Input.GestureEventArgs e) { var OrdersList = new ListBox(); var Orders = await api.GetLatestOrders(5); var Result = new List <OrderData>(); OrdersList.ItemTemplate = App.FindResource <DataTemplate>(this, "OrderTemplate"); OrdersList.SelectionChanged += OrdersList_SelectionChanged; foreach (OrderDTO o in Orders) { SolidColorBrush color = null; switch (o.OrderStatus) { case AppCore.NopAPI.OrderStatus.Complete: color = new SolidColorBrush(Colors.Green); break; case AppCore.NopAPI.OrderStatus.Pending: color = new SolidColorBrush(Colors.Gray); break; case AppCore.NopAPI.OrderStatus.Cancelled: color = new SolidColorBrush(Colors.Red); break; case AppCore.NopAPI.OrderStatus.Processing: color = new SolidColorBrush(Colors.Yellow); break; } var Order = new OrderData { Email = o.OrderEmail, ProductName = o.ProductsList.First().Product.Name, Id = o.OrderID, BackgroundColor = color }; Result.Add(Order); } OrdersList.ItemsSource = Result; CustomMessageBox messageBox = new CustomMessageBox() { Caption = "Latest Orders", Message = "These are the latest orders", Content = OrdersList, LeftButtonContent = "Dismiss" }; messageBox.Show(); }
private async void ShowLatestOrdersPopup() { LinearLayout layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; Orders = await api.GetLatestOrders(5); ListView OrdersList = new ListView(this); OrdersList.Adapter = new OrderSearchAdapter(this, Orders); OrdersList.ItemClick += OrdersList_ItemClick; layout.AddView(OrdersList); var builder = new AlertDialog.Builder(this); builder.SetView(layout); builder.SetTitle("Latest Orders"); builder.SetNeutralButton("Dismiss", (s, e) => { builder.Create().Dismiss(); }); builder.Create().Show(); dialog.Dismiss(); }