Пример #1
0
        private async void ExecuteRunExtendedDialog(object o)
        {
            //#if (DEBUG)
            //            if (GlobalUser.USERCARD == null)
            //            {
            //                GlobalUser.USERCARD = new ST.Models.Api.Card()
            //                {
            //                    CardNo = "111",
            //                    CardName = "222",
            //                    ValidityBegin = "1520930224000",//"2017.11.14",
            //                    ValidityEnd = "1520930224000",//"2018.11.13",
            //                };
            //            }
            //#else
            //               GlobalUser.USERCARD = new ST.Models.Api.Card()
            //            {
            //                CardNo = "111",
            //                CardName = "222",
            //                ValidityBegin = "1520930224000",//"2017.11.14",
            //                ValidityEnd = "1520930224000",//"2018.11.13",
            //            };

            //#endif

            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new BindCardOKDialog()
            {
                DataContext = new BindCardOKVM()
                {
                    CardNo   = GlobalUser.USER.Card.card_key,
                    CardName = $"{GlobalUser.USER.Card.grade}年级",
                    Validity = $"{Convert.ToDateTime(GlobalUser.USER.Card.used_time).ToString("yyyy年MM月dd日")} - {Convert.ToDateTime(GlobalUser.USER.Card.expire_time).ToString("yyyy年MM月dd日")}"
                }
            };

            // 绑卡后更新用户菜单有效期
            ChangeCardEvent?.Invoke(GlobalUser.USER.Card.expire_time);

            #region 刷新用户信息...

            //GlobalUser.USERCARD
            //Validity

            #endregion

            //show the dialog
            await DialogHostEx.ShowDialog(GlobalUser.MainWin, view, ExtendedOpenedEventHandler);

            //check the result...
            //Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Пример #2
0
        private async void ExecuteRunExtendedDialog(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new BindCardOKDialog()
            {
                DataContext = new BindCardOKVM()
                {
                    CardNo   = GlobalUser.STUDYCARD.card_key,
                    CardName = $"{GlobalUser.STUDYCARD.grade}年级",
                    Validity = $"{Convert.ToDateTime(GlobalUser.STUDYCARD.used_time).ToString("yyyy年MM月dd日")} - {Convert.ToDateTime(GlobalUser.STUDYCARD.expire_time).ToString("yyyy年MM月dd日")}"
                }
            };

            // 绑卡后更新用户菜单有效期
            ChangeCardEvent?.Invoke(GlobalUser.STUDYCARD.expire_time);
            //show the dialog
            await DialogHostEx.ShowDialog(GlobalUser.MainWin, view, ExtendedOpenedEventHandler);
        }