Page 1 of 1

[SOLVED] confirmation dialogue box with ok/cancel button

Posted: Thu Jul 21, 2016 2:51 am
by Sesztak
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

Re: confirmation dialogue box with ok/cancel button

Posted: Thu Jul 21, 2016 3:35 am
by Sesztak
In the meantime with JavaScript interop solution:

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

br,
Péter

Re: confirmation dialogue box with ok/cancel button

Posted: Thu Jul 21, 2016 3:50 am
by JS-Support @Userware
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

Re: confirmation dialogue box with ok/cancel button

Posted: Thu Jul 21, 2016 3:57 am
by Sesztak
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

Re: confirmation dialogue box with ok/cancel button

Posted: Thu Jul 21, 2016 4:01 am
by JS-Support @Userware
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.

Re: confirmation dialogue box with ok/cancel button

Posted: Sat Mar 04, 2017 7:52 pm
by JS-Support @Userware
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