locked
snap view in JavaScript message dialog RRS feed

  • Question

  •     If we are in snap view it alert with a message dialog .and when are un snap view it should automatically close the message dialog box. I have tried this code when we are in snap view it is good but when we are out of snap view it is not closing the dialog automatically can u tell me how to do this, thanks in advance.

    function onresize()
    {
        if (Windows.UI.ViewManagement.ApplicationView.value == Windows.UI.ViewManagement.ApplicationViewState.snapped) {
    
            Windows.UI.Popups.MessageDialog("Please View in Full screen Mode").showAsync();
        }
    
           else if (Windows.UI.ViewManagement.ApplicationView.tryUnsnap) {
                
               close(Windows.UI.Popups.MessageDialog).showAsync();
           }
        }
    

     
    Friday, December 28, 2012 11:27 AM

Answers

  • Hi MaheshSetty,

    I think the problem here is that you use Windows.UI.Popups.MessageDialog to show the information to user. MessageDialog provide a model dialog like UI which require the user interaction to close it. In your case, you need to programmtically suppress the information dialog after the user manually or you programmtically switch the app to full screen viewState (from snap viewstate). Then, I'd suggest you consider using other approach to show the information to user (when the app is changed to snap viewstate).

    You can try using the Flyout control to display a flyout box which occupy the entire screen when the app is in snap viewstate.

    #Quickstart: adding a Flyout(Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465354

    Or you can use a custom <div> (set the width and height to occupy the entire screen and z-index to higher than other) to display the information to user. B

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Friday, January 4, 2013 6:17 AM
    Monday, December 31, 2012 5:23 AM
    Moderator

All replies

  • Hi,

    Please change the code as follow:

    function onresize()
    {
        if (Windows.UI.ViewManagement.ApplicationView.value == Windows.UI.ViewManagement.ApplicationViewState.snapped) {
    
            Windows.UI.Popups.MessageDialog("Please View in Full screen Mode").showAsync();
        }
    
           else if (Windows.UI.ViewManagement.ApplicationView.tryUnsnap()) {
                
               close(Windows.UI.Popups.MessageDialog).showAsync();
           }
        }


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Song Tian Monday, December 31, 2012 4:30 AM
    Monday, December 31, 2012 3:08 AM
  • Hi MaheshSetty,

    I think the problem here is that you use Windows.UI.Popups.MessageDialog to show the information to user. MessageDialog provide a model dialog like UI which require the user interaction to close it. In your case, you need to programmtically suppress the information dialog after the user manually or you programmtically switch the app to full screen viewState (from snap viewstate). Then, I'd suggest you consider using other approach to show the information to user (when the app is changed to snap viewstate).

    You can try using the Flyout control to display a flyout box which occupy the entire screen when the app is in snap viewstate.

    #Quickstart: adding a Flyout(Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465354

    Or you can use a custom <div> (set the width and height to occupy the entire screen and z-index to higher than other) to display the information to user. B

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Friday, January 4, 2013 6:17 AM
    Monday, December 31, 2012 5:23 AM
    Moderator