Пример #1
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            if (suspensionState.Any())
            {
                // use cache value(s)
                // clear any cache
                suspensionState.Clear();
            }
            else
            {
                var progressDialog = UserDialogs.Instance.Loading("Loading Active Jobs...", maskType: MaskType.Clear);

                ActiveJobDataCollection.Clear();
                var activeTrips = tripDataManager.GetActiveTrips();
                ActiveJobDataCollection.AddRange(activeTrips);

                progressDialog?.Dispose();
            }

            if (mode == NavigationMode.New)
            {
                var navigationView = NavigationService.Frame.BackStack.FirstOrDefault(b => b.SourcePageType.Name == nameof(TripView));
                if (navigationView != null)
                {
                    NavigationService.Frame.BackStack.Remove(navigationView);
                }
            }

            await Task.CompletedTask;
        }
Пример #2
0
        private async void AddClientCommandExecute()
        {
            AddJobDialog dialog = new AddJobDialog();
            await dialog.ShowAsync();

            if (dialog.DiagResult == ContentDialogResult.Primary && dialog.NewTrip != null)
            {
                var progressDialog = UserDialogs.Instance.Loading("Adding New Trip...", maskType: MaskType.Clear);

                tripDataManager.SaveTrip(dialog.NewTrip);
                ActiveJobDataCollection.Clear();
                var activeTrips = tripDataManager.GetActiveTrips();
                ActiveJobDataCollection.AddRange(activeTrips);

                progressDialog?.Dispose();
            }
        }