2013-09-04 4 views
0

격리 된 저장소의 일부 .html 파일을 표시하려면 파일은 (MainFolder -> subFolder1 -> SubFolder2 -> page1.html)에 있습니다.mainpage.xaml에서 page1.html 페이지를 secondpage.xaml로 가져 와서 webControl 브라우저에 표시하려면 어떻게해야합니까?

page1.html 페이지를 mainpage.xaml에서 secondpage.xaml로 가져 와서 webControl 브라우저에 표시하려면 어떻게해야합니까? 간단히

:

내 secondPage.xaml 내가에서 MainPage.xaml에서 page1.html 쇼에 원하는에 있도록 웹 브라우저 컨트롤이 포함 된이 내 페이지는 위의 저장 위치에 자리 잡고 있습니다.

답변

0

마지막으로 나는 내 질문에 대해 적절한 대답을 가지고 있습니다. 내 요구 사항 isoalated 스토리지 양식 Mainpage.xaml에서 값을 가져 와서 SecondPage.xaml의 웹 브라우저 컨트롤에 표시했다. 그리고이 모든 것은 MainPage.xaml에 설정된 ListBox 컨트롤의 이미지를 선택했을 때 유용했습니다.

그래서 코드는 인라인 문서와 함께 시나리오를 작성하는 데 언급했습니다.

**//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). 

    } 
    } 

당신은 내 요구 사항은 그래서 난 내 PhoneApplciation_Loaded 이벤트에 보여 달랐다에서 MainPage.xaml에서 값을 가져 오는에 대한 OnNavigated 이벤트를 사용해야합니다.