Beta 10.5 of C#/XAML for HTML5 released

JS-Support
Site Admin
Posts: 811
Joined: Tue Apr 08, 2014 3:42 pm

Beta 10.5 of C#/XAML for HTML5 released

Postby JS-Support » Sun Dec 04, 2016 7:05 am

Dear CSHTML5 users,

We are pleased to inform you that the Beta 10.5 of CSHTML5 is available for download!


Download:
CSharpXamlForHtml5_v1_0_public_beta10_5.zip
(22.68 MiB) Downloaded 71 times


Here is what's new since Beta 10.4:

  • 12% Performance Improvement (runtime GUI)
    .
  • New "HtmlPresenter" control for displaying arbitrary HTML code.
    It is located in the namespace "CSHTML5.Native.Html.Controls".
    Here is an example of use:

    Code: Select all

    <Page
        x:Class="Application1.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:native="clr-namespace:CSHTML5.Native.Html.Controls;assembly=CSharpXamlForHtml5">
        <Border>
            <native:HtmlPresenter Html="&lt;canvas id=&quot;demo_canvas&quot; Style=&quot;width:100%;height:100%&quot; /&gt;"/>
        </Border>
    </Page>

    .
  • Support for the following additional Visual Studio languages: Czech, Polish, Portuguese (Brazil), and Turkish
    .
  • When the Simulator displays JavaScript errors, you now have the option to stop displaying the errors for the duration of the session.
    .
  • New item templates "UserControl", "Page", "ChildWindow", and "XAMLResourceDictionary" for projects of type "Silverlight Migration Edition"

    Note: You can read more about the Silverlight Migration Edition at: http://cshtml5.com/links/sl-migration-edition.aspx

You may also be interested to read:
- What's new in Beta 10.4
- What's new in Beta 10.3
- What's new in Beta 10.2
- What's new in Beta 10.1


Notes about installation:
  • Before installing this update, it is recommended that you close all the open instances of Visual Studio.
  • If for some reason you need to revert to the previous Beta, simply uninstall this one (from the Control Panel) and reinstall the previous Beta.


We hope you will enjoy this build!

If you find any issues, please post them on the forums or send an email to support@cshtml5.com

Thank you.
Regards,
JS-Support

tomny
Posts: 37
Joined: Sat Nov 19, 2016 7:23 pm

Re: New Beta 10.5 released! [Download]

Postby tomny » Sun Dec 04, 2016 8:12 pm

Hello Team,

Thanks for your effort, I have downloaded the new version for trial. CSHTML5.Native.Html.Controls html can not execute javascript? I included some JavaScript functions in html, but it did not work.

Best Regards,
Tomny

JS-Support
Site Admin
Posts: 811
Joined: Tue Apr 08, 2014 3:42 pm

Re: New Beta 10.5 released! [Download]

Postby JS-Support » Mon Dec 05, 2016 12:38 am

tomny wrote:CSHTML5.Native.Html.Controls html can not execute javascript? I included some JavaScript functions in html, but it did not work.

Hello Tomny,
Thanks for your message. Can you please post the code that you wrote?
Regards,
JS-Support

tomny
Posts: 37
Joined: Sat Nov 19, 2016 7:23 pm

Re: New Beta 10.5 released! [Download]

Postby tomny » Mon Dec 05, 2016 6:24 am

Hi JS-Support,
thank you for your reply.For example, Xaml code is as follows:

Code: Select all

<Page
    x:Class="cshtml105test1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:cshtml105test1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:myhtml="clr-namespace:CSHTML5.Native.Html.Controls;assembly=CSharpXamlForHtml5"
    >
    <Grid>
        <myhtml:HtmlPresenter x:Name="Htmlhost" Width="200" Height="200"
                              HorizontalAlignment="Left" VerticalAlignment="Top"
                              ></myhtml:HtmlPresenter>
    </Grid>
</Page>

C # code is as follows:

Code: Select all

 public MainPage()
        {
            this.InitializeComponent();         
            this.Loaded += MainPage_Loaded;   
        }

        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            System.Text.StringBuilder sb = new StringBuilder();
            sb.Append("<p>Test text 1</p>");
            sb.Append("<div>Test text 2</div>");
            sb.Append("<script type=\"text/javascript\">");
            sb.Append("alert(\"Show Text\");");
            sb.Append("</script>");

            Htmlhost.Html = sb.ToString();

        }


The results are as follows:
Image059.png
Image059.png (19.74 KiB) Viewed 1378 times


Similarly, I tested the other js function, will not work.

Regards,
Tomny

tomny
Posts: 37
Joined: Sat Nov 19, 2016 7:23 pm

Re: New Beta 10.5 released! [Download]

Postby tomny » Mon Dec 05, 2016 6:51 am

When we put html code into an iframe, it can work properly.
For example, I put the following code:

Code: Select all

<p>Test text 1</p>
<div>Test text 2</div>
<script type="text/javascript">
    alert("Show Text");
</script>

Write a page and then get a URL as follows:

http: //www.ip188.net/csh5test3.html

Then, CSHTML5.Native.Html.Controls html code is as follows:

Code: Select all

 string htmStr = "<iframe src=\"http://www.ip188.net/csh5test3.html\"></iframe>";
            Htmlhost.Html = htmStr;


It can work as shown below:
Image060.png
Image060.png (17.52 KiB) Viewed 1374 times

JS-Support
Site Admin
Posts: 811
Joined: Tue Apr 08, 2014 3:42 pm

Re: New Beta 10.5 released! [Download]

Postby JS-Support » Mon Dec 05, 2016 9:45 am

Thanks Tomny. Indeed, the HtmlPresenter control uses the "innerHTML" property of the html DOM to set the content, so <script/> tags won't work there.

You can add scripts:
- using the method "CSHTML5.Interop.LoadJavaScriptFile(...)", which will add a <script/> tag to your html page.
- or by calling "CSHTML5.Interop.ExecuteJavaScript(...)" and passing the code to execute.
Both methods are documented at:
http://cshtml5.com/links/how-to-call-javascript.aspx

Thanks.
Regards,
JS-Support

tomny
Posts: 37
Joined: Sat Nov 19, 2016 7:23 pm

Re: New Beta 10.5 released! [Download]

Postby tomny » Wed Dec 07, 2016 3:53 pm

Hi JS-Support,

thank you for your reply. I already understand that we can use HtmlPresenter it only includes html, and js can be written to a separate file, which can then "CSHTML5.Interop.LoadJavaScriptFile (...)" and "CSHTML5.Interop.ExecuteJavaScript (...)" With the use of.

Regards,
Tomny


Return to “Pre-Releases, Downloads and Announcements”

Who is online

Users browsing this forum: No registered users and 2 guests