Solved: Help in C# VS WebBrowser to open Index.HTML

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

angelr82

Angel
Thread Starter
Joined
Jun 15, 2010
Messages
88
Hey guys,

Sorry but I have very little experience in developing but here it goes.

I have an existing program and I have been tasked with adding a help section via HTML. I have the HTML help working but I wanted to try and integrate it in the app instead of opening IE. I'm stuck and clueless :confused:

Here is what I have so far (pretty much nothing) but I want to point the WPF control WebBrowser to a specific location and index.html file "\\mysrv\help\index.html"

Code:
<Page x:Class="AppName.PageHelp"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      ShowsNavigationUI="False"
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
      Title="Help">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ScrollViewer Grid.Row="0" Margin="0">
            <WebBrowser Height="768" Width="1024"/>
        </ScrollViewer>
    </Grid>
</Page>
Like I said I'm clueless and I'm not married to what I have above so if there is a better control to use or way to do it I'm down for it.

Also separately it would be cool if the user can have this browser up and still have the ability to use the main app without having to close the help window first
 
Joined
Apr 29, 2006
Messages
4,393
We normally post whatever the solution was, to help others out, if you wouldn't mind.
 

angelr82

Angel
Thread Starter
Joined
Jun 15, 2010
Messages
88
Yeah sorry I guess that would be the correct thing to do on here; just figured that since no one viewed or replied, my question was silly or didn't make sense. I couldn't figure out how to delete my thread.

But here it is.


This is the XAML code for the page with the WebBrowser function in it.

Code:
<Page x:Class="PageHelp"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      ShowsNavigationUI="False"
      mc:Ignorable="d"
      d:DesignHeight="768" d:DesignWidth="1024"
      Title="Help"
      Loaded="Window_Loaded">
    <WebBrowser Name="HelpPage"></WebBrowser>
</Page>
Then after that was setup I had to code the PageHelp.xaml.cs; this is how I coded it and it works great.

Code:
namespace appname
{
    /// <summary>
    /// Interaction logic for PageHelp.xaml
    /// </summary>
    public partial class PageHelp : Page
    {
        public PageHelp()
        {
            InitializeComponent();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Loads compiled HTML help page.
            this.HelpPage.Navigate("file://///FileSrv/Path/to/HTML/index.html");
        }
    }
}
This was allowed me to point the WebBrowser control to an existing HTML help style web page where you can search and browse through help topics.

Attached is a screen shot of the finished product.

The content was created from a Microsoft Word Document then we used or rather testing and may possibly use http://www.helpandmanual.com/products_hm_overview.html to compile the HTML version of our help document.

I chose this route rather than CHM style help because I think it looks a lot better.

Next I am going to try to figure out how to make context based help where it will launch this browser and go to a specific topic via some type of image type button next to specific areas with in the App that the user may need help with instead of opening help separately and searching for their specific feature they are trying to use.

I'm sure this is child's play for most of you guys but not touching any coding or development for almost 17 years (VB6) I was over my head and completely clueless....

Hope this info helps someone like me in the future!
 

Attachments

angelr82

Angel
Thread Starter
Joined
Jun 15, 2010
Messages
88
Ok so I have another issue that I could use someones help with. Again I know this most likely will be a silly question.

The way this help page opens is via a menu item labeled "help". When the use clicks on that help page comes up with the WebBrowser control pointing to my HTML help. The problem is I have to close that page before I can use the main app again. I can see for most people they want to see their help and read through it as they use the main app. The way it is setup currently I cannot do that. How do can I make this help page appear when requested but still allow the user to use the main app?
 

angelr82

Angel
Thread Starter
Joined
Jun 15, 2010
Messages
88
Ok figured this out too. Just so this may help someone in the future.

The code that was opening the Help page (WebBrowser control) had .ShowDialog();

I just changed it to just .Show();

That let me open the new window independent of the MainWindow so the user can switch focus from the Main to Help pages.
 
Joined
Apr 29, 2006
Messages
4,393
Ok figured this out too. Just so this may help someone in the future.

The code that was opening the Help page (WebBrowser control) had .ShowDialog();

I just changed it to just .Show();

That let me open the new window independent of the MainWindow so the user can switch focus from the Main to Help pages.
Sorry, I was in the middle of a reply to help with the second one yesterday and got pulled away. Glad you got it going.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top