Converting Asynchronous RadWindow's Confirm & Prompt to Synchronous call

4 posts, 0 answers
  1. Scott
    Scott avatar
    2 posts
    Member since:
    Nov 2008

    Posted 28 Jul 2011 Link to this post

    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
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Murray
    Murray avatar
    121 posts
    Member since:
    Aug 2010

    Posted 24 Jan 2012 Link to this post

    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?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 26 Jan 2012 Link to this post

    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 >>
Back to Top