コード例 #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="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)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            //var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-4");

            //Task<Session> LoginTask = null;
            Task LoadingIndexTask = null;
            Task LoadingRecommandTask = null;
            //Task LoadingFavouriteTask = null;
            //Task LoadingRecentTask = null;
            Task LoginTask = null;

            if (this.RequestedTheme != AppGlobal.Settings.BackgroundTheme)
            {
                this.RequestedTheme = AppGlobal.Settings.BackgroundTheme;
            }

            ViewModel.IsLoading = true;

            await LoadConverAndRecent();

            if (!ViewModel.RecommandSection.IsLoaded && !ViewModel.RecommandSection.IsLoading)
            {
                LoadingRecommandTask = ViewModel.RecommandSection.LoadAsync();
            }

            //if (ViewModel.SeriesIndex == null)
            //{
            //    LoadingIndexTask = ViewModel.LoadSeriesIndexDataAsync().ContinueWith(async task =>
            //    {
            //        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            //        {
            //            if (SeriesIndexViewSource.View == null)
            //            {
            //                SeriesIndexViewSource.IsSourceGrouped = true;
            //                SeriesIndexViewSource.Source = ViewModel.SeriesIndex;
            //            }
            //            if (SeriesIndexViewSource.View != null)
            //                ViewModel.SeriesIndexGroupView = SeriesIndexViewSource.View.CollectionGroups;
            //        });
            //    });
            //}

            if (!AppGlobal.IsSignedIn)
            {
                LoginTask = ViewModel.TryLogInWithStoredCredentialAsync().ContinueWith(async task =>
                {
                    await ViewModel.FavoriteSection.LoadAsync(false, 9);
                });
            }
            else
            {
                ViewModel.IsSignedIn = true;
                ViewModel.UserName = AppGlobal.User.UserName;
                LoginTask = ViewModel.FavoriteSection.LoadAsync(false, 9);
            }

#if WINDOWS_APP
            if (HubScrollViewer != null)
                HubScrollViewer.ViewChanged += HubScrollViewer_ViewChanged;
#else //WINDOWS_PHONE_APP
			var statusBar = StatusBar.GetForCurrentView();
			statusBar.ProgressIndicator.Text = "Synchronizing...";
			statusBar.ProgressIndicator.ProgressValue = null;
			statusBar.ForegroundColor = ((SolidColorBrush)App.Current.Resources["AppBackgroundBrush"]).Color;
			await statusBar.HideAsync();
			await statusBar.ProgressIndicator.ShowAsync();
#endif

            if (LoadingRecommandTask != null)
                await LoadingRecommandTask;
            if (LoginTask != null)
                await LoginTask;
            if (LoadingIndexTask != null)
                await LoadingIndexTask;

            UpdateTile();

            ViewModel.IsLoading = false;

#if WINDOWS_APP

            foreach (var group in ViewModel.RecommandSection)
            {
                foreach (var item in group)
                {
                    try
                    {
                        await item.LoadDescriptionAsync();
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine("Exception in loading volume description : ({0},{1}), exception : {3}", item.Title, item.Id, exception.Message);
                    }

                }
            }

            if (AppGlobal.Settings.EnableLiveTile)
                UpdateTile();
#else
			await statusBar.ProgressIndicator.HideAsync();
#endif
        }
コード例 #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 lv = LastReadSection.GetFirstDescendantOfType<ListViewItem>();
			//var position = lv.GetPosition(new Point(0,0) , LastReadSection);
			if (this.RequestedTheme != AppGlobal.Settings.BackgroundTheme)
			{
				this.RequestedTheme = AppGlobal.Settings.BackgroundTheme;
			} 
			ViewModel.IsLoading = true;
			var statusBar = StatusBar.GetForCurrentView();
			await statusBar.HideAsync();

			if (e.PageState != null && e.PageState.Count > 0 && (bool)e.PageState["IsSigninPopupOpen"])
				SigninPopup.IsOpen = true;

			SyncViewWithOrientation();

			//statusBar.ProgressIndicator.Text = "Synchronizing...";
			//statusBar.ProgressIndicator.ProgressValue = null;
			//statusBar.ForegroundColor = ((SolidColorBrush)App.Current.Resources["AppBackgroundBrush"]).Color;
			//await statusBar.ProgressIndicator.ShowAsync();
			if (AppGlobal.RecentList == null)
				await AppGlobal.LoadHistoryDataAsync();
			if (AppGlobal.RecentList.Count > 0)
			{
				ViewModel.LastReadSection = new HistoryItemViewModel(AppGlobal.RecentList[AppGlobal.RecentList.Count - 1]);
				await ViewModel.RecentSection.LoadLocalAsync(true);
			}
			else
			{
				ViewModel.LastReadSection = new HistoryItemViewModel
				{
					Position = new NovelPositionIdentifier
					{
						SeriesId = "337",
						VolumeNo = 0,
						VolumeId = "1138",
						ChapterNo = 0,
						ChapterId = "8683"
					},
					SeriesTitle = "机巧少女不会受伤",
					VolumeTitle = "第一卷 ",
					Description = "机巧魔术──那是由内藏魔术回路的自动人偶与人偶使所使用的魔术。在英国最高学府的华尔普吉斯皇家机巧学院里,正举行着一场选出顶尖人偶使「魔王」的战斗「夜会」。来自日本的留学生雷真和他的搭档──少女型态的人偶夜夜,为了参加「夜会」,打算挑战其他入选者,夺取对方的资格。他们锁定的目标是下届魔王呼声极高的候选人,别名「暴龙」的美少女夏琳!然而就在雷真向她挑战时,突然出现意外的伏兵……? 交响曲式学园战斗动作剧,第一集登场!",
					CoverImageUri = LightKindomHtmlClient.SeverBaseUri + "/illustration/image/20120813/20120813085826_34455.jpg"
				};
			}

			if (!AppGlobal.IsSignedIn)
			{
				await ViewModel.TryLogInWithStoredCredentialAsync();
			}
			else
			{
				ViewModel.IsSignedIn = true;
				ViewModel.UserName = AppGlobal.User.UserName;
			}

			await ViewModel.RecommandSection.LoadAsync(false,20);
			if (AppGlobal.Settings.EnableLiveTile)
				UpdateTile();

			await ViewModel.FavoriteSection.LoadAsync();

			//IsLoadingIndex = true;
			//await ViewModel.LoadSeriesIndexDataAsync();
			//if (SeriesIndexViewSource.View == null)
			//{
			//	SeriesIndexViewSource.IsSourceGrouped = true;
			//	SeriesIndexViewSource.Source = ViewModel.SeriesIndex;
			//}
			//if (SeriesIndexViewSource.View != null)
			//	ViewModel.SeriesIndexGroupView = SeriesIndexViewSource.View.CollectionGroups;
			//IsLoadingIndex = false;

			ViewModel.IsLoading = false;

			//await statusBar.HideAsync();
			//await statusBar.ProgressIndicator.HideAsync();

		}
