This is a migrated thread and some comments may be shown as answers.

Example of how to use closedHandler

8 Answers 136 Views
MessageBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sandy
Top achievements
Rank 1
Sandy asked on 05 Nov 2011, 10:22 PM
Hi,
Can you please provide an example of how to use the WP& RadMessageBox closedHandler (for buttons)? Something simple like OK and Cancel is fine. The online documentation and sample code do not provide an example.

Thanks,
Sandy

8 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 07 Nov 2011, 09:18 AM
Hi Sandy Lamoureux,

 Thank you for writing.
Here is an example of how to use the closedHandler argument of RadMessageBox.Show().

RadMessageBox.Show("Messagebox Title", MessageBoxButtons.OKCancel, "Messagebox Message", closedHandler: (args) =>
    {
        if (args.Result == DialogResult.OK)
        {
        }
        else
        {
        }
    });

Please keep in mind that RadMessageBox does not stop execution of the code. Once the method is called RadMessageBox is shown and the Show method immediately returns. The lambda expression will be executed at a later time when one of the message box buttons are pressed.

We will update the online documentation with this example.
Please write again if you have other questions.

Greetings,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sandy
Top achievements
Rank 1
answered on 07 Nov 2011, 02:38 PM
Thanks!
0
Paul
Top achievements
Rank 1
answered on 01 Dec 2011, 03:46 PM
Could you please supply an example of using RadMessageBox in visual basic please as im stumped.
0
Victor
Telerik team
answered on 01 Dec 2011, 04:23 PM
Hi Paul,

 Of course, here is the same snippet in VB:

RadMessageBox.Show("Messagebox Title", MessageBoxButtons.OKCancel, "Messagebox message", closedHandler:=Function(args)
                                                                                                            If args.Result = DialogResult.OK Then
 
                                                                                                            Else
 
                                                                                                            End If
                                                                                                        End Function)

Best wishes,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Paul
Top achievements
Rank 1
answered on 01 Dec 2011, 04:33 PM
Thank you Victor, and if I wanted buttons called OK and Email?
0
Victor
Telerik team
answered on 01 Dec 2011, 05:30 PM
Hello Paul,

 You can specify custom content for the buttons by using a different overload of the Show method:

RadMessageBox.Show(New String() {"OK", "Email"}, "Messagebox Title", "Messagebox message", closedHandler:=Function(args)
                                                                                                              If args.Result = DialogResult.OK Then
 
                                                                                                              Else
 
                                                                                                              End If
                                                                                                          End Function)

Please have a look at our online documentation, there you will see all available overloads of the Show method. They are in C# but you will still be able to determine which one you need to use and invoke it from VB.

Greetings,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Domi
Top achievements
Rank 1
answered on 06 Jan 2014, 04:32 PM
Hi Victor,

it's an old post but can you complete it to avoid a re-post ...

How can I stop the process until the user has clic on either a button or the other ? if I use the following code :

private void button2_Click(object sender, RoutedEventArgs e)

{

RadInputPrompt.Show("Messagebox Title", MessageBoxButtons.OKCancel, "Messagebox Message", closedHandler: (args) =>

{

if (args.Result == DialogResult.OK)

{

MessageBox.Show("OK");

}

else

{

MessageBox.Show("Cancel");

}

});

MessageBox.Show("Finished !");

}



the MessageBox is showed BEFORE the dialog with the InputPrompt appear !; I just want the input shows first, the user fills it, [ok] or [cancel] is displayed and THEN [finished], how can I achieved this ?

a full source code would be wonderfull.
thanks in advance,
Domi.

0
Deyan
Telerik team
answered on 09 Jan 2014, 03:11 PM

Hi Dominique,

Thanks for writing.



You should either rely on the ClosedHandler and put the Finished message box there or use the ShowAsync API and await it. The code execution after the awaited method will happen as soon as you close the input prompt.



Regards,

Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.

Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.

Sign up for Free application insights >>
Tags
MessageBox
Asked by
Sandy
Top achievements
Rank 1
Answers by
Victor
Telerik team
Sandy
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Domi
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or