Page 1 of 1

How to use Mailto?

Posted: Wed Mar 27, 2019 11:04 am
by ScottM
I'm trying CSHTML5 out to see if I want to use it in client projects, and the following XAML fails:

Code: Select all

<Hyperlink NavigateUri="mailto:Tech@heavenword.com" Foreground="DarkRed">
      Email us here.
</Hyperlink>

and I get a url like:

Code: Select all

https://heavenword.com/CS2HtmlApp;component/mailto:webmaster@heavenword.com?subject=Development%20Services&

with this result:

Code: Select all

404: Page not found
This error is generated when there was no web page with the name you specified at the web site.
Troubleshooting suggestions:
Ensure the page you are linking to exists in the correct folder.
Check your file name for case sensitivity . Index.htm is not the same as index.htm!
Temporarily disable any rewrite rules by renaming your .htaccess file if it exists.

I found this:

viewtopic.php?f=7&t=1463

but it gives me: "The 'ExecuteJavaScript' method, for calling JS code from C#, requires the Professional Edition of C#/XAML for HTML5."

Is there another way to provide email links using a NavigateUri?

Re: How to use Mailto?

Posted: Thu Mar 28, 2019 4:21 pm
by ScottM
I'm sorry, did I ask my question in the wrong place?

I did search the forum for "mailto" first, and didn't find an answer, which is why I asked the question.

Re: How to use Mailto?

Posted: Mon Apr 01, 2019 8:08 am
by JS-Support @Userware
Hi,

Sorry for the delay of the reply. Yes, this is the correct place to post your question to get an answer by the community. By the way, owners of the Commercial Edition can also use our ticketing system by sending an email to support@cshtml5.com, which is usually answered much faster.

The issue that you reported is being investigated. In the meantime, please use the following workaround:

XAML code:

Code: Select all

<TextBlock>
    <Hyperlink Foreground="DarkRed" Click="Hyperlink_Click">
        Email us here.
    </Hyperlink>
</TextBlock>


C# code behind:

Code: Select all

private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
    string url = "mailto:Tech@heavenword.com";
    CSHTML5.Interop.ExecuteJavaScript("window.location.href = $0", url);
}


Please note that this won't work when running inside the Simulator, but it will work properly when running in the browser.

Documentation of the "ExecuteJavaScript" method can be found at:
http://www.cshtml5.com/links/how-to-call-javascript.aspx

By the way, since the code of CSHTML5 has just been open-source, here is the source of the "Hyperlink" class in case you or someone else is interested in investigating it as well:
https://github.com/cshtml5/CSHTML5/blob/8adc3368dcc1a81b90c7cb0443b9b29b2aabbd27/src/CSHTML5.Runtime/Windows.UI.Xaml.Documents/Hyperlink.cs

Instructions for building from source and testing it can be found at:
https://github.com/cshtml5/CSHTML5

Thanks.
Regards,
JS-Support

Re: How to use Mailto?

Posted: Mon Apr 01, 2019 8:24 am
by ScottM
OK, thanks for the reply. When I try that, I get:

Image

Which is the message I referred to at the end of my OP above.

It also refers to a Professional Edition, not the Commercial Edition I see here:

http://www.cshtml5.com/download.aspx

which has a different price ($390 for small companies--1 person in this case) than here ($290):

viewtopic.php?f=2&t=8488

I'm trying to evaluate if I want to use this to leverage my C#/XAML experience to build websites for clients. If I could experiment some more and show a client or two the CSHTML5 approach, that would be helpful. And my test case is a pretty simple website for my company--for which CSHTML5 is way overkill. But it's hard to showcase the solution when a simple mailto doesn't work.

Do I just need to sign up for the 60 free trial?

Re: How to use Mailto?

Posted: Mon Apr 01, 2019 8:29 am
by ScottM
Screen shot isn't working...

It says:

The 'ExecuteJavaScript' method, for callign JS code from C#, requires the Professional Edition of C#/XAML for HTML5.

Start the 60-day free trial of the Pro Edition

(etc.)

Re: How to use Mailto?

Posted: Mon Apr 01, 2019 9:01 am
by JS-Support @Userware
Yes, sorry, the "Pro Edition" message is simply due to the fact that we have just announced that we have replaced the Pro Edition with a dual-licensed model (open-source/community + commercial), and this change has not been reflected in the application yet. So please, yes, do start the 60-day trial period, or use the "version 2.0 Preview" (which does not display the message) while waiting for us to patch the software and remove the "Pro Edition" message.

PS: you can attach images on the forum by using the "attachments" tab at the bottom of the message editor.

Re: How to use Mailto?

Posted: Mon Apr 01, 2019 9:23 am
by ScottM
Thank you. Probably for my evaluation use as this as a long term tool, I should try and use the 2.0 preview.

Thanks again.

Re: How to use Mailto?

Posted: Fri Apr 05, 2019 7:45 am
by JS-Support @Userware
We have fixed the issue. Please expect the fix to be available in v2.0 Preview 0.2, expected shortly.

Thanks.