コード例 #1
0
        /// <summary>
        /// Launch feedback email.
        /// </summary>
        private void Feedback()
        {
            // Application version
            var asm     = System.Reflection.Assembly.GetExecutingAssembly();
            var parts   = asm.FullName.Split(',');
            var version = parts[1].Split('=')[1];

            string company = GetCompanyName(this);

            if (company == null || company.Length <= 0)
            {
                company = "<Company>";
            }

            // 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();
        }
コード例 #2
0
        private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            DataTransferManager.GetForCurrentView().DataRequested -= OnDataRequested;

            args.Request.Data.Properties.Title       = string.Format(FeedbackOverlay.GetFeedbackSubject(this), GetApplicationName());
            args.Request.Data.Properties.Description = GetFeedbackYes(this);
            args.Request.Data.SetText(GetFeedbackTemplate());
        }
コード例 #3
0
        /// <summary>
        /// Launch feedback email.
        /// </summary>
        private void Feedback()
        {
            string version = string.Empty;

            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];
            }

            string company = GetCompanyName(this);

            if (company == null || company.Length <= 0)
            {
                company = "<Company>";
            }

            // 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();
        }
コード例 #4
0
        private 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
            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;
                            }
                        }
                    }
                }
#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
        }