Ejemplo n.º 1
0
        public TripsViewModel()
        {
            Title             = "Trips";
            LoadTripsCommand  = new Command(async() => await ExecuteLoadTripsCommand());
            DeleteTripCommand = new Command <Trip>(async trip => await ExecuteDeleteTripCommand(trip));

            TripsHolder = new TripsHolder();
            _           = TripsHolder.LoadTrips();
        }
Ejemplo n.º 2
0
        public SetupTripViewModel(INavigation navigation, Trip trip, TripsHolder tripsHolder)
        {
            Navigation  = navigation;
            Trip        = trip;
            TripsHolder = tripsHolder;

            SwipedCommand = new Command <SwipedCardEventArgs>(eventArgs => ExecuteSwipedCommand(eventArgs));

            Threshold = (uint)(App.ScreenWidth / 3);

            TemplateCategories = TemplateProvider.GetChecklist();
            TemplateCategories.RemoveAll(x => Trip.Categories.Exists(y => y.Name.Equals(x.Name)));
            SelectedCategories = new List <ItemCategory>();
        }
Ejemplo n.º 3
0
        public NewTripViewModel(TripsHolder tripsHolder)
        {
            TripsHolder = tripsHolder;

            NewTrip = new Trip
            {
                Destination = "Destination",
                StartDate   = _startDate,
                EndDate     = _endDate
            };

            ColorA = GetRandomColor();
            ColorB = GetRandomColor();
            SetRandomColorCommand = new Command(ExecuteSetRandomColorCommand);

            SubscribeToMessagingCenter();
        }
Ejemplo n.º 4
0
        public TripDetailViewModel(Trip trip, TripsHolder tripsHolder)
        {
            Title       = trip.Destination;
            TripName    = trip.Destination;
            Trip        = trip;
            TripsHolder = tripsHolder;

            ChecklistGroups = new ObservableCollection <GroupedList>();

            LoadChecklistsCommand      = new Command(async() => await ExecuteLoadChecklistsCommand());
            DeleteChecklistItemCommand = new Command <Item>(async item => await ExecuteDeleteChecklistItemCommand(item));
            AddItemCommand             = new Command <GroupedList>(async groupedList => await ExecuteAddItemCommand(groupedList));
            DeleteCategoryCommand      =
                new Command <GroupedList>(async groupedList => await ExecuteDeleteCategoryCommand(groupedList));

            MessagingCenter.Subscribe <SetupTripViewModel, Trip>(this, "SetupTrip",
                                                                 async(obj, trip) => { await ExecuteLoadChecklistsCommand(); });

            _ = ExecuteLoadChecklistsCommand(true);
            _ = ExecuteLoadInfoCommand();
        }