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

RadWindow.Confirm Inside a RadWindows.Prompt

3 Answers 61 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ernie S
Top achievements
Rank 1
Ernie S asked on 10 Sep 2014, 02:06 PM
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

3 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 12 Sep 2014, 11:04 AM
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.
 
0
Ernie S
Top achievements
Rank 1
answered on 12 Sep 2014, 02:04 PM
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
0
Kalin
Telerik team
answered on 16 Sep 2014, 12:18 PM
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.
 
Tags
Window
Asked by
Ernie S
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Ernie S
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or