void EditExpensePage_Loaded(object sender, RoutedEventArgs e)
 {
     // Setting databindings
     int selectedExpenseIndex = int.Parse(this.NavigationContext.QueryString["selectedIndex"]);
     selectedExpense = Expenses.Instance.All[selectedExpenseIndex];
     EditExpenseGrid.DataContext = selectedExpense;
 }
        private void Click_Save(object sender, EventArgs e)
        {
            double newAmount;
            if (double.TryParse(AmountTextBox.Text, out newAmount))
            {
                selectedExpense.Amount = newAmount;
                selectedExpense.Description = DescriptionTextBox.Text;
                selectedExpense = null;
                Expenses.Instance.Serialize();
                NavigationService.GoBack();

                return;
            }
            else
            {
                MessageBox.Show("Invalid format entered for amount.");
            }
        }
Ejemplo n.º 3
0
 public void Add(Expense expense)
 {
     _expenseList.Add(expense);
     NotifyPropertyChanged("Balance");
     NotifyPropertyChanged("All");
 }