RadWindow.Confirm Inside a RadWindows.Prompt

4 posts, 0 answers
  1. Ernie S
    Ernie S avatar
    33 posts
    Member since:
    Apr 2014

    Posted 10 Sep 2014 Link to this post

    I have a rad window that popups up asking the user for a Save As name.  In the handler that is called after it closes it checks to see if the name alredy exists.  If it does, I want to get overwrite confirmation from the user in another RadWindow.  This is where I cannot figure out how to do it since the Confirm window, like the Prompt, reacts to the user input through the use of the delegate.

    I have it working with the plain Windows MessageBox (Line 20) but how would I do it with the RadWindow?

    01.private void SaveAs()
    02.{
    03.    RadWindow.Prompt(
    04.        "Please enter the name of the new view"
    05.        , (sender, args) =>
    06.            {
    07.                if (args.DialogResult != true)
    08.                    return;
    09. 
    10.                //See if it already exists
    11.                var id = -1;
    12.                var foundviews = SerializedViews
    13.                    .Items
    14.                    .Cast<SerializedView>()
    15.                    .Where(sv => sv.Name == args.PromptResult)
    16.                    .ToList();
    17. 
    18.                if(foundviews.Any())
    19.                {
    20.                    var result = MessageBox.Show("Already exists, overwrite?", "Confirm:", MessageBoxButton.OKCancel);
    21.                    if (result == MessageBoxResult.Cancel)
    22.                        return;
    23. 
    24.                    id = foundviews.First().Id;
    25.                }
    26.                 
    27.                .......
    28. 
    29.                SaveView(view);
    30.            });
    31.}

    Thanks
    Ernie
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 12 Sep 2014 Link to this post

    Hi Ernie,

    In Silverlight RadWindow.Confirm and RadWindow.Prompt are not blocking operations - the code continues its execution even after such windows are opened. MessageBox itself is using some internal framework logic to block all operations, that's why it is possible to use it in your scenario. In case you decide to use RadWindow.Prompt and inside it RadWindow.Confirm, the prompt window will be closed even if your confirm window is still opened. In order to achieve the desired result I suggest you to use your current code with MessageBox or raise a flag (internal property of your class) in your RadWindow.Prompt closed handler in order to know that confirm window is opened. After that instead of executing your other logic when Prompt window is closed, you can execute it in Confirm window's closed handler.

    Hope this helps.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. Ernie S
    Ernie S avatar
    33 posts
    Member since:
    Apr 2014

    Posted 12 Sep 2014 in reply to Rosen Vladimirov Link to this post

    Thanks Rosen, thats what I though.  Is there anything equivalent prompt in your controls that provides blocking?  I wanted to use the RadWindow because we do a lot of style injection at runtime so it is easier to use it to maintain a consistent look.

    Thanks
    Ernie
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 16 Sep 2014 Link to this post

    Hello Ernie,

    I'm afraid that our dialogs doesn't support that blocking behavior. However you can try the approach Rosen already suggested in our previous post.

    If you have any other questions or concerns - let us know.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top