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

4 posts, 1 answers
  1. Patrick
    Patrick avatar
    43 posts
    Member since:
    Jan 2013

    Posted 28 Oct 2013 Link to this post

    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
  2. Patrick
    Patrick avatar
    43 posts
    Member since:
    Jan 2013

    Posted 29 Oct 2013 Link to this post

    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
  3. DevCraft banner
  4. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 31 Oct 2013 Link to this post

    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 >>
  5. Answer
    Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 29 Nov 2013 Link to this post

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