public DisposalEntry(RouteStatus rs, int curDay, int curRoute) { InitializeComponent(); // Disable the navigation bar NavigationPage.SetHasBackButton(this, false); // Create a message to listen for Jump Requests MessagingCenter.Subscribe <JumpToCustomer, int>(this, "JumpTo", (sender, arg) => { _currentCustomerIndex = arg; UpdateRoutine(MoveDirection.Jump); }); // Get the customer list for the day and route _currentDay = curDay + 1; _currentRoute = curRoute + 1; _routeDesc = string.Format("Truck - {0}", _currentRoute); CurrentCustomerList = CCustomerList.GetCustomerListing(_currentDay, _currentRoute); // If the list comes back blank ... tell the user and go back if (CurrentCustomerList == null) { DisplayAlert("Customer List", "The customer list cannot be loaded. The most likely cause is due to a missing file. Please press the Update Customer List button and then try again.", "OK"); Navigation.PopAsync(); } // If this is a new route, clear every thing out if (rs == RouteStatus.StartNew) { CollectionRecord.DeleteDayAndRoute(_currentDay, _currentRoute); } // Fill in the other items that are collected ReadItemsToCollect(); // Go to the first record UpdateRoutine(MoveDirection.Forward); // Set an event when those items are selected CurrentItemList.ItemSelected += (sender, e) => { ItemsCollected colItem = (ItemsCollected)e.SelectedItem; if (colItem != null) { CollectedItems.Add(new CollectionRecord(_currentCustomerId, _currentDay, _currentRoute, colItem.ID.ToString(), 1, colItem.ItemDescription, DateTime.Now, _routeDesc, colItem.MinimumPrice)); } AddToList(); }; }
private void ButtonJumpToCustomer(object sender, EventArgs e) { CurrentCustomer = (CCustomerList)lvJumpTo.SelectedItem; int customerIndex = -1; if (CurrentCustomer != null) { foreach (CCustomerList custObj in customerList) { customerIndex++; if (custObj.Equals(CurrentCustomer)) { break; } } MessagingCenter.Send <JumpToCustomer, int>(this, "JumpTo", customerIndex); Navigation.PopAsync(); } }