/// <summary>
        /// Decorate the base expense View based on the type and behaviors of the current expense.
        /// </summary>
        /// <param name="expense"></param>
        public static ExpenseMainView CreateExpenseView(msdyn_expense expense)
        {
            // base view for any kind of expense
            ExpenseMainView expenseView          = new ExpenseMainView(expense);
            IExpenseView    decoratedExpenseView = expenseView;

            // Decorate with Receipt behavior
            decoratedExpenseView = new ReceiptBehaviorView(expenseView);

            expenseView.ExtendedExpenseBehavior = decoratedExpenseView;
            decoratedExpenseView.CreateContent();
            return(expenseView);
        }
        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();
        }
Пример #3
0
        protected async System.Threading.Tasks.Task NavigateToExpenseDetailsView(msdyn_expense expense)
        {
            ExpenseMainView expenseDetails = ExpenseViewFactory.CreateExpenseView(expense);

            await this.Navigation.PushAsync(expenseDetails);
        }