Example #1
0
        private async void btnEdit_Clicked(object sender, EventArgs e)
        {
            RegularDataItem selectedItem = (RegularDataItem)listViewRegularData.SelectedItem;
            RegularData     editItem     = selectedItem.DbRegDataItem;
            string          title        = string.Empty;

            if (editItem.CategoryType == Constants.EXPENSE_STRING)
            {
                title = Panda_Kakei.Resources.AppResource.EditRegularExpenseText;
            }
            else if (editItem.CategoryType == Constants.INCOME_STRING)
            {
                title = Panda_Kakei.Resources.AppResource.EditRegularIncomeText;
            }

            btnEdit.IsEnabled = false;

            string message = Constants.EDITED_REGULAR_DATA_ITEM_MESSAGE;
            Page   newPage = new RegularDataItemPage(title, true, editItem);

            MessagingCenter.Unsubscribe <RegularDataItemPage>(this, message);
            MessagingCenter.Subscribe <RegularDataItemPage>(this, message, (RegularDataItemPage) =>
            {
                loadRegularDataItemsFromDB();
                // Send message back to SettingsPage that will referesh calculations on MainPage
                MessagingCenter.Send <ViewRegularDataItemPage>(this, Constants.ADD_EDIT_REGULAR_DATA_ITEM_MESSAGE);

                MessagingCenter.Unsubscribe <RegularDataItemPage>(this, message);
            });

            await Navigation.PushAsync(newPage);

            btnEdit.IsEnabled = true;
        }
Example #2
0
        private async void btnAdd_Clicked(object sender, EventArgs e)
        {
            btnAdd.IsEnabled = false;

            Page   newPage = new RegularDataItemPage(Panda_Kakei.Resources.AppResource.AddRegularIncomeExpenseText);
            string message = Constants.ADDED_REGULAR_DATA_ITEM_MESSAGE;

            MessagingCenter.Unsubscribe <RegularDataItemPage>(this, message);
            MessagingCenter.Subscribe <RegularDataItemPage>(this, message, (RegularDataItemPage) =>
            {
                loadRegularDataItemsFromDB();
                // Send message back to SettingsPage that will referesh calculations on MainPage
                MessagingCenter.Send <ViewRegularDataItemPage>(this, Constants.ADD_EDIT_REGULAR_DATA_ITEM_MESSAGE);

                MessagingCenter.Unsubscribe <RegularDataItemPage>(this, message);
            });

            await Navigation.PushAsync(newPage);

            btnAdd.IsEnabled = true;
        }