Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Silverlight
I'm having an issue trying to get my html code/javascript to display inside of a web browser control.
I don't have a phone to test on so I'm using the Emulator with VS2010 Ultimate.
 
I tried to use this site:
Site 1
 
I have added all of the folders and files and set the output to "Resource" in the solution explorer.
 
My code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
 
namespace BitComposer
{
    public partial class EditPage : PhoneApplicationPage
    {
 
        public EditPage()
        {
            InitializeComponent();
 
        }
 
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            Stream stream = Assembly.GetExecutingAssembly()
                 .GetManifestResourceStream("BitComposer.Editor.html");
            StreamReader reader = new StreamReader(stream);
            string html = reader.ReadToEnd();
            webBrowser1.NavigateToString(html);
        }
    }
}
 
I've also tried to navigate to the html page, still no luck.
Posted 12-Sep-12 10:44am
shelby672.5K
Comments
Sergey Alexandrovich Kryukov at 12-Sep-12 15:49pm
   
How do I know that "BitComposer.Editor.html" is correct or not?
Why would it be in the Manifest? Why not using a regular .resx resource? Then you don't even need to use StreamReader (always unsafe), as there are auto-generated code with properties.
Just a note: software development is not a matter of luck. It is only if you use some existing code and try-and-error approach, which does not generally work.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100