locked
NotifyUser does not exist in the current context. RRS feed

  • Question

  • internal static bool EnsureUnsnapped()
            {
                // FilePicker APIs will not work if the application is in a snapped state.
                // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
                bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
                if (!unsnapped)
                {
                    NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage);
                }

                return unsnapped;
            }

    NotifyUser does not exist in the current context.

    NotifyType does not exist in the current context.

    Any ideas?

    Friday, February 1, 2013 2:31 PM

Answers

  • I think you copied the code from an official metro sample (it is generally located in mainpage.xaml.cs in the samples)... This is not a framework method, the implementation looks like below. You can either reuse it or implement it yourself...

            public void NotifyUser(string strMessage, NotifyType type) 
            { 
                switch (type) 
                { 
                    // Use the status message style. 
                    case NotifyType.StatusMessage: 
                        StatusBlock.Style = Resources["StatusStyle"] as Style; 
                        break; 
                    // Use the error message style. 
                    case NotifyType.ErrorMessage: 
                        StatusBlock.Style = Resources["ErrorStyle"] as Style; 
                        break; 
                } 
                StatusBlock.Text = strMessage; 
     
                // Collapse the StatusBlock if it has no text to conserve real estate. 
                if (StatusBlock.Text != String.Empty) 
                { 
                    StatusBlock.Visibility = Windows.UI.Xaml.Visibility.Visible; 
                } 
                else 
                { 
                    StatusBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed; 
                } 
            } 


    Can Bilgin
    Blog Samples CompuSight

    • Proposed as answer by Jesse Jiang Monday, February 4, 2013 6:58 AM
    • Marked as answer by Jesse Jiang Thursday, February 7, 2013 3:18 AM
    Friday, February 1, 2013 2:46 PM