Exemplo n.º 1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            // var group = SampleDataSource.GetGroup((String)navigationParameter);
            // this.DefaultViewModel["Group"] = group;
            // this.DefaultViewModel["Items"] = group.Items;
            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery        query             = navigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (pageState == null)
            {
                this.itemListView.SelectedItem = null;
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]);
                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);
            //this.DefaultViewModel["Group"] = group;
            //this.DefaultViewModel["Items"] = group.Items;DataModel.ComicQueryManager
            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery        query             = e.NavigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);

                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            // var group = SampleDataSource.GetGroup((String)navigationParameter);
            // this.DefaultViewModel["Group"] = group;
            // this.DefaultViewModel["Items"] = group.Items;
            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery query = navigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (pageState == null)
            {
                this.itemListView.SelectedItem = null;
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]);
                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 탐색 중 전달된 콘텐츠로 페이지를 채웁니다. 이전 세션의 페이지를
        /// 다시 만들 때 저장된 상태도 제공됩니다.
        /// </summary>
        /// <param name="sender">
        /// 대개 <see cref="NavigationHelper"/>인 이벤트 소스
        /// </param>
        /// <param name="e">이 페이지가 초기에 요청될 때
        /// <see cref="Frame.Navigate(Type, Object)"/>에 전달되는 탐색 매개 변수와
        /// 이전 세션 동안 이 페이지에 유지된 상태 사전을 제공하는
        /// 이벤트 데이터입니다. 페이지를 처음 방문할 때는 이 상태가 null입니다.< /param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);
            //this.DefaultViewModel["Group"] = group;
            //this.DefaultViewModel["Items"] = group.Items;

            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery        query             = e.NavigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // 새 페이지인 경우에는 논리 페이지 탐색이 사용 중인 경우를 제외하고 첫 번째 항목이
                // 자동으로 선택됩니다(논리 페이지 탐색 #region은 아래를 참조하십시오.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // 이 페이지와 관련하여 이전에 저장된 상태를 복원합니다.
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);

                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);
            //this.DefaultViewModel["Group"] = group;
            //this.DefaultViewModel["Items"] = group.Items;DataModel.ComicQueryManager
            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery query = e.NavigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);
                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }