public MyGoalViewModel(ISqlite sqlite, IDialogService dialog)
        {
            this.dialog   = dialog;
            SelectedGoals = new ObservableCollection <SelectedGoal>()
            {
            };
            this.selectedGoalDatabase = new SelectedGoalDatabase(sqlite);
            this.goalDatabase         = new GoalDatabase(sqlite);

            loadSelectedGoalsFromDbToday();
            ViewSelectedGoalCommand = new MvxCommand <SelectedGoal>(selectedSelectedGoal =>
            {
                ShowViewModel <GoalUpdateViewModel>(new { selectedGoalId = selectedSelectedGoal.Id });
            }
                                                                    );
        }
Exemple #2
0
        public GoalListViewModel(ISqlite sqlite, IDialogService dialog)
        {
            this.dialog = dialog;
            Goals       = new ObservableCollection <Goal>()
            {
            };
            this.goalDatabase         = new GoalDatabase(sqlite);
            this.selectedGoalDatabase = new SelectedGoalDatabase(sqlite);

            // only do this for one time, it will clear existing database. beware, may clear dependencies
            insertSampleGoalsToDbIfNotExist();
            loadGoalsFromDb();

            SelectGoalCommand = new MvxCommand <Goal>(selectedGoal => {
                ShowViewModel <GoalDetailViewModel>(selectedGoal);
            }
                                                      );
        }
        public GoalDiaryViewModel(ISqlite sqlite, IDialogService dialog)
        {
            this.dialog   = dialog;
            SelectedGoals = new ObservableCollection <SelectedGoal>()
            {
            };

            this.selectedGoalDatabase = new SelectedGoalDatabase(sqlite);
            this.goalDatabase         = new GoalDatabase(sqlite);

            // only do this if doesn exist. will clear existing selected goals.

            loadSelectedGoalsFromDb();
            ViewSelectedGoalCommand = new MvxCommand <SelectedGoal>(selectedSelectedGoal =>
            {
                ShowViewModel <GoalUpdateViewModel>(new { selectedGoalId = selectedSelectedGoal.Id });
            }
                                                                    );
        }
Exemple #4
0
 public GoalDetailViewModel(ISqlite sqlite, IDialogService dialog)
 {
     //Debug.WriteLine("###############  initialize sqlite");
     this.selectedGoalDatabase = new SelectedGoalDatabase(sqlite);
 }
Exemple #5
0
 public GoalUpdateViewModel(ISqlite sqlite)
 {
     this.selectedGoalDatabase = new SelectedGoalDatabase(sqlite);
     this.goalDatabase         = new GoalDatabase(sqlite);
 }