示例#1
0
        /// <summary>
        /// Reset review and feedback funtionality. Makes notifications active
        /// again, for example, after a major application update.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FeedbackOverlay_Loaded(object sender, RoutedEventArgs e)
        {
#if WINDOWS_APP
            content.VerticalAlignment = VerticalAlignment.Center;
#endif

            // FeedbackTo property is mandatory and must be defined in xaml.
            if (GetFeedbackTo(this) == null || GetFeedbackTo(this).Length <= 0)
            {
                throw new ArgumentNullException("FeedbackTo", "Mandatory property not defined in FeedbackOverlay.");
            }

            // ApplicationName property is mandatory and must be defined in xaml.
            if (GetApplicationName(this) == null || GetApplicationName(this).Length <= 0)
            {
                throw new ArgumentNullException("ApplicationName", "Mandatory property not defined in FeedbackOverlay.");
            }

            // CompanyName property is mandatory and must be defined in xaml.
            if (GetCompanyName(this) == null || GetCompanyName(this).Length <= 0)
            {
                throw new ArgumentNullException("CompanyName", "Mandatory property not defined in FeedbackOverlay.");
            }

            // Application language override.
            if (GetLanguageOverride(this) != null)
            {
                OverrideLanguage();
            }

            // Set up FeedbackHelper with properties.
            RateMyApp.Helpers.FeedbackHelper.Default.FirstCount  = FeedbackOverlay.GetFirstCount(this);
            RateMyApp.Helpers.FeedbackHelper.Default.SecondCount = FeedbackOverlay.GetSecondCount(this);
            RateMyApp.Helpers.FeedbackHelper.Default.CountDays   = FeedbackOverlay.GetCountDays(this);

            // Inform FeedbackHelper of the creation of this control.
            RateMyApp.Helpers.FeedbackHelper.Default.Launching();

            // This class needs to be aware of Back key presses.
            AttachBackKeyPressed();

            if (FeedbackOverlay.GetEnableAnimation(this))
            {
                LayoutRoot.Opacity    = 0;
                xProjection.RotationX = 90;
            }

            // Check if review/feedback notification should be shown.
            if (FeedbackHelper.Default.State == FeedbackState.FirstReview)
            {
                SetVisibility(true);
                SetupFirstMessage();

                if (FeedbackOverlay.GetEnableAnimation(this))
                {
                    showContent.Begin();
                }
            }
            else if (FeedbackHelper.Default.State == FeedbackState.SecondReview)
            {
                SetVisibility(true);
                SetupSecondMessage();

                if (FeedbackOverlay.GetEnableAnimation(this))
                {
                    showContent.Begin();
                }
            }
            else
            {
                SetVisibility(false);
                FeedbackHelper.Default.State = FeedbackState.Inactive;
            }
        }