public void OnCompleted(object sender, EventArgs e) { var mi = ((MenuItem)sender); GoalsDB.CompletedGoal(mi.CommandParameter.ToString()); DisplayGoals(periodIndex); }
public void OnRemove(object sender, EventArgs e) { var mi = ((MenuItem)sender); GoalsDB.RemoveGoal(mi.CommandParameter.ToString()); //BindingContext = _goalsPreviewList; DisplayGoals(periodIndex); }
public FutureTodoPage() { InitializeComponent(); BindingContext = new FutureTodoVM { Todos = GoalsDB.GetFuture() }; futureList.ItemsSource = GoalsDB.GetFuture(); futureList.ItemTemplate = new DataTemplate(typeof(TextCell)); // has context actions defined futureList.ItemTemplate.SetBinding(TextCell.TextProperty, "Title"); futureList.ItemTemplate.SetBinding(TextCell.DetailProperty, "Text"); }
public ArchivedTodoPage() { InitializeComponent(); BindingContext = new CompletedTodoVM { Todos = GoalsDB.GetCompleted() }; completedList.ItemsSource = GoalsDB.GetCompleted(); completedList.ItemTemplate = new DataTemplate(typeof(TextCell)); // has context actions defined completedList.ItemTemplate.SetBinding(TextCell.TextProperty, "Title"); completedList.ItemTemplate.SetBinding(TextCell.DetailProperty, "Text"); }
public MainPage() { _listGoals = GoalsDB.GetInstance(); // Start reviewing weekly goal's. _goalsPreviewList = new GoalsPreviewVM(); //DisplayGoals(periodIndex); InitializeComponent(); //goalsListView.ItemSelected += OnSelection; //goalsListView.ItemTapped += OnTap; }
async void AddNewTodo(object sender, EventArgs e) { //TODO.Views. //string title = titleEntry.Text(); Goal item = new Goal { Title = titleEntry.Text, Text = textEntry.Text, DatePlanned = datePlannedPicker.Date }; //Todo: Make new TodoItem Object and save it to db. GoalsDB.AddTodo(item); await Navigation.PopAsync(); }
// 0 = Weekly, 1 = Quarter, 2 = ... void DisplayGoals(int index) { // Parses index between avalible marginal. if (index < 0) { periodIndex = 3; } else if (index >= 4) { periodIndex = 0; } switch (periodIndex) { case 0: _goalsPreviewList.Todos = GoalsDB.GetWeekList(); _goalsPreviewList.Intro = "Weekly Goals"; _goalsPreviewList.Summary = "There is " + _goalsPreviewList.Todos.Count + " Goals this week"; break; case 1: _goalsPreviewList.Todos = GoalsDB.GetQuarterList(); _goalsPreviewList.Intro = "Month Goals"; _goalsPreviewList.Summary = "There is " + _goalsPreviewList.Todos.Count + " Goals this month"; break; case 2: _goalsPreviewList.Todos = GoalsDB.GetQuarterList(); _goalsPreviewList.Intro = "Quarter Goals"; _goalsPreviewList.Summary = "There is " + _goalsPreviewList.Todos.Count + " Goals this quarter"; break; case 3: _goalsPreviewList.Todos = GoalsDB.GetYearList(); _goalsPreviewList.Intro = "Year Goals"; _goalsPreviewList.Summary = "There is " + _goalsPreviewList.Todos.Count + " Goals this year"; break; } goalsListView.ItemsSource = _goalsPreviewList.Todos; periodTitle.Text = _goalsPreviewList.Intro; BindingContext = _goalsPreviewList; }