protected override void SetToolbarItems() { ToolbarItem createNewExpense = new ToolbarItem { Text = AppResources.Create, Icon = Device.OnPlatform("add.png", "add.png", "Assets/Icons/add.png"), Order = ToolbarItemOrder.Primary }; createNewExpense.Clicked += async(sender, args) => { ExpenseMainView expenseDetails = ExpenseViewFactory.CreateExpenseView(new msdyn_expense()); await this.Navigation.PushAsync(expenseDetails); }; this.ToolbarItems.Add(createNewExpense); base.SetToolbarItems(); }
/// <summary> /// Check the behaviors of the new category, if there is data that needs to be deleted, /// show a warning message to the user before change category. /// </summary> /// <param name="newExpenseCategory">expense category selected by the user</param> /// <param name="warningMessage">If there is data to delete, message with details of the data to be deleted</param> /// <returns>true if the change of category was successful</returns> public async Task <bool> SetCategory(msdyn_expensecategory newExpenseCategory, string warningMessage = null) { bool allowSetCategory = true; if (!string.IsNullOrEmpty(warningMessage)) { // Confirm with user the change of category string message = string.Format(AppResources.ChangeExpenseTypeWarning, warningMessage); allowSetCategory = await MessageCenter.ShowDialog(message, null, null); } if (allowSetCategory) { this.ViewModel.Expense.ExpenseCategory = newExpenseCategory; // Change category and update new view this.ExtendedExpenseBehavior = ExpenseViewFactory.DecorateExpenseView(this.ExtendedExpenseBehavior); await this.ExtendedExpenseBehavior.CreateContent(); } return(allowSetCategory); }
protected async System.Threading.Tasks.Task NavigateToExpenseDetailsView(msdyn_expense expense) { ExpenseMainView expenseDetails = ExpenseViewFactory.CreateExpenseView(expense); await this.Navigation.PushAsync(expenseDetails); }