public void UpdateQueryResults(ComicQuery query)
        {
            Title = query.Title;

            switch (query.Title)
            {
            case "LINQ makes queries easy": LinqMakesQueriesEasy(); break;

            case "Expensive comics": ExpensiveComics(); break;

            case "LINQ is versatile 1": LinqIsVersatile1(); break;

            case "LINQ is versatile 2": LinqIsVersatile2(); break;

            case "LINQ is versatile 3": LinqIsVersatile3(); break;

            case "Group comics by price range":
                CombineJimmysValuesIntoGroups();
                break;

            case "Join purchases with prices":
                JoinPurchasesWithPrices();
                break;

            case "All comics in the collection": AllComics(); break;
            }
        }
예제 #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        async protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    await SuspensionManager.RestoreAsync();
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }

                if (!String.IsNullOrEmpty(SuspensionManager.CurrentQuery))
                {
                    var currentQuerySequence =
                        from query in new ComicQueryManager().AvailableQueries
                        where query.Title == SuspensionManager.CurrentQuery
                        select query;

                    if (currentQuerySequence.Count() == 1)
                    {
                        ComicQuery query = currentQuerySequence.First();
                        if (query != null)
                        {
                            if (query.Title == "All comics in the collection")
                            {
                                rootFrame.Navigate(typeof(QueryDetailZoom), query);
                            }
                            else
                            {
                                rootFrame.Navigate(typeof(QueryDetail), query);
                            }
                        }
                    }
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
예제 #3
0
        /// 이 섹션에서 제공되는 메서드는 NavigationHelper에서
        /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다.
        ///
        /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다.
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다.
        /// 탐색 매개 변수는 LoadState 메서드
        /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ComicQuery comicQuery = e.Parameter as ComicQuery;

            if (comicQuery != null)
            {
                comicQueryManager.UpdateQueryResults(comicQuery);
                pageTitle.Text = comicQueryManager.Title;
            }
            navigationHelper.OnNavigatedTo(e);
        }
예제 #4
0
        private void ListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ComicQuery query = e.ClickedItem as ComicQuery;

            if (query != null)
            {
                if (query.Title == "All comics in the collection")
                {
                    this.Frame.Navigate(typeof(QueryDetailZoom), query);
                }
                else
                {
                    this.Frame.Navigate(typeof(QueryDetail), query);
                }
            }
        }
예제 #5
0
        public void UpdateQueryResults(ComicQuery query)
        {
            Title = query.Title;

            switch (query.Title)
            {
                case "LINQ makes queries easy": LinqMakesQueriesEasy(); break;
                case "Expensive comics": ExpensiveComics(); break;
                case "LINQ is versatile 1": LinqIsVersatile1(); break;
                case "LINQ is versatile 2": LinqIsVersatile2(); break;
                case "LINQ is versatile 3": LinqIsVersatile3(); break;
                case "Group comics by price range":
                    CombineJimmysValuesIntoGroups();
                    break;
                case "Join purchases with prices":
                    JoinPurchasesWithPrices();
                    break;
                case "All comics in the collection": AllComics(); break;
            }
        }
예제 #6
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        async protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    await SuspensionManager.RestoreAsync();
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
                if (!String.IsNullOrEmpty(SuspensionManager.CurrentQuery))
                {
                    var currentQuerySequence =
                        from query in new ComicQueryManager().AvailableQueries
                        where query.Title == SuspensionManager.CurrentQuery
                        select query;

                    if (currentQuerySequence.Count() == 1)
                    {
                        ComicQuery query = currentQuerySequence.First();
                        if (query != null)
                        {
                            if (query.Title == "All comics in the collection")
                            {
                                rootFrame.Navigate(typeof(QueryDetailZoom), query);
                            }
                            else
                            {
                                rootFrame.Navigate(typeof(QueryDetail), query);
                            }
                        }
                    }
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }