public static string GetApplicationName(FeedbackOverlay element) { return((string)element.GetValue(ApplicationNameProperty)); }
public static void SetEnableAnimation(FeedbackOverlay element, bool value) { element.SetValue(EnableAnimationProperty, value); }
public static TimeSpan GetAnimationDuration(FeedbackOverlay element) { return((TimeSpan)element.GetValue(AnimationDurationProperty)); }
public static string GetLanguageOverride(FeedbackOverlay element) { return((string)element.GetValue(LanguageOverrideProperty)); }
/// <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) { // 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. FeedbackHelper.Default.FirstCount = FeedbackOverlay.GetFirstCount(this); FeedbackHelper.Default.SecondCount = FeedbackOverlay.GetSecondCount(this); FeedbackHelper.Default.CountDays = FeedbackOverlay.GetCountDays(this); // Inform FeedbackHelper of the creation of this control. 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; } foreach (var doubleAnimation in showContent.Children.OfType <DoubleAnimation>()) { doubleAnimation.Duration = FeedbackOverlay.GetAnimationDuration(this); } foreach (var doubleAnimation in hideContent.Children.OfType <DoubleAnimation>()) { doubleAnimation.Duration = FeedbackOverlay.GetAnimationDuration(this); } }
public static void SetCountDays(FeedbackOverlay element, bool value) { element.SetValue(CountDaysProperty, value); }
public static void SetVisibilityForDesign(FeedbackOverlay element, Visibility value) { element.SetValue(VisibilityForDesignProperty, value); }
public static string GetFeedbackMessage1(FeedbackOverlay element) { return((string)element.GetValue(FeedbackMessage1Property)); }
public static void SetFeedbackSubject(FeedbackOverlay element, string value) { element.SetValue(FeedbackSubjectProperty, value); }
public static string GetRatingNo(FeedbackOverlay element) { return((string)element.GetValue(RatingNoProperty)); }
public static void SetFeedbackMessage1(FeedbackOverlay element, string value) { element.SetValue(FeedbackMessage1Property, value); }
public static void SetRatingNo(FeedbackOverlay element, string value) { element.SetValue(RatingNoProperty, value); }
public static bool GetIsNotVisible(FeedbackOverlay element) { return((bool)element.GetValue(IsNotVisibleProperty)); }
public static void SetIsNotVisible(FeedbackOverlay element, bool value) { element.SetValue(IsNotVisibleProperty, value); }
public static void SetSecondCount(FeedbackOverlay element, int value) { element.SetValue(SecondCountProperty, value); }
public static string GetFeedbackSubject(FeedbackOverlay element) { return((string)element.GetValue(FeedbackSubjectProperty)); }
public static int GetSecondCount(FeedbackOverlay element) { return((int)element.GetValue(SecondCountProperty)); }
public static void SetFeedbackBody(FeedbackOverlay element, string value) { element.SetValue(FeedbackBodyProperty, value); }
public static bool GetCountDays(FeedbackOverlay element) { return((bool)element.GetValue(CountDaysProperty)); }
public static string GetFeedbackBody(FeedbackOverlay element) { return((string)element.GetValue(FeedbackBodyProperty)); }
public static void SetLanguageOverride(FeedbackOverlay element, string value) { element.SetValue(LanguageOverrideProperty, value); }
public static void SetCompanyName(FeedbackOverlay element, string value) { element.SetValue(CompanyNameProperty, value); }
public static Visibility GetVisibilityForDesign(FeedbackOverlay element) { return((Visibility)element.GetValue(VisibilityForDesignProperty)); }
public static string GetCompanyName(FeedbackOverlay element) { return((string)element.GetValue(CompanyNameProperty)); }
public async void Feedback() #endif { string version = string.Empty; #if SILVERLIGHT var appManifestResourceInfo = Application.GetResourceStream(new Uri("WMAppManifest.xml", UriKind.Relative)); using (var appManifestStream = appManifestResourceInfo.Stream) { using (var reader = XmlReader.Create(appManifestStream, new XmlReaderSettings { IgnoreWhitespace = true, IgnoreComments = true })) { var doc = XDocument.Load(reader); var app = doc.Descendants("App").FirstOrDefault(); if (app != null) { var versionAttribute = app.Attribute("Version"); if (versionAttribute != null) { version = versionAttribute.Value; } } } } if (string.IsNullOrEmpty(version)) { // Application version var asm = System.Reflection.Assembly.GetExecutingAssembly(); var parts = asm.FullName.Split(','); version = parts[1].Split('=')[1]; } #else //use the new api //var uri = new System.Uri("ms-appx:///AppxManifest.xml"); //StorageFile file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri); //using (var rastream = await file.OpenReadAsync()) //using (var appManifestStream = rastream.AsStreamForRead()) //{ // using (var reader = XmlReader.Create(appManifestStream, new XmlReaderSettings { IgnoreWhitespace = true, IgnoreComments = true })) // { // var doc = XDocument.Load(reader); // var app = doc.Descendants("Identity").FirstOrDefault(); // if (app != null) // { // var versionAttribute = app.Attribute("Version"); // if (versionAttribute != null) // { // version = versionAttribute.Value; // } // } // } //} var versionInfo = Windows.ApplicationModel.Package.Current.Id.Version; version = versionInfo.Major.ToString() + "." + versionInfo.Minor.ToString() + "." + versionInfo.Build.ToString() + "." + versionInfo.Revision.ToString(); #endif string company = GetCompanyName(this); if (company == null || company.Length <= 0) { company = "<Company>"; } #if SILVERLIGHT // Body text including hardware, firmware and software info string body = string.Format(FeedbackOverlay.GetFeedbackBody(this), DeviceStatus.DeviceName, DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceFirmwareVersion, DeviceStatus.DeviceHardwareVersion, version, company); // Email task var email = new EmailComposeTask(); email.To = FeedbackOverlay.GetFeedbackTo(this); email.Subject = string.Format(FeedbackOverlay.GetFeedbackSubject(this), GetApplicationName()); email.Body = body; email.Show(); #else var easClientDeviceInformation = new EasClientDeviceInformation(); // Body text including hardware, firmware and software info string body = string.Format(FeedbackOverlay.GetFeedbackBody(this), easClientDeviceInformation.SystemProductName, easClientDeviceInformation.SystemManufacturer, easClientDeviceInformation.SystemFirmwareVersion, easClientDeviceInformation.SystemHardwareVersion, version, company); // Send an Email with attachment EmailMessage email = new EmailMessage(); email.To.Add(new EmailRecipient(FeedbackOverlay.GetFeedbackTo(this))); email.Subject = string.Format(FeedbackOverlay.GetFeedbackSubject(this), GetApplicationName()); email.Body = body; await EmailManager.ShowComposeNewEmailAsync(email); #endif }
public static void SetApplicationName(FeedbackOverlay element, string value) { element.SetValue(ApplicationNameProperty, value); }
public static bool GetEnableAnimation(FeedbackOverlay element) { return((bool)element.GetValue(EnableAnimationProperty)); }
public static void SetAnimationDuration(FeedbackOverlay element, TimeSpan value) { element.SetValue(AnimationDurationProperty, value); }