how can i take that page1.html paeg from mainpage.xaml to secondpage.xaml and show on webControl browser?

StackOverflow https://stackoverflow.com/questions/18613547

Frage

I want to show some .html files from an isolatedStorage, the files are located in (MainFolder -> subFolder1 -> SubFolder2 -> page1.html).

How can I take that page1.html page from mainpage.xaml to secondpage.xaml and show on webControl browser?

In brief:

My secondPage.xaml contains a web Browser control so on that I want to show that page1.html from mainpage.xaml, my page is located into above storage location.

War es hilfreich?

Lösung

So finally i have a proper answer for my question. my requirement was take values from isoalated Storage form Mainpage.xaml and show on SecondPage.xaml's web-browser control. And this all i wanted on selection a image from ListBox control which is set on the MainPage.xaml.

So code is following along with inline documentation i have mentioned to making out the scenario.

**//MainPage.xaml.**

private async void imgBookImage_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    //It is the way to take the id from the listView if you are showing your listView through Wrapper using ObservableCollection.
    myWrapper bookName = (myWrapper)this.listCloudBooks.SelectedItem;
    IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();

    string dir = "/MainFolder/SubFolder/" + bookName.Id;
    if (isf.DirectoryExists(dir))
    {
        NavigationService.Navigate(new Uri("/MainPage.xaml?selectedItem=" +bookName.Id, UriKind.Relative));//bookName.Id fetching Id of book and through bookid we will get the id on our destination page and will show the data.
    }
    else
    {   
    //In this method i am creating folder of bookId and storing into the destination folder in my          isolated storage. I am not showing the code of this method because i am answering of this question only.
    DownloadBooks(bookName);
}

}

   //SecondPage.xaml
   private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
   {
     string selectedBookId = "";//Set this variable globally.
         position = 1;
         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
         string dir = "/MainFolder/SubFolder/" + selectedBookId;
         string concatBookJson = string.Concat(dir, "/pageRecords.json");//Taking pageRecords.json, my this file have records of my *.html pages so it is showing from isolateStorage 
         if (isf.FileExists(concatBookJson))
         {
            CurrentBook = GetBookContents(concatBookJson);//Returning the Json Deserialize data from the isolated storage.
               txtBookName.Text = CurrentBook.Title;//I have title property you can access all properties of your wrapper class (myWrapper).

     }
   }

You should use OnNavigated Event for fetching the values from MainPage.xaml, my requirement was different so i have shown in my PhoneApplciation_Loaded event.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top