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

Closed event no longer carries over button click as "user initiated"

3 Answers 69 Views
Window
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 28 Oct 2013, 08:24 PM
Hello,

In our product we require an increase for isolated storage above 1MB, we prompt the user to inform them of this and then we pop-up the standard Silverlight increase isolated storage dialog. The issue is that we used RadWindow.Confirm() for this as it must be "user initiated" (e.g. button-click). In the code below IncreaseQuotaTo()now always returns false even though the silverlight pop-up never opens.

This worked with 2013.1.0220 DLLS, but not with the new Q3 2013 (2013.3.1016).

Our code looked something like this:
DialogParameters parameters = new DialogParameters();
parameters.Content = "You must increase storage space to use this product.  Increase storage?";
parameters.OkButtonContent = "Yes";
parameters.CancelButtonContent = "No";
parameters.Theme = new Expression_DarkTheme();
parameters.Closed = (s, args) =>//having a breakpoint in this function causes IncreaseQuotaTo to always return false. It must disrupt the 'user initiated-ness' of it.
{
    RadWindow dlg = (RadWindow)s;
    if (dlg.DialogResult == true)
    {
        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
        {
            //Request more quota space
            Int64 newQuotaSize = 250 * 1024 * 1024; //250MB
            if (store.IncreaseQuotaTo(newQuotaSize))
            {
                LoadApplication();
            }
            else
            {
                Logout();
            }
        }
    }
    else
    {
        Logout();
    }
};
 
RadWindow.Confirm(parameters);


The above worked very well for over a year, we had to put a quick fix in since this wouldn't allow log-ins.
This quick fix worked well but is less than ideal:

    RadWindow.Confirm(parameters);
 
    //this allows the window to draw then drill down to get the OK button to get the event, this allows store.IncreaseQuotaTo() to work correctly for a user init event
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
        var windows = RadWindowManager.Current.GetWindows();
        if (windows != null)
        {
            foreach (var win in windows)
            {
                var buttons = win.ChildrenOfType<RadButton>();
                foreach (var button in buttons)
                {
                    if (button.Name == "OK")
                    {
                        button.Click += isolatedStorageIncreaseDialogClosed;
                        return;
                    }
                }
            }
        }
    });
}
 
private void isolatedStorageIncreaseDialogClosed(object sender, RoutedEventArgs e)
{
    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
    {
        // Request more quota space
        Int64 newQuotaSize = 250 * 1024 * 1024; //250MB
        if (store.IncreaseQuotaTo(newQuotaSize))
        {
            LoadApplication();
        }
        else
        {
            Logout();
        }
    }
}


We could keep it like this or create our own prompt dialog with button events. My question is: will this change (be fixed) in the future or is this behavior telerik is going for?

Thanks,
Patrick

3 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 29 Oct 2013, 04:33 PM
An addition to this that we have seen a very odd edge case issue in regard to the user hitting [Enter] instead of clicking on the Confirm dialog. When the RadWindow Confirm dialog pops up it doesn't appear to actually focus on either OK or Cancel. If the user hits [Enter] and that happens to lead to store.IncreaseQuotaTo(newQuotaSize)then a nasty error occurs which crashes Silverlight and the browser (IE and Chrome). If you have the Silverlight SDK installed you get the attached error involving "Reentrancy detected in Silverlight". If you don't have the SDK you get a more generic browser crash.

We understand this is a very particular edge case but it may be useful to note.

Our quick workaround was to simply force Focus() on either OK or Cancel, as in:
RadWindow.Confirm(parameters);
 
            //this allows the window to draw then drill down to get the OK button to get the event, this allows store.IncreaseQuotaTo() to work correctly for a user init event
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                var windows = RadWindowManager.Current.GetWindows();
                if (windows != null)
                {
                    foreach (var win in windows)
                    {
                        var buttons = win.ChildrenOfType<RadButton>();
                        foreach (var button in buttons)
                        {
                            if (button.Name == "OK")
                            {
                                button.Focus();
                                button.Click += isolatedStorageIncreaseDialogClosed;
                                return;
                            }
                        }
                    }
                }
            });
        }

This allows [Enter] without the crash. Please note this issue seems to have been in both above referenced 2013 DLL's. We are not sure which previous DLL it started with.

Thank you,
Patrick
0
Rosen Vladimirov
Telerik team
answered on 31 Oct 2013, 04:28 PM
Hello Patrick,

Thank you for reporting this issues. We are currently checking what has caused the difference in the behavior of RadWindow between our last two releases and we'll do our best to provide a fix.

I've updated your Telerik Points as a small sign of our appreciation for your efforts to report this issue. I'll notify you once we have more information on this case.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Accepted
Rosen Vladimirov
Telerik team
answered on 29 Nov 2013, 07:02 AM
Hi Patrick,

I just want to inform you that we have fixed this issue and the fix will be included in our next official release (2013 Q3 SP1), which should be available for download next week.

Hope this helps. Feel free to contact us in case you have any other problems or concerns.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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
Window
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Rosen Vladimirov
Telerik team
Share this question
or