Пример #1
0
 public static string GetApplicationName(FeedbackOverlay element)
 {
     return((string)element.GetValue(ApplicationNameProperty));
 }
Пример #2
0
 public static void SetEnableAnimation(FeedbackOverlay element, bool value)
 {
     element.SetValue(EnableAnimationProperty, value);
 }
Пример #3
0
 public static TimeSpan GetAnimationDuration(FeedbackOverlay element)
 {
     return((TimeSpan)element.GetValue(AnimationDurationProperty));
 }
Пример #4
0
 public static string GetLanguageOverride(FeedbackOverlay element)
 {
     return((string)element.GetValue(LanguageOverrideProperty));
 }
Пример #5
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)
        {
            // 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);
            }
        }
Пример #6
0
 public static void SetCountDays(FeedbackOverlay element, bool value)
 {
     element.SetValue(CountDaysProperty, value);
 }
Пример #7
0
 public static void SetVisibilityForDesign(FeedbackOverlay element, Visibility value)
 {
     element.SetValue(VisibilityForDesignProperty, value);
 }
Пример #8
0
 public static string GetFeedbackMessage1(FeedbackOverlay element)
 {
     return((string)element.GetValue(FeedbackMessage1Property));
 }
Пример #9
0
 public static void SetFeedbackSubject(FeedbackOverlay element, string value)
 {
     element.SetValue(FeedbackSubjectProperty, value);
 }
Пример #10
0
 public static string GetRatingNo(FeedbackOverlay element)
 {
     return((string)element.GetValue(RatingNoProperty));
 }
Пример #11
0
 public static void SetFeedbackMessage1(FeedbackOverlay element, string value)
 {
     element.SetValue(FeedbackMessage1Property, value);
 }
Пример #12
0
 public static void SetRatingNo(FeedbackOverlay element, string value)
 {
     element.SetValue(RatingNoProperty, value);
 }
Пример #13
0
 public static bool GetIsNotVisible(FeedbackOverlay element)
 {
     return((bool)element.GetValue(IsNotVisibleProperty));
 }
Пример #14
0
 public static void SetIsNotVisible(FeedbackOverlay element, bool value)
 {
     element.SetValue(IsNotVisibleProperty, value);
 }
Пример #15
0
 public static void SetSecondCount(FeedbackOverlay element, int value)
 {
     element.SetValue(SecondCountProperty, value);
 }
Пример #16
0
 public static string GetFeedbackSubject(FeedbackOverlay element)
 {
     return((string)element.GetValue(FeedbackSubjectProperty));
 }
Пример #17
0
 public static int GetSecondCount(FeedbackOverlay element)
 {
     return((int)element.GetValue(SecondCountProperty));
 }
Пример #18
0
 public static void SetFeedbackBody(FeedbackOverlay element, string value)
 {
     element.SetValue(FeedbackBodyProperty, value);
 }
Пример #19
0
 public static bool GetCountDays(FeedbackOverlay element)
 {
     return((bool)element.GetValue(CountDaysProperty));
 }
Пример #20
0
 public static string GetFeedbackBody(FeedbackOverlay element)
 {
     return((string)element.GetValue(FeedbackBodyProperty));
 }
Пример #21
0
 public static void SetLanguageOverride(FeedbackOverlay element, string value)
 {
     element.SetValue(LanguageOverrideProperty, value);
 }
Пример #22
0
 public static void SetCompanyName(FeedbackOverlay element, string value)
 {
     element.SetValue(CompanyNameProperty, value);
 }
Пример #23
0
 public static Visibility GetVisibilityForDesign(FeedbackOverlay element)
 {
     return((Visibility)element.GetValue(VisibilityForDesignProperty));
 }
Пример #24
0
 public static string GetCompanyName(FeedbackOverlay element)
 {
     return((string)element.GetValue(CompanyNameProperty));
 }
Пример #25
0
        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
        }
Пример #26
0
 public static void SetApplicationName(FeedbackOverlay element, string value)
 {
     element.SetValue(ApplicationNameProperty, value);
 }
Пример #27
0
 public static bool GetEnableAnimation(FeedbackOverlay element)
 {
     return((bool)element.GetValue(EnableAnimationProperty));
 }
Пример #28
0
 public static void SetAnimationDuration(FeedbackOverlay element, TimeSpan value)
 {
     element.SetValue(AnimationDurationProperty, value);
 }