[SOLVED] confirmation dialogue box with ok/cancel button

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

[SOLVED] confirmation dialogue box with ok/cancel button

Postby Sesztak » Thu Jul 21, 2016 2:51 am

Dear JS-Suppor,

Is there any built in dialogue box to achive the User Confirmation: Ok or Cancel ?
(We checked the your actual MessageBox implementation, but unfortunately it is void / no return value and no other buttons, only 'Ok'.)

We need something like that (sample pseudo code in WPF ):

var userDecisionResult = MessageBox.Show("Are you sure to want to be continued ?", "Confirmation needed !", MessageBoxButton.OKCancel);
if (userDecisionResult == MessageBoxResult.OK)
{ //do something
}
else if (userDecisionResult == MessageBoxResult.Cancel)
{//do something else
return;
}


Thanks,
br,
Péter

Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Re: confirmation dialogue box with ok/cancel button

Postby Sesztak » Thu Jul 21, 2016 3:35 am

In the meantime with JavaScript interop solution:

bool userDecision = (bool) CSHTML5.Interop.ExecuteJavaScript("window.confirm($0)", "Are you sure?");

br,
Péter

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

Re: confirmation dialogue box with ok/cancel button

Postby JS-Support @Userware » Thu Jul 21, 2016 3:50 am

Thanks Péter.

We are going to add modal confirmation dialog support in the very next build, to be released in a few days.

Regards,
JS-Support

Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Re: confirmation dialogue box with ok/cancel button

Postby Sesztak » Thu Jul 21, 2016 3:57 am

Dear JS-Support,
great news -waiting to try that!

So, will it be any diffence compared to my above - mentioned

CSHTML5.Interop.ExecuteJavaScript("window.confirm($0)", "Are you sure ?");

solution ?

-the native javascript window.confirm () is modal already,
-or is there any new features will be expected ? -like icon or other ?

thanks,
Péter

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

Re: confirmation dialogue box with ok/cancel button

Postby JS-Support @Userware » Thu Jul 21, 2016 4:01 am

There will be no difference with your JavaScript interop solution. Only advantage is that it uses the stardard C# syntax with the "MessageBoxResult" enum and the "MessageBoxButton.OKCancel" option.

Thanks.

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

Re: confirmation dialogue box with ok/cancel button

Postby JS-Support @Userware » Sat Mar 04, 2017 7:52 pm

Hi,

For archive, I just wanted to inform that Beta 9 has added support for modal confirmation dialogs (via MessageBox and MessageBoxButton).

By the way, even though it is not modal, users may be interested to know that Beta 10 has added support for ChildWindows. To use them, right-click your project in the Solution Explorer, and click Add -> New Item -> C#/XAML for HTML5 -> Child Window. You will find the documentation at: http://cshtml5.com/links/how-to-use-the-child-window.aspx

You can download the latest version of the product from:
http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 39 guests

 

 

cron