Exemple #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                AppViewBackButtonVisibility.Collapsed;

            var left = await HttpUtil.GetCheckbook(App.account);

            leftMoney.Text = "宿舍余额:¥" + (string)left["checkbook"]["balance"];

            if (e.Parameter != null)
            {
                if (e.Parameter.GetType() == typeof(Models.JournalItem))
                {
                    this.JItem = (Models.JournalItem)(e.Parameter);
                    if (JItem.message == "create")
                    {
                        //database add
                        await HttpUtil.AddJournal(App.account, JItem.content, JItem.ImageChange);

                        ViewModel.add(JItem);
                        return;
                    }
                    else if (JItem.message == "update")
                    {
                        await HttpUtil.EditJournal(JItem.id, JItem.content, JItem.ImageChange);

                        ViewModel.update(JItem);
                        return;
                    }
                    else if (JItem.message == "delete")
                    {
                        await HttpUtil.DeleteJournal(App.account, JItem.id);

                        ViewModel.delete(JItem);
                        return;
                    }
                }
                if (typeof(Models.MemberItem) == e.Parameter.GetType())
                {
                    MItem = (Models.MemberItem)(e.Parameter);
                    //ViewModel.memberitems.Add(MItem);
                }
            }
            else
            {
                return;
            }
        }