Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from purplecabbage/ExposeWebbrowser
Browse files Browse the repository at this point in the history
Expose webbrowser
  • Loading branch information
Jesse MacFadyen committed Nov 15, 2011
2 parents f9848f6 + 741a532 commit 3496fb5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Getting Started (Hey, not too rough)
-- If you do not see it, you may have to select the top level 'Visual C#' to see it
- Build and Run it!

-- Also, if you prefer, you may add the project instead to the "Silverlight for Windows Phone" subfolder of "Visual C#". This is up to you, and only affects where the GapAppStarter template is shown when creating a new project.

Note!!!
---

Expand Down
50 changes: 38 additions & 12 deletions framework/PGView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,44 @@ public System.Windows.Controls.Grid _LayoutRoot
}
}

public PGView()
public WebBrowser Browser
{
get
{
return GapBrowser;
}
}

/*
* Setting StartPageUri only has an effect if called before the view is loaded.
**/
protected Uri _startPageUri = null;
public Uri StartPageUri
{
get
{
if (_startPageUri == null)
{
// default
return new Uri("www/index.html", UriKind.Relative);
}
else
{
return _startPageUri;
}
}
set
{
if (!this.IsBrowserInitialized)
{
_startPageUri = value;
}
}
}

public PGView()
{

InitializeComponent();

if (DesignerProperties.IsInDesignTool)
Expand Down Expand Up @@ -201,8 +236,6 @@ void GapBrowser_Loaded(object sender, RoutedEventArgs e)
};
StreamResourceInfo fileResourceStreamInfo;



using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
{

Expand All @@ -228,7 +261,6 @@ void GapBrowser_Loaded(object sender, RoutedEventArgs e)
writer.Write(data);
}
}

}
}
else
Expand All @@ -239,14 +271,8 @@ void GapBrowser_Loaded(object sender, RoutedEventArgs e)
}
}

// todo: this should be a start page param passed in via a getter/setter
// aka StartPage

Uri indexUri = new Uri("www/index.html", UriKind.Relative);
this.GapBrowser.Navigate(indexUri);

this.IsBrowserInitialized = true;

GapBrowser.Navigate(StartPageUri);
IsBrowserInitialized = true;
AttachHardwareButtonHandlers();

}
Expand Down

0 comments on commit 3496fb5

Please sign in to comment.