Exemplo n.º 1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Qusition)
            {
                qusition = (Qusition)e.Parameter;
                if (qusition.Qlabel1 == "")
                {
                    Label1.Visibility = Visibility.Collapsed;
                }
                if (qusition.QLabel2 == "")
                {
                    Label2.Visibility = Visibility.Collapsed;
                }
                SetBlockValue();
                Qusitionid = qusition.Qusitionid;
                Askerid    = qusition.Askerid;
                await GetAllAnswer(qusition.Qusitionid);
            }
            else if (e.Parameter is Answershow answershow)
            {
                someoneshow = answershow;
                await GetById(someoneshow.Qusitionid);
            }
            else if (e.Parameter is int ID)
            {
                await GetById(ID);
            }
            base.OnNavigatedTo(e);
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Artical)
            {
                artical = (Artical)e.Parameter;
                await GetComment(artical.Userid, artical.Articalid);
            }
            else if (e.Parameter is ArtComment artComment)
            {
                await GetComment(artComment.Userid, artComment.Articalid, artComment);

                FromPage = 1;
            }
            base.OnNavigatedTo(e);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += BackRequested;
            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }
                else if (e.PreviousExecutionState == ApplicationExecutionState.Suspended)
                {
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
                await NameMap.Read();
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = rootFrame.CanGoBack ?
                                                                                          AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
                rootFrame.Navigated += OnNavigated;
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            base.OnNavigatedTo(e);
            if (e.Parameter is Artical)
            {
                artical = (Artical)e.Parameter;
                if (artical.Userid == people.UserId)
                {
                    AddFriendIcon.IsEnabled = false;
                }
                else
                {
                    await GetisFollow(artical.Userid);
                }
            }
            this.Bindings.Update();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Dictionary <string, string> keyValues)
            {
                Qusitionid = Convert.ToInt32(keyValues["Qusitionid"]);
                Userid     = Convert.ToInt32(keyValues["Userid"]);
                Names      = keyValues["Name"];
                await GetComment(Qusitionid, Userid);
            }
            else if (e.Parameter is Comment comment)
            {
                Comments = comment;
                await GetComments(comment.Qusitionid, comment.Userid, comment);

                FromPage = 1;
            }
            base.OnNavigatedTo(e);
        }