コード例 #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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"]
 }
コード例 #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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Assign a bindable group to Me.DefaultViewModel("Group")
            // TODO: Assign a collection of bindable items to Me.DefaultViewModel("Items")

            if (e.PageState == 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)
                {
                    // TODO: Invoke Me.itemsViewSource.View.MoveCurrentTo() with the selected
                    //       item as specified by the value of pageState("SelectedItem")

                }
            }
        }
コード例 #3
0
        //#region Search
        //private void txtSearch_ActionIconTapped(object sender, EventArgs e)
        //{
        //    lstSearchResults.ItemsSource = new List<Place>(); 
        //    lstSearchResults.Focus();
        //    if (txtSearch.Text.Length > 0)
        //    {
        //        //Don't touch. SERIOUSLY don't touch.
        //        //It's the only GeoCoordinateWatcher that won't work on the whole App.
        //        try
        //        {
        //            watcher.Start();
        //        }
        //        catch (Exception ex)
        //        { /*Beg so this don't crash again (don't even know why)*/}
        //    }
            
        //    else MessageBox.Show(AppResources.TxtSearchFailed);
        //}

        //private async void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        //{
        //    double latitude = e.Position.Location.Latitude;
        //    double longitude = e.Position.Location.Longitude;
        //    prgSearchProgress.Visibility = System.Windows.Visibility.Visible;
        //    try
        //    {
        //        List<Place> lstReturned = await PlacesMethods.getPlacesByQuery(txtSearch.Text, latitude, longitude);
        //        if (lstReturned != null)
        //                lstSearchResults.ItemsSource = lstReturned;
        //        else MessageBox.Show(AppResources.TxtInternetConnectionProblem);
        //    }
        //    catch (Exception)
        //    { /*Don't worry, be happy.*/}
        //    finally
        //    {
        //        prgSearchProgress.Visibility = System.Windows.Visibility.Collapsed;
        //        watcher.Stop();
        //    }
        //}
        //#endregion

        /// <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)
        {
        }