コード例 #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>
 private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     //webView.Navigate(new Uri("http://www.linovel.com/main/login.html?from=www.linovel.com/"));
     //WebViewNavigate(new Uri("http://useragentapi.com/"));
     //webView.Visibility = Visibility.Visible;
     progressRing.IsActive = true;
     progressRing.Visibility = Visibility.Visible;
     RetryHintTextBlock.Visibility = Visibility.Collapsed;
     WebViewNavigate(new Uri("http://www.linovel.com/userauth/index.html"));
 }
コード例 #4
0
        /// <summary>
        /// Gets the NavigationHelper used to aid in navigation and process lifetime management.
        /// </summary>


        /// <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)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            Debug.WriteLine("LoadState");
            VisualStateManager.GoToState(this, IndexClosedState, false);

#if WINDOWS_PHONE_APP
			//IndexPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
			//this.BottomAppBar = PageBottomCommandBar;
			//this.BottomAppBar.Visibility = Visibility.Visible;
			TranslationType = 0;
			LayoutRootFadeinStory.Begin();
			await UpdateSizeOrientationDependentResourcesAsync();
#elif WINDOWS_APP || WINDOWS_UWP
            if (this.Frame.CanGoBack)
				OpenInNewViewButton.Visibility = Windows.UI.Xaml.Visibility.Visible;
			else
				OpenInNewViewButton.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            Window.Current.SetTitleBar(TitlePanelBackground);

#endif
            if (this.RequestedTheme != AppGlobal.Settings.BackgroundTheme)
            {
                this.RequestedTheme = AppGlobal.Settings.BackgroundTheme;
            }
            //Relayout_ContentColumn(ContentRegion.RenderSize);
            if (e.PageState != null && e.PageState.Count > 0)
            {
                IsIndexPanelOpen = false;
                if (e.PageState.ContainsKey("LoadingBreak"))
                {
                    navigationId = NovelPositionIdentifier.Parse((string)e.PageState["LoadingBreak"]);
                    await viewModel.LoadDataAsync(navigationId);
                }
                else
                {
                    var fullScreen = (bool)e.PageState["IsFullScreen"];
                    if (fullScreen)
                    {
                        VisualStateManager.GoToState(this, "HideTitleBarState", false);
                        ViewModel.IsFullScreen = true;
                    }
                    else
                    {
                        VisualStateManager.GoToState(this, "ShowTitleBarState", false);
                        ViewModel.IsFullScreen = false;
                    }

                    var volumeNo = (int)e.PageState["VolumeNo"];
                    var chapterNo = (int)e.PageState["ChapterNo"];
                    var seriesId = (int)e.PageState["SeriesId"];
                    var lineNo = (int)e.PageState["LineNo"];
                    await viewModel.LoadDataAsync(seriesId, volumeNo, chapterNo, lineNo);
                }
#if WINDOWS_APP
				var horizontalOffset = (double)e.PageState["HorizontalOffset"];
				var verticalOffset = (double)e.PageState["VerticalOffset"];
				ContentScrollViewer.ChangeView(horizontalOffset, verticalOffset, null, true);
#endif
                //SyncIndexSelectedItem();
            }
            else
            {
                VisualStateManager.GoToState(this, "ShowTitleBarState", false);
                ViewModel.IsFullScreen = false;

                navigationId = NovelPositionIdentifier.Parse((string)e.NavigationParameter);

                if (navigationId.SeriesId != null && (navigationId.VolumeNo == -1 || navigationId.ChapterNo == -1))
                {
                    IsIndexPanelOpen = true;
                }
                else
                {
                    IsIndexPanelOpen = false;
                }

                await viewModel.LoadDataAsync(navigationId);
            }
            ViewModel.NotifyPropertyChanged("IsPinned");
            SyncPinButtonView();
            ViewModel.NotifyPropertyChanged("IsFavored");
        }
コード例 #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="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>
		private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
		{
			await ViewModel.LoadSeriesIndexDataAsync();
			//if (SeriesIndexViewSource.View == null)
			//{
			//	SeriesIndexViewSource.IsSourceGrouped = true;
			//	SeriesIndexViewSource.Source = ViewModel.SeriesIndex;
			//}
			if (SeriesIndexViewSource.View != null)
				ViewModel.SeriesIndexGroupView = SeriesIndexViewSource.View.CollectionGroups;
			ViewModel.IsLoaded = true;
		}
コード例 #6
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>
		private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
		{
		}