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

Converting Asynchronous RadWindow's Confirm & Prompt to Synchronous call

3 Answers 235 Views
Window
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 28 Jul 2011, 08:29 AM
Hi,
(Silverlight v4, RadControls Q1 2011)
I want to use Confirm & Prompt windows to behave similar to default Message box. That is, whenever the message box is displayed by calling the Show function, the code following the call is not executed until the user responds.

I've a function which returns value based on the confirmation/Prompt. When using RadWindow's Confirm, the function returns before user responds. I'm implementing an IView interface which has functions like Prompt, Confirm & Alert. The interface is implemented to interact with users in Command line mode, Windows Mode (Normal Messagebox) & Telerik Mode.

The behavior of the other two implementation (CommandLine & Windows) is same. I want telerik implementation to match with the other two. Is there a way where I can stall execution of function until user responds?

Below is code snippet of CommandLine & Windows implementation. I want to match the Telerik's implementation to match this.
//CommandLine Implementation
public CustomConfirmResult Confirm(string message) {
    Console.WriteLine(message);
    Console.WriteLine("[Y]es    [N]o");
    string s = Console.ReadLine();
     
    if(s == y || s == Y)
        return CustomConfirmResult.Yes;
    else
        return CustomConfirmResult.No;
}
 
//Windows Implementation
public CustomConfirmResult Confirm(string message) {
    MessageBoxResult mbr = MessageBox.Show("", "", MessageBoxButton.OKCancel);
 
    if(mbr == MessageBoxResult.OK)
        return CustomConfirmResult.Yes;
    else
        return CustomConfirmResult.No;
}

Thanks

3 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 02 Aug 2011, 11:52 AM
Hello Scott,

 I'm afraid that the way you want to use the RadWindow dialog windows is not supported. The RadWindow control cannot block the executing thread until the user closes the window. What I would suggest you is to use an interface with an asynchronous style (with callbacks) which is more complex at first glance, but will work for all the scenarios you mentioned.

Best wishes,
Miroslav Nedyalkov
the Telerik team

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

0
Murray
Top achievements
Rank 2
answered on 24 Jan 2012, 09:07 PM
Miroslav, we are running into the same problem as Scott. We have tried more complex styles without success.

Could you give us some sample code on what you are suggesting?
0
Konstantina
Telerik team
answered on 26 Jan 2012, 02:50 PM
Hello Scott,

Please find attached a sample project in which is illustrated how to implement the desired function using interfaces. 

Hope this will help.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Window
Asked by
Scott
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Murray
Top achievements
Rank 2
Konstantina
Telerik team
Share this question
or