예제 #1
0
        public AddFuelInstancePage(FuelingInstance fuelingInstance)
        {
            this.viewModel = new AddFuelInstanceViewModel(fuelingInstance);

            if (this.viewModel.SelectedCar != null)
            {
                this.Title = this.viewModel.SelectedCar.Make + " " + this.viewModel.SelectedCar.Model;
            }

            InitializeComponent();
            BindingContext = this.viewModel;
        }
예제 #2
0
        public EfficiencyReportsViewModel()
        {
            if (this.SnapGasDb.Cars.ToList().Count > 0 && this.SnapGasDb.FuelingInstances.ToList().Count > 0)
            {
                var currentCar = this.SnapGasDb.Cars.Where(c => c.IsSelected == true).ToList();
                this.SelectedCar = currentCar[0];
                var currentFuelInstance = this.SnapGasDb.FuelingInstances.Where(f => f.IsSelected == true).ToList();
                this.SelectedFuelingInstance = currentFuelInstance[0];

                if (currentCar.Count == 1 && currentFuelInstance.Count == 1)
                {
                    var reports = this.SnapGasDb.EfficiencyReports
                                  .Where(r => r.CarId == this.SelectedCar.Id && r.FuelInstanceId == this.SelectedFuelingInstance.Id).ToList();
                    if (reports.Count == 0)
                    {
                        this.AddEnbled = true;
                    }
                }
            }
        }
예제 #3
0
        //private bool addEnabled = false;
        //public bool AddEnbled
        //{
        //    get { return addEnabled; }
        //    set { SetProperty(ref addEnabled, value); }
        //}

        public AddFuelInstanceViewModel(FuelingInstance fuelingInstance)
        {
            this.SelectedCar = this.SnapGasDb.Cars.Where(c => c.IsSelected == true).FirstOrDefault();

            this.FuelingInstance = fuelingInstance;
        }