/// <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)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = SampleDataSource.GetItem((String)navigationParameter);

            this.DefaultViewModel["Group"] = item.Group;
            this.DefaultViewModel["Items"] = item.Group.Items;
            this.flipView.SelectedItem     = item;
        }
        /// <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 async override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            //if (pageState == null)
            //this.Frame.Navigate(typeof(ItemDetailPage),  SampleDataSource.GetGroup("XKCD").Items.First().UniqueId);



            var             item  = SampleDataSource.GetItem((String)navigationParameter);
            SampleDataGroup group = null;

            if (item != null)
            {
                group = item.Group;
            }



            if (group != null && group.Items != null)
            {
                this.DefaultViewModel["Group"] = group;
                if (group.UniqueId != "Favorites")
                {
                    this.DefaultViewModel["Items"] = group.Items;
                }
                else
                {
                    this.DefaultViewModel["Items"] = group.Items.OrderByDescending(s => s.UniqueId);
                }


                if (group.UniqueId == "Favorites")
                {
                    this.errorBox.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                    this.gotobutton.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    this.Numberbox.Visibility  = Windows.UI.Xaml.Visibility.Collapsed;
                }
                else
                {
                    this.errorBox.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                    this.gotobutton.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    this.Numberbox.Visibility  = Windows.UI.Xaml.Visibility.Visible;
                }
            }
            else
            {
                this.Frame.GoBack();
            }
        }
예제 #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="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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            object navigationParameter;

            if (e.PageState != null && e.PageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = e.PageState["SelectedItem"];
            }


            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = SampleDataSource.GetItem((String)e.NavigationParameter);

            this.DefaultViewModel["Group"] = item.Group;
            this.DefaultViewModel["Items"] = item.Group.Items;
            this.flipView.SelectedItem     = item;
        }
예제 #4
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)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            // Select the correct item
            var item = SampleDataSource.GetItem((String)navigationParameter);

            this.DefaultViewModel["Group"] = item.Group;
            this.DefaultViewModel["Items"] = item.Group.Items;
            this.flipView.SelectedItem     = item;

            // TODO: Initialize the transfer manager for sharing
        }
예제 #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>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            item = SampleDataSource.GetItem((String)navigationParameter);
            DefaultViewModel["Group"] = item.Group;
            DefaultViewModel["Items"] = item.Group.Items;
            flipView.SelectedItem     = item;
            AutoMeasurement.Client.TrackScreenView(item.Title);

            DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;
        }
예제 #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>
        protected async override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            var currentItem = SampleDataSource.GetItem((String)navigationParameter);

            this.DefaultViewModel["Group"] = currentItem.Group;
            this.DefaultViewModel["Items"] = currentItem.Group.Items;

            this.pageTitle.Text        = "Hindu Calendar - " + currentItem.Title + " " + currentItem.Year.ToString();
            this.cityTitle.Text        = currentItem.Group.city._Name;
            this.flipView.SelectedItem = currentItem;

            StorageFile privateEventFile = await ApplicationData.Current.RoamingFolder.CreateFileAsync("PrivateEvents.txt", CreationCollisionOption.OpenIfExists);

            Windows.Storage.FileProperties.BasicProperties prop = await privateEventFile.GetBasicPropertiesAsync();

            if (prop.Size != 0)
            {
                Stream stream = await privateEventFile.OpenStreamForReadAsync();

                DataContractSerializer ser = new DataContractSerializer(typeof(PrivateEvents));
                _privateEvents = (PrivateEvents)ser.ReadObject(stream);
                // If we have a zero size file or no events, we can get this too
                stream.Dispose();
            }

            if (_privateEvents == null)
            {
                _privateEvents = new PrivateEvents();
            }
            await SampleDataSource.GetClosestCity();

            CancelTimerTrigger();
            UpdateTitle();
            ScheduleTiles(currentItem);
        }
예제 #7
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)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }
            var item = SampleDataSource.GetItem((String)navigationParameter);

            this.flipView.SelectedItem = item;
            var type = item.PageType;

            if (!IsWindowsPhoneDevice())
            {
                if (type == typeof(Editing))
                {
                    row1.Height = new Windows.UI.Xaml.GridLength(120);
                }
                else
                {
                    row1.Height = Windows.UI.Xaml.GridLength.Auto;
                }
            }
        }
예제 #8
0
        public static async Task UpdateTile()
        {
            var article = SampleDataSource.GetItem("Group-1-Item-1");

            var tileContent = TileContentFactory.CreateTileWideImageAndText01();

            tileContent.TextCaptionWrap.Text = article.Title;
            tileContent.Image.Src            = article.ImagePath;
            tileContent.Image.Alt            = article.Subtitle;

            var squareContent = TileContentFactory.CreateTileSquareImage();

            squareContent.Image.Src = article.ImagePath;
            squareContent.Image.Alt = article.Title;

            tileContent.SquareContent = squareContent;

            TileNotification notification = tileContent
                                            .CreateNotification();

            TileUpdateManager
            .CreateTileUpdaterForApplication()
            .Update(notification);
        }
        /// <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;

            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);
                }
            }

            BitmapImage bkgImage = new BitmapImage();

            switch (group.UniqueId)
            {
            case "Deity1":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Ganesha2.png");
                break;
            }

            case "Deity2":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Shiva2.png");
                break;
            }

            case "Deity3":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Lakshmi2.png");
                break;
            }

            case "Deity4":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Tripurasundari2.png");
                break;
            }

            case "Deity5":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Durga2.png");
                break;
            }

            case "Deity6":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Gayathri2.png");
                break;
            }

            case "Deity7":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Hanuman2.png");
                break;
            }

            case "Deity8":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Subramanya2.png");
                break;
            }

            case "Deity9":
            {
                bkgImage.UriSource = new Uri("ms-appx:///assets/Hayagreeva2.png");
                break;
            }

            default:
            {
                break;
            }
            }

            ImageBrush bkgBrush = new ImageBrush();

            bkgBrush.ImageSource = bkgImage;
            grdMain.Background   = bkgBrush;
        }
예제 #10
0
        private void LoadState(object navigationParameter)
        {
            SampleDataItem item = SampleDataSource.GetItem((string)navigationParameter);

            SelectedItem = item;
        }
예제 #11
0
 public static async Task UpdateTile()
 {
     var article = SampleDataSource.GetItem("Group-1-Item-1");
 }
예제 #12
0
        void ISupportSaveLoadState.LoadState(object navigationParameter, PageStateStorage pageState)
        {
            var item = SampleDataSource.GetItem(pageState.GetParameter("SelectedItem", (string)navigationParameter));

            SelectedItem = item;
        }