private string GetFeedbackTemplate() { var packageVersion = Package.Current.Id.Version; string version = string.Format("{0}.{1}", packageVersion.Major, packageVersion.Minor); string company = GetCompanyName(this); if (company == null || company.Length <= 0) { company = "<Company>"; } var i = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation(); var deviceName = string.IsNullOrWhiteSpace(i.FriendlyName) ? "<DeviceName>" : i.FriendlyName; var deviceManufacturer = string.IsNullOrWhiteSpace(i.SystemManufacturer) ? "<DeviceManufacturer>" : i.SystemManufacturer; var deviceHardwareVersion = string.IsNullOrWhiteSpace(i.SystemSku) ? "<DeviceHardwareVersion>" : i.SystemSku; var deviceFirmwareVersion = string.IsNullOrWhiteSpace(i.OperatingSystem) ? "<DeviceFirmwareVersion>" : i.OperatingSystem; // Body text including hardware, firmware and software info string body = string.Format(FeedbackOverlay.GetFeedbackBody(this), deviceName, deviceManufacturer, deviceFirmwareVersion, deviceHardwareVersion, version, company); return(body); }
/// <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(); }
/// <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(); }
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 }