private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { // WhatsNewTitle property is mandatory and must be defined in xaml. if (GetWhatsNewTitle(this) == null || GetWhatsNewTitle(this).Length <= 0) { throw new ArgumentNullException(nameof(WhatsNewTitleProperty), "Mandatory property not defined in WhatsNewPopup."); } // ApplicationName property is mandatory and must be defined in xaml. if (GetApplicationName(this) == null || GetApplicationName(this).Length <= 0) { throw new ArgumentNullException(nameof(ApplicationNameProperty), "Mandatory property not defined in WhatsNewPopup."); } // WhatsNewMessage property is mandatory and must be defined in xaml. if (GetWhatsNewMessage(this) == null || GetWhatsNewMessage(this).Length <= 0) { throw new ArgumentNullException(nameof(WhatsNewMessageProperty), "Mandatory property not defined in WhatsNewPopup."); } // Application language override. if (GetLanguageOverride(this) != null) { OverrideLanguage(); } WhatsNewHelper.Default.Launching(); TxtVersion.Text = WhatsNewHelper.Default.GetAppVersion(); if (WhatsNewHelper.Default.State == WhatsNewState.VersionUpdate) { SetupMessage(); ContentDialogResult result = await DigContent.ShowAsync(); } }
/// <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 async void FeedbackOverlay_Loaded(object sender, RoutedEventArgs e) { // FeedbackTo property is mandatory and must be defined in xaml. if (GetFeedbackTo(this) == null || GetFeedbackTo(this).Length <= 0) { throw new ArgumentNullException(nameof(FeedbackToProperty), "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(nameof(ApplicationNameProperty), "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(nameof(CompanyNameProperty), "Mandatory property not defined in FeedbackOverlay."); } // Application language override. if (GetLanguageOverride(this) != null) { OverrideLanguage(); } // Set up FeedbackHelper with properties. FeedbackHelper.Default.FirstCount = GetFirstCount(this); FeedbackHelper.Default.SecondCount = GetSecondCount(this); FeedbackHelper.Default.CountDays = GetCountDays(this); // Inform FeedbackHelper of the creation of this control. FeedbackHelper.Default.Launching(); // Check if review/feedback notification should be shown. if (FeedbackHelper.Default.State == FeedbackState.FirstReview) { SetupFirstMessage(); ContentDialogResult result = await DigContent.ShowAsync(); await HandleDialogResult(result); } else if (FeedbackHelper.Default.State == FeedbackState.SecondReview) { SetupSecondMessage(); ContentDialogResult result = await DigContent.ShowAsync(); await HandleDialogResult(result); } else { FeedbackHelper.Default.State = FeedbackState.Inactive; } }
private async Task HandleDialogResult(ContentDialogResult result) { if (result == ContentDialogResult.Primary) { if (FeedbackHelper.Default.State == FeedbackState.FirstReview) { await OpenStoreReviewAsync(); } else if (FeedbackHelper.Default.State == FeedbackState.SecondReview) { await OpenStoreReviewAsync(); } else if (FeedbackHelper.Default.State == FeedbackState.Feedback) { await LaunchFeedbackEmailAsync(); } FeedbackHelper.Default.State = FeedbackState.Inactive; } if (result == ContentDialogResult.Secondary) { DigContent.Hide(); // LaunchFeedbackEmailAsync TxtMessage is shown only after first review TxtMessage. if (FeedbackHelper.Default.State == FeedbackState.FirstReview) { SetupFeedbackMessage(); FeedbackHelper.Default.State = FeedbackState.Feedback; var secondResult = await DigContent.ShowAsync(); await HandleDialogResult(secondResult); } else { FeedbackHelper.Default.State = FeedbackState.Inactive; } } }