diff --git a/DistFiles/ReleaseNotes.md b/DistFiles/ReleaseNotes.md index 669c951e..a9a2a203 100644 --- a/DistFiles/ReleaseNotes.md +++ b/DistFiles/ReleaseNotes.md @@ -39,6 +39,7 @@ the recorded files to that format, if necessary. ## _VERSION_ (_DATE_) - Improvements related to opening a clip for editing in an external program. - Updated localizations. +- Added Give Feedback capability ## 3.5.3 (March 2025) - Fixed bug affecting Glyssenscript projects when extra clips are present. diff --git a/HearThis.sln.DotSettings b/HearThis.sln.DotSettings index 4639e2e7..0ab5bf85 100644 --- a/HearThis.sln.DotSettings +++ b/HearThis.sln.DotSettings @@ -2,6 +2,7 @@ LCS MVP OT + RTF TOC UDP UI diff --git a/src/HearThis/GiveFeedbackViewModel.cs b/src/HearThis/GiveFeedbackViewModel.cs new file mode 100644 index 00000000..1ef089eb --- /dev/null +++ b/src/HearThis/GiveFeedbackViewModel.cs @@ -0,0 +1,188 @@ +using System.Collections.Generic; +using System.Text.Json.Serialization; +using System.Windows.Forms; +using System.Diagnostics; + +namespace HearThis +{ + public enum TypeOfFeedback + { + Problem = 0, + Suggestion = 1, + Appreciation = 2, + Donate = 3 + } + + public enum ProblemSeverity + { + LostData, + Blocker, + Major, + Minor + } + + public enum Area + { + NotApplicable, + DataSharing, + Exporting, + Android, + Installation, + Localization, + Multiple, + Navigation, + Other, + Playback, + ProjectAdministration, + ProjectSelection, + Recording, + Settings, + Website, + Unknown + } + + public class GiveFeedbackViewModel + { + public string Title { get; set; } + public TypeOfFeedback Type { get; set; } + public ProblemSeverity Severity { get; set; } + public string DescriptionAsRTF { get; set; } + public Area AffectedArea { get; set; } + public string AffectedProject { get; set; } + public string WebsiteUrl { get; set; } + public Form MainForm { get; } + public string PathToLastClip { get; } + public string MainFormWindowTitle => MainForm.Text; + public bool IncludeScreenShot { get; set; } + public bool IncludeLastClip { get; set; } + public bool IncludeLogFile { get; set; } + + public GiveFeedbackViewModel(Form mainForm, string pathToLastClip) + { + MainForm = mainForm; + PathToLastClip = pathToLastClip; + } + + public void GoToCommunitySite() + { + Process.Start($"https://{Program.kSupportUrlSansHttps}"); + } + + public void IssueFeedback() + { + switch (Type) + { + case TypeOfFeedback.Problem: + if (ReportProblemViaRestApi()) + return; + break; + + case TypeOfFeedback.Donate: + Process.Start("https://donate.givedirect.org/?cid=13536&n=289"); + break; + } + } + + private byte[] Screenshot() + { + return null; + } + + private bool ReportProblemViaRestApi() + { + // https://www.educative.io/answers/how-to-create-a-json-string-in-c-sharp + // https://docs.atlassian.com/software/jira/docs/api/REST/8.22.6/#issue-getEditIssueMeta + // https://jira.sil.org/rest/api/latest/issue/createmeta/HT/issuetypes + return false; + } + } + + // Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse); + + public class Component + { + public string id { get; set; } + } + + public class Content + { + public string type { get; set; } + public List content { get; set; } + public string text { get; set; } + } + + public class Description + { + public string type { get; set; } + public int version { get; set; } + public List content { get; set; } + } + + public class SystemEnvironment + { + public string type { get; set; } + public int version { get; set; } + public List content { get; set; } + } + + public class Fields + { + public string summary { get; set; } + public Issuetype issuetype { get; set; } + public List components { get; set; } + public JiraProject project { get; set; } + public Description description { get; set; } + public Reporter reporter { get; set; } + public Priority priority { get; set; } + public List labels { get; set; } + public Security security { get; set; } + public SystemEnvironment environment { get; set; } + public List versions { get; set; } + } + + public class Issuetype + { + [JsonPropertyName("id")] + public string Id { get; set; } + } + + public class Priority + { + [JsonPropertyName("id")] + public string Id { get; set; } + } + + public class JiraProject + { + [JsonPropertyName("id")] + public string Id => "HT"; + } + + public class Reporter + { + [JsonPropertyName("id")] + public string Id { get; set; } + } + + public class Root + { + public Update update { get; set; } + public Fields fields { get; set; } + } + + public class Security + { + [JsonPropertyName("id")] + public string Id { get; set; } + } + + public class Update + { + } + + public class HtVersion + { + [JsonPropertyName("id")] + public string Id { get; set; } + } +} diff --git a/src/HearThis/HearThis.csproj b/src/HearThis/HearThis.csproj index c0bcdcac..3268fc76 100644 --- a/src/HearThis/HearThis.csproj +++ b/src/HearThis/HearThis.csproj @@ -10,7 +10,7 @@ Properties HearThis HearThis - NET472 + net472 false 512 UI\HearThis.ico @@ -181,6 +181,9 @@ True Settings.settings + + Form + @@ -193,13 +196,6 @@ <_Parameter1>HearThisTests - - - True - True - Resources.resx - - ResXFileCodeGenerator diff --git a/src/HearThis/Program.cs b/src/HearThis/Program.cs index 556926c8..0778b7ed 100644 --- a/src/HearThis/Program.cs +++ b/src/HearThis/Program.cs @@ -150,6 +150,7 @@ private static void Main(string[] args) SetUpErrorHandling(); Logger.Init(); + LogProductInfo(); SettingsProtectionSingleton.ProductSupportUrl = kSupportUrlSansHttps; SetupLocalization(); @@ -294,6 +295,15 @@ private static void Main(string[] args) } } + private static void LogProductInfo() + { + var asm = Assembly.GetExecutingAssembly(); + var ver = asm.GetName().Version; + var file = asm.CodeBase.Replace("file:", string.Empty).TrimStart('/'); + var date = new FileInfo(file).LastWriteTime.ToString("dd-MMM-yyyy"); + Logger.WriteEvent($"{kProduct} version {ver} Built on {date}"); + } + public static bool RestartedToChangeColorScheme { get; private set; } public static IEnumerable CompatibleParatextProjectLoadErrors => ScrTextCollection.ErrorMessages.Where(e => e.ProjecType != ProjectType.Resource && !e.ProjecType.IsNoteType()); diff --git a/src/HearThis/Script/Project.cs b/src/HearThis/Script/Project.cs index 09aa188a..90a71cc0 100644 --- a/src/HearThis/Script/Project.cs +++ b/src/HearThis/Script/Project.cs @@ -416,6 +416,8 @@ public IScrProjectSettings ScrProjectSettings public int TotalCountOfBlocksAndExtraClipsForChapter => LineCountForChapter + ExtraRecordings.Count; + public string PathToLastClipRecorded { get; private set; } + public bool HasRecordedClip(int line) { if (line >= LineCountForChapter) @@ -713,6 +715,7 @@ private List GetRecordableBlocksUpThroughHole(IEnumerable indic public void HandleSoundFileCreated() { var clipPath = GetPathToRecordingForSelectedLine(); + PathToLastClipRecorded = clipPath; // Getting this into a local variable is not only more efficient, it also // prevents an annoying problem when working with the sample project, whereby // re-getting the current script line loses information that has not yet been saved. diff --git a/src/HearThis/UI/GiveFeedbackDlg.Designer.cs b/src/HearThis/UI/GiveFeedbackDlg.Designer.cs new file mode 100644 index 00000000..b32a5f05 --- /dev/null +++ b/src/HearThis/UI/GiveFeedbackDlg.Designer.cs @@ -0,0 +1,506 @@ +namespace HearThis.UI +{ + partial class GiveFeedbackDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + components.Dispose(); + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GiveFeedbackDlg)); + this._btnOk = new System.Windows.Forms.Button(); + this.l10NSharpExtender1 = new L10NSharp.UI.L10NSharpExtender(this.components); + this._chkIncludeScreenshot = new System.Windows.Forms.CheckBox(); + this._linkCommunityHelp = new System.Windows.Forms.LinkLabel(); + this._txtTitle = new System.Windows.Forms.TextBox(); + this._lblTitle = new System.Windows.Forms.Label(); + this._lblTypeOfFeedback = new System.Windows.Forms.Label(); + this._lblPriorityOrSeverity = new System.Windows.Forms.Label(); + this._cboTypeOfFeedback = new System.Windows.Forms.ComboBox(); + this._cboPriority = new System.Windows.Forms.ComboBox(); + this._lblDescription = new System.Windows.Forms.Label(); + this._lblProject = new System.Windows.Forms.Label(); + this._chkIncludeRecordingInfo = new System.Windows.Forms.CheckBox(); + this._chkIncludeLog = new System.Windows.Forms.CheckBox(); + this._txtProjectOrWebsite = new System.Windows.Forms.TextBox(); + this._cboProjectOrWebsite = new System.Windows.Forms.ComboBox(); + this._lblInstructions = new System.Windows.Forms.Label(); + this._linkDonate = new System.Windows.Forms.LinkLabel(); + this._btnCancel = new System.Windows.Forms.Button(); + this._lblAffects = new System.Windows.Forms.Label(); + this._cboAffects = new System.Windows.Forms.ComboBox(); + this._lblWebsiteURL = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this._richTextBoxDescription = new System.Windows.Forms.RichTextBox(); + ((System.ComponentModel.ISupportInitialize)(this.l10NSharpExtender1)).BeginInit(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // _btnOk + // + this._btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.l10NSharpExtender1.SetLocalizableToolTip(this._btnOk, null); + this.l10NSharpExtender1.SetLocalizationComment(this._btnOk, null); + this.l10NSharpExtender1.SetLocalizingId(this._btnOk, "Common.OK"); + this._btnOk.Location = new System.Drawing.Point(499, 480); + this._btnOk.Name = "_btnOk"; + this._btnOk.Size = new System.Drawing.Size(75, 23); + this._btnOk.TabIndex = 3; + this._btnOk.Text = "OK"; + this._btnOk.UseVisualStyleBackColor = true; + this._btnOk.Click += new System.EventHandler(this._btnOk_Click); + // + // l10NSharpExtender1 + // + this.l10NSharpExtender1.LocalizationManagerId = "HearThis"; + this.l10NSharpExtender1.PrefixForNewItems = ""; + // + // _chkIncludeScreenshot + // + this._chkIncludeScreenshot.AutoSize = true; + this._chkIncludeScreenshot.Enabled = false; + this.l10NSharpExtender1.SetLocalizableToolTip(this._chkIncludeScreenshot, null); + this.l10NSharpExtender1.SetLocalizationComment(this._chkIncludeScreenshot, "Param 0: HearThis main window caption"); + this.l10NSharpExtender1.SetLocalizingId(this._chkIncludeScreenshot, "GiveFeedbackDlg._chkIncludeScreenshot"); + this._chkIncludeScreenshot.Location = new System.Drawing.Point(104, 298); + this._chkIncludeScreenshot.Margin = new System.Windows.Forms.Padding(3, 20, 3, 3); + this._chkIncludeScreenshot.Name = "_chkIncludeScreenshot"; + this._chkIncludeScreenshot.Size = new System.Drawing.Size(184, 17); + this._chkIncludeScreenshot.TabIndex = 3; + this._chkIncludeScreenshot.Text = "Include screenshot of {0} window"; + this._chkIncludeScreenshot.UseVisualStyleBackColor = true; + // + // _linkCommunityHelp + // + this._linkCommunityHelp.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this._linkCommunityHelp, 2); + this._linkCommunityHelp.LinkArea = new System.Windows.Forms.LinkArea(67, 29); + this.l10NSharpExtender1.SetLocalizableToolTip(this._linkCommunityHelp, null); + this.l10NSharpExtender1.SetLocalizationComment(this._linkCommunityHelp, "Put square brackets around the text that should appear as the hyperlink. The text" + + " in the brackets is localizable. However, note that the URL it will take the use" + + "r to is in English."); + this.l10NSharpExtender1.SetLocalizingId(this._linkCommunityHelp, "GiveFeedbackDlg._linkCommunityHelp"); + this._linkCommunityHelp.Location = new System.Drawing.Point(3, 0); + this._linkCommunityHelp.Name = "_linkCommunityHelp"; + this._linkCommunityHelp.Padding = new System.Windows.Forms.Padding(0, 0, 0, 16); + this._linkCommunityHelp.Size = new System.Drawing.Size(631, 46); + this._linkCommunityHelp.TabIndex = 4; + this._linkCommunityHelp.TabStop = true; + this._linkCommunityHelp.Text = "Before you report a problem or make a suggestion, please visit the [Scripture Sof" + + "tware Community] page for {0} to see if your issue is already addressed there."; + this._linkCommunityHelp.UseCompatibleTextRendering = true; + this._linkCommunityHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkClicked); + // + // _txtTitle + // + this._txtTitle.Dock = System.Windows.Forms.DockStyle.Fill; + this.l10NSharpExtender1.SetLocalizableToolTip(this._txtTitle, null); + this.l10NSharpExtender1.SetLocalizationComment(this._txtTitle, null); + this.l10NSharpExtender1.SetLocalizationPriority(this._txtTitle, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this._txtTitle, "GiveFeedbackDlg._txtTitle"); + this._txtTitle.Location = new System.Drawing.Point(104, 49); + this._txtTitle.Name = "_txtTitle"; + this._txtTitle.Size = new System.Drawing.Size(538, 20); + this._txtTitle.TabIndex = 5; + this._txtTitle.TextChanged += new System.EventHandler(this.UpdateOkButtonState); + // + // _lblTitle + // + this._lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblTitle.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblTitle, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblTitle, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblTitle, "GiveFeedbackDlg._lblTitle"); + this._lblTitle.Location = new System.Drawing.Point(25, 46); + this._lblTitle.Name = "_lblTitle"; + this._lblTitle.Size = new System.Drawing.Size(73, 13); + this._lblTitle.TabIndex = 6; + this._lblTitle.Text = "Title of report*"; + this._lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _lblTypeOfFeedback + // + this._lblTypeOfFeedback.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblTypeOfFeedback.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblTypeOfFeedback, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblTypeOfFeedback, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblTypeOfFeedback, "GiveFeedbackDlg._lblTypeOfFeedback"); + this._lblTypeOfFeedback.Location = new System.Drawing.Point(3, 72); + this._lblTypeOfFeedback.Name = "_lblTypeOfFeedback"; + this._lblTypeOfFeedback.Size = new System.Drawing.Size(95, 13); + this._lblTypeOfFeedback.TabIndex = 7; + this._lblTypeOfFeedback.Text = "Type of feedback*"; + this._lblTypeOfFeedback.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _lblPriorityOrSeverity + // + this._lblPriorityOrSeverity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblPriorityOrSeverity.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblPriorityOrSeverity, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblPriorityOrSeverity, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblPriorityOrSeverity, "GiveFeedbackDlg._lblPriorityOrSeverity"); + this._lblPriorityOrSeverity.Location = new System.Drawing.Point(49, 99); + this._lblPriorityOrSeverity.Name = "_lblPriorityOrSeverity"; + this._lblPriorityOrSeverity.Size = new System.Drawing.Size(49, 13); + this._lblPriorityOrSeverity.TabIndex = 8; + this._lblPriorityOrSeverity.Text = "Severity*"; + this._lblPriorityOrSeverity.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _cboTypeOfFeedback + // + this._cboTypeOfFeedback.FormattingEnabled = true; + this._cboTypeOfFeedback.Items.AddRange(new object[] { + "Report problem", + "Make a suggestion", + "Express appreciation", + "Donate to support software development"}); + this.l10NSharpExtender1.SetLocalizableToolTip(this._cboTypeOfFeedback, null); + this.l10NSharpExtender1.SetLocalizationComment(this._cboTypeOfFeedback, null); + this.l10NSharpExtender1.SetLocalizationPriority(this._cboTypeOfFeedback, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this._cboTypeOfFeedback, "GiveFeedbackDlg._cboTypeOfFeedback"); + this._cboTypeOfFeedback.Location = new System.Drawing.Point(104, 75); + this._cboTypeOfFeedback.Name = "_cboTypeOfFeedback"; + this._cboTypeOfFeedback.Size = new System.Drawing.Size(297, 21); + this._cboTypeOfFeedback.TabIndex = 9; + this._cboTypeOfFeedback.SelectedIndexChanged += new System.EventHandler(this._cboTypeOfFeedback_SelectedIndexChanged); + // + // _cboPriority + // + this._cboPriority.FormattingEnabled = true; + this._cboPriority.Items.AddRange(new object[] { + "I lost data", + "I was not able to complete a task", + "I completed a task, but it was difficult", + "I think the problem is minor"}); + this.l10NSharpExtender1.SetLocalizableToolTip(this._cboPriority, null); + this.l10NSharpExtender1.SetLocalizationComment(this._cboPriority, null); + this.l10NSharpExtender1.SetLocalizationPriority(this._cboPriority, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this._cboPriority, "GiveFeedbackDlg._cboPriority"); + this._cboPriority.Location = new System.Drawing.Point(104, 102); + this._cboPriority.Name = "_cboPriority"; + this._cboPriority.Size = new System.Drawing.Size(297, 21); + this._cboPriority.TabIndex = 10; + // + // _lblDescription + // + this._lblDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblDescription.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblDescription, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblDescription, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblDescription, "GiveFeedbackDlg._lblDescription"); + this._lblDescription.Location = new System.Drawing.Point(34, 126); + this._lblDescription.Name = "_lblDescription"; + this._lblDescription.Size = new System.Drawing.Size(64, 13); + this._lblDescription.TabIndex = 11; + this._lblDescription.Text = "Description*"; + this._lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _lblProject + // + this._lblProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblProject.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblProject, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblProject, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblProject, "GiveFeedbackDlg._lblProject"); + this._lblProject.Location = new System.Drawing.Point(55, 225); + this._lblProject.Name = "_lblProject"; + this._lblProject.Size = new System.Drawing.Size(43, 13); + this._lblProject.TabIndex = 13; + this._lblProject.Text = "Project:"; + this._lblProject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _chkIncludeRecordingInfo + // + this._chkIncludeRecordingInfo.AutoSize = true; + this._chkIncludeRecordingInfo.Checked = true; + this._chkIncludeRecordingInfo.CheckState = System.Windows.Forms.CheckState.Checked; + this.l10NSharpExtender1.SetLocalizableToolTip(this._chkIncludeRecordingInfo, null); + this.l10NSharpExtender1.SetLocalizationComment(this._chkIncludeRecordingInfo, null); + this.l10NSharpExtender1.SetLocalizingId(this._chkIncludeRecordingInfo, "GiveFeedbackDlg._chkIncludeRecordingInfo"); + this._chkIncludeRecordingInfo.Location = new System.Drawing.Point(104, 321); + this._chkIncludeRecordingInfo.Name = "_chkIncludeRecordingInfo"; + this._chkIncludeRecordingInfo.Size = new System.Drawing.Size(168, 17); + this._chkIncludeRecordingInfo.TabIndex = 14; + this._chkIncludeRecordingInfo.Text = "Include the last clip I recorded"; + this._chkIncludeRecordingInfo.UseVisualStyleBackColor = true; + // + // _chkIncludeLog + // + this._chkIncludeLog.AutoSize = true; + this._chkIncludeLog.Checked = true; + this._chkIncludeLog.CheckState = System.Windows.Forms.CheckState.Checked; + this.l10NSharpExtender1.SetLocalizableToolTip(this._chkIncludeLog, null); + this.l10NSharpExtender1.SetLocalizationComment(this._chkIncludeLog, null); + this.l10NSharpExtender1.SetLocalizingId(this._chkIncludeLog, "GiveFeedbackDlg._chkIncludeLog"); + this._chkIncludeLog.Location = new System.Drawing.Point(104, 344); + this._chkIncludeLog.Name = "_chkIncludeLog"; + this._chkIncludeLog.Size = new System.Drawing.Size(112, 17); + this._chkIncludeLog.TabIndex = 15; + this._chkIncludeLog.Text = "Include the log file"; + this._chkIncludeLog.UseVisualStyleBackColor = true; + // + // _txtProjectOrWebsite + // + this._txtProjectOrWebsite.Dock = System.Windows.Forms.DockStyle.Fill; + this.l10NSharpExtender1.SetLocalizableToolTip(this._txtProjectOrWebsite, null); + this.l10NSharpExtender1.SetLocalizationComment(this._txtProjectOrWebsite, null); + this.l10NSharpExtender1.SetLocalizingId(this._txtProjectOrWebsite, "GiveFeedbackDlg._txtProjectOrWebsite"); + this._txtProjectOrWebsite.Location = new System.Drawing.Point(104, 255); + this._txtProjectOrWebsite.Name = "_txtProjectOrWebsite"; + this._txtProjectOrWebsite.Size = new System.Drawing.Size(538, 20); + this._txtProjectOrWebsite.TabIndex = 16; + this._txtProjectOrWebsite.Visible = false; + // + // _cboProjectOrWebsite + // + this._cboProjectOrWebsite.FormattingEnabled = true; + this._cboProjectOrWebsite.Items.AddRange(new object[] { + "Current project {0}", + "Not project-specific", + "Other (specify below)"}); + this.l10NSharpExtender1.SetLocalizableToolTip(this._cboProjectOrWebsite, null); + this.l10NSharpExtender1.SetLocalizationComment(this._cboProjectOrWebsite, null); + this.l10NSharpExtender1.SetLocalizationPriority(this._cboProjectOrWebsite, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this._cboProjectOrWebsite, "GiveFeedbackDlg._cboProjectOrWebsite"); + this._cboProjectOrWebsite.Location = new System.Drawing.Point(104, 228); + this._cboProjectOrWebsite.Name = "_cboProjectOrWebsite"; + this._cboProjectOrWebsite.Size = new System.Drawing.Size(297, 21); + this._cboProjectOrWebsite.TabIndex = 17; + // + // _lblInstructions + // + this._lblInstructions.AutoSize = true; + this._lblInstructions.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblInstructions, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblInstructions, "Param 0: \"HearThis\" (product name)"); + this.l10NSharpExtender1.SetLocalizingId(this._lblInstructions, "GiveFeedbackDlg._lblInstructions"); + this._lblInstructions.Location = new System.Drawing.Point(102, 384); + this._lblInstructions.Margin = new System.Windows.Forms.Padding(1, 20, 3, 0); + this._lblInstructions.Name = "_lblInstructions"; + this._lblInstructions.Size = new System.Drawing.Size(526, 39); + this._lblInstructions.TabIndex = 18; + this._lblInstructions.Text = resources.GetString("_lblInstructions.Text"); + this._lblInstructions.Visible = false; + // + // _linkDonate + // + this._linkDonate.AutoSize = true; + this._linkDonate.LinkArea = new System.Windows.Forms.LinkArea(15, 15); + this.l10NSharpExtender1.SetLocalizableToolTip(this._linkDonate, null); + this.l10NSharpExtender1.SetLocalizationComment(this._linkDonate, "Put square brackets around the text that should appear as the hyperlink. The text" + + " in the brackets is localizable. However, note that the URL it will take the use" + + "r to is in English."); + this.l10NSharpExtender1.SetLocalizingId(this._linkDonate, "GiveFeedbackDlg._linkDonate"); + this._linkDonate.Location = new System.Drawing.Point(104, 433); + this._linkDonate.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0); + this._linkDonate.Name = "_linkDonate"; + this._linkDonate.Size = new System.Drawing.Size(164, 17); + this._linkDonate.TabIndex = 19; + this._linkDonate.TabStop = true; + this._linkDonate.Text = "Take me to the [donation page]."; + this._linkDonate.UseCompatibleTextRendering = true; + this._linkDonate.Visible = false; + // + // _btnCancel + // + this._btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.l10NSharpExtender1.SetLocalizableToolTip(this._btnCancel, null); + this.l10NSharpExtender1.SetLocalizationComment(this._btnCancel, null); + this.l10NSharpExtender1.SetLocalizingId(this._btnCancel, "Common.Cancel"); + this._btnCancel.Location = new System.Drawing.Point(580, 480); + this._btnCancel.Name = "_btnCancel"; + this._btnCancel.Size = new System.Drawing.Size(75, 23); + this._btnCancel.TabIndex = 6; + this._btnCancel.Text = "Cancel"; + this._btnCancel.UseVisualStyleBackColor = true; + // + // _lblAffects + // + this._lblAffects.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblAffects.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblAffects, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblAffects, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblAffects, "GiveFeedbackDlg._lblAffects"); + this._lblAffects.Location = new System.Drawing.Point(58, 198); + this._lblAffects.Name = "_lblAffects"; + this._lblAffects.Size = new System.Drawing.Size(40, 13); + this._lblAffects.TabIndex = 20; + this._lblAffects.Text = "Affects"; + this._lblAffects.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // _cboAffects + // + this._cboAffects.FormattingEnabled = true; + this._cboAffects.Items.AddRange(new object[] { + "Does not apply", + "Data sharing", + "Exporting", + "HearThis Android", + "Installation", + "Localization", + "Multiple areas", + "Navigation to desired book, chapter and block", + "Other", + "Playback", + "Project administration", + "Project selection", + "Recording", + "Settings", + "Website", + "Unknown"}); + this.l10NSharpExtender1.SetLocalizableToolTip(this._cboAffects, null); + this.l10NSharpExtender1.SetLocalizationComment(this._cboAffects, null); + this.l10NSharpExtender1.SetLocalizingId(this._cboAffects, "comboBox2"); + this._cboAffects.Location = new System.Drawing.Point(104, 201); + this._cboAffects.Name = "_cboAffects"; + this._cboAffects.Size = new System.Drawing.Size(297, 21); + this._cboAffects.TabIndex = 21; + // + // _lblWebsiteURL + // + this._lblWebsiteURL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._lblWebsiteURL.AutoSize = true; + this.l10NSharpExtender1.SetLocalizableToolTip(this._lblWebsiteURL, null); + this.l10NSharpExtender1.SetLocalizationComment(this._lblWebsiteURL, null); + this.l10NSharpExtender1.SetLocalizingId(this._lblWebsiteURL, "GiveFeedbackDlg._lblWebsiteURL"); + this._lblWebsiteURL.Location = new System.Drawing.Point(15, 252); + this._lblWebsiteURL.Name = "_lblWebsiteURL"; + this._lblWebsiteURL.Size = new System.Drawing.Size(83, 13); + this._lblWebsiteURL.TabIndex = 22; + this._lblWebsiteURL.Text = "URL of website:"; + this._lblWebsiteURL.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this._lblWebsiteURL.Visible = false; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this._linkCommunityHelp, 0, 0); + this.tableLayoutPanel1.Controls.Add(this._txtTitle, 1, 1); + this.tableLayoutPanel1.Controls.Add(this._lblTitle, 0, 1); + this.tableLayoutPanel1.Controls.Add(this._lblTypeOfFeedback, 0, 2); + this.tableLayoutPanel1.Controls.Add(this._lblPriorityOrSeverity, 0, 3); + this.tableLayoutPanel1.Controls.Add(this._cboTypeOfFeedback, 1, 2); + this.tableLayoutPanel1.Controls.Add(this._cboPriority, 1, 3); + this.tableLayoutPanel1.Controls.Add(this._lblDescription, 0, 4); + this.tableLayoutPanel1.Controls.Add(this._richTextBoxDescription, 1, 4); + this.tableLayoutPanel1.Controls.Add(this._lblProject, 0, 6); + this.tableLayoutPanel1.Controls.Add(this._chkIncludeScreenshot, 1, 8); + this.tableLayoutPanel1.Controls.Add(this._chkIncludeRecordingInfo, 1, 9); + this.tableLayoutPanel1.Controls.Add(this._chkIncludeLog, 1, 10); + this.tableLayoutPanel1.Controls.Add(this._txtProjectOrWebsite, 1, 7); + this.tableLayoutPanel1.Controls.Add(this._cboProjectOrWebsite, 1, 6); + this.tableLayoutPanel1.Controls.Add(this._lblInstructions, 1, 11); + this.tableLayoutPanel1.Controls.Add(this._linkDonate, 1, 12); + this.tableLayoutPanel1.Controls.Add(this._lblAffects, 0, 5); + this.tableLayoutPanel1.Controls.Add(this._cboAffects, 1, 5); + this.tableLayoutPanel1.Controls.Add(this._lblWebsiteURL, 0, 7); + this.tableLayoutPanel1.Location = new System.Drawing.Point(13, 12); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 13; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(645, 450); + this.tableLayoutPanel1.TabIndex = 5; + // + // _richTextBoxDescription + // + this._richTextBoxDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._richTextBoxDescription.Location = new System.Drawing.Point(104, 129); + this._richTextBoxDescription.Name = "_richTextBoxDescription"; + this._richTextBoxDescription.Size = new System.Drawing.Size(538, 66); + this._richTextBoxDescription.TabIndex = 12; + this._richTextBoxDescription.Text = ""; + // + // GiveFeedbackDlg + // + this.AcceptButton = this._btnOk; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._btnCancel; + this.ClientSize = new System.Drawing.Size(670, 515); + this.Controls.Add(this._btnCancel); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this._btnOk); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.l10NSharpExtender1.SetLocalizableToolTip(this, null); + this.l10NSharpExtender1.SetLocalizationComment(this, null); + this.l10NSharpExtender1.SetLocalizationPriority(this, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this, "ReportProblemDlg.WindowTitle"); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "GiveFeedbackDlg"; + this.Text = "Give Feedback"; + ((System.ComponentModel.ISupportInitialize)(this.l10NSharpExtender1)).EndInit(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button _btnOk; + private L10NSharp.UI.L10NSharpExtender l10NSharpExtender1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.CheckBox _chkIncludeScreenshot; + private System.Windows.Forms.LinkLabel _linkCommunityHelp; + private System.Windows.Forms.TextBox _txtTitle; + private System.Windows.Forms.Label _lblTitle; + private System.Windows.Forms.Label _lblTypeOfFeedback; + private System.Windows.Forms.Label _lblPriorityOrSeverity; + private System.Windows.Forms.ComboBox _cboTypeOfFeedback; + private System.Windows.Forms.ComboBox _cboPriority; + private System.Windows.Forms.Label _lblDescription; + private System.Windows.Forms.RichTextBox _richTextBoxDescription; + private System.Windows.Forms.Label _lblProject; + private System.Windows.Forms.CheckBox _chkIncludeRecordingInfo; + private System.Windows.Forms.CheckBox _chkIncludeLog; + private System.Windows.Forms.TextBox _txtProjectOrWebsite; + private System.Windows.Forms.ComboBox _cboProjectOrWebsite; + private System.Windows.Forms.Label _lblInstructions; + private System.Windows.Forms.LinkLabel _linkDonate; + private System.Windows.Forms.Button _btnCancel; + private System.Windows.Forms.Label _lblAffects; + private System.Windows.Forms.ComboBox _cboAffects; + private System.Windows.Forms.Label _lblWebsiteURL; + } +} diff --git a/src/HearThis/UI/GiveFeedbackDlg.cs b/src/HearThis/UI/GiveFeedbackDlg.cs new file mode 100644 index 00000000..43aba540 --- /dev/null +++ b/src/HearThis/UI/GiveFeedbackDlg.cs @@ -0,0 +1,181 @@ +// -------------------------------------------------------------------------------------------- +#region // Copyright (c) 2021, SIL International. All Rights Reserved. +// +// Copyright (c) 2021, SIL International. All Rights Reserved. +// +// Distributable under the terms of the MIT License (https://sil.mit-license.org/) +// +#endregion +// -------------------------------------------------------------------------------------------- +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Windows.Forms; +using L10NSharp; + +namespace HearThis.UI +{ + /// + /// This allows users a way to report a bug or give other feedback regarding HearThis. + /// + public partial class GiveFeedbackDlg : Form, ILocalizable + { + private readonly GiveFeedbackViewModel _model; + + public enum PriorityOrSeverity + { + LostData = 0, + NotAbleToCompleteTask = 1, + CompletedTaskWithDifficulty = 2, + Minor = 3, + NotApplicable, + } + + public enum AffectedArea + { + NotApplicable, // Not available for some types of Feedback + Exporting, + Installation, + Localization, + MultipleAreas, + Navigation, + Other, + Playback, + ProjectAdministration, + ProjectSelection, + Recording, + Settings, + Website, + Unknown, + } + + public GiveFeedbackDlg(GiveFeedbackViewModel model) + { + _model = model; + InitializeComponent(); + _linkCommunityHelp.Links[0].LinkData = new Action(() => _model.GoToCommunitySite()); + _linkDonate.Links[0].LinkData = new Action(OpenDonationPage); + + Program.RegisterLocalizable(this); + HandleStringsLocalized(); + } + + #region Properties + public string Title => _txtTitle.Text; + + public TypeOfFeedback FeedbackType => _model.Type; + + public PriorityOrSeverity Priority => PriorityIsRelevant ? + (PriorityOrSeverity)_cboPriority.SelectedIndex : PriorityOrSeverity.NotApplicable; + + public string Description => _richTextBoxDescription.Text; + + public AffectedArea AffectedPartOfProgram => (AffectedArea) + (_cboAffects.SelectedIndex + (FeedbackType == TypeOfFeedback.Appreciation ? 0 : 1)); + + private bool PriorityIsRelevant + { + get => _cboPriority.Visible; + set => _cboPriority.Visible = _lblPriorityOrSeverity.Visible = value; + } + #endregion + + #region Evemnt handlers + public void HandleStringsLocalized() + { + _lblPriorityOrSeverity.Tag = _lblPriorityOrSeverity.Text; + _cboPriority.Tag = new List(from object item in _cboPriority.Items select item.ToString()); + _cboAffects.Tag = _cboAffects.Items[0].ToString(); + _linkCommunityHelp.SetLinkRegions(); + _linkDonate.SetLinkRegions(); + } + + private void LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + ((Action)e.Link.LinkData).Invoke(); + } + + private void UpdateOkButtonState(object sender, EventArgs e) + { + + } + + private void _cboTypeOfFeedback_SelectedIndexChanged(object sender, EventArgs e) + { + _model.Type = (TypeOfFeedback)_cboTypeOfFeedback.SelectedIndex; + _cboPriority.Items.Clear(); + if (!(_cboPriority.Tag is List severityList) || severityList.Count != 4) + throw new ApplicationException("_cboPriority.Tag not set properly in HandleStringsLocalized"); + if (!(_cboAffects.Tag is string notApplicableItem)) + throw new ApplicationException("_cboAffects.Tag not set properly in HandleStringsLocalized"); + + switch (FeedbackType) + { + case TypeOfFeedback.Problem: + _lblPriorityOrSeverity.Text = _lblPriorityOrSeverity.Tag as string; + PriorityIsRelevant = true; + RemoveNotApplicableItemFromAffectsCombo(); + foreach (var item in severityList) + _cboPriority.Items.Add(item); + break; + + case TypeOfFeedback.Suggestion: + _lblPriorityOrSeverity.Text = LocalizationManager.GetString("GiveFeedbackDlg._lblPriorityOrSeverity.SuggestionText", + "Priority"); + PriorityIsRelevant = true; + RemoveNotApplicableItemFromAffectsCombo(); + _cboPriority.Items.Add(severityList[(int)PriorityOrSeverity.NotAbleToCompleteTask]); + _cboPriority.Items.Add(severityList[(int)PriorityOrSeverity.CompletedTaskWithDifficulty]); + _cboPriority.Items.Add(LocalizationManager.GetString("GiveFeedbackDlg._cboPriority.MinorEnhancement", + "Idea for a minor enhancement")); + break; + + case TypeOfFeedback.Appreciation: + if (_cboAffects.Items.Count == (int)AffectedArea.Unknown) + _cboAffects.Items.Insert(0, notApplicableItem); + PriorityIsRelevant = false; + break; + + case TypeOfFeedback.Donate: + PriorityIsRelevant = false; + _lblDescription.Visible = false; + _richTextBoxDescription.Visible = false; + _lblAffects.Visible = false; + _cboAffects.Visible = false; + _lblProject.Visible = false; + _cboProjectOrWebsite.Visible = false; + _linkDonate.Visible = true; + return; + default: + throw new IndexOutOfRangeException("Unexpected type of feedback."); + } + } + + private void _btnOk_Click(object sender, EventArgs e) + { + if (FeedbackType == TypeOfFeedback.Donate) + { + var msg = LocalizationManager.GetString("GiveFeedbackDlg.DonationConfirmation", + "Visit donation page now?"); + if (MessageBox.Show(msg, ProductName, MessageBoxButtons.YesNo) == DialogResult.No) + DialogResult = DialogResult.Cancel; + } + } + #endregion + + #region private helper methods + private void RemoveNotApplicableItemFromAffectsCombo() + { + if (_cboAffects.Items.Count > (int)AffectedArea.Unknown) + _cboAffects.Items.RemoveAt(0); + } + + private void OpenDonationPage() + { + DialogResult = DialogResult.OK; + Close(); + } + #endregion + } +} diff --git a/src/HearThis/UI/GiveFeedbackDlg.resx b/src/HearThis/UI/GiveFeedbackDlg.resx new file mode 100644 index 00000000..2fc30c9b --- /dev/null +++ b/src/HearThis/UI/GiveFeedbackDlg.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + Use this form to give feedback to the {0} development team about the program. You can use it to report a problem you have encountered or to make a suggestion for an improvement. In addition to the description that you provide, the report will automatically include details about the version of {0}. + + + 42 + + \ No newline at end of file diff --git a/src/HearThis/UI/Shell.Designer.cs b/src/HearThis/UI/Shell.Designer.cs index e795f409..994bbddf 100644 --- a/src/HearThis/UI/Shell.Designer.cs +++ b/src/HearThis/UI/Shell.Designer.cs @@ -53,6 +53,7 @@ private void InitializeComponent() this._saveHearthisPackItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); this.supportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.giveFeedbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this._aboutHearThisItem = new System.Windows.Forms.ToolStripMenuItem(); this.readAndRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -129,7 +130,7 @@ private void InitializeComponent() this.l10NSharpExtender1.SetLocalizableToolTip(this._btnMode, null); this.l10NSharpExtender1.SetLocalizationComment(this._btnMode, null); this.l10NSharpExtender1.SetLocalizationPriority(this._btnMode, L10NSharp.LocalizationPriority.NotLocalizable); - this.l10NSharpExtender1.SetLocalizingId(this._btnMode, "Shell.Shell._btnMode"); + this.l10NSharpExtender1.SetLocalizingId(this._btnMode, "Shell._btnMode"); this._btnMode.Name = "_btnMode"; this._btnMode.Size = new System.Drawing.Size(97, 20); this._btnMode.Text = "Administrative"; @@ -175,6 +176,7 @@ private void InitializeComponent() this._saveHearthisPackItem, this.toolStripMenuItem4, this.supportToolStripMenuItem, + this.giveFeedbackToolStripMenuItem, this.toolStripSeparator1, this._aboutHearThisItem}); this._moreMenu.ForeColor = System.Drawing.Color.DarkGray; @@ -261,12 +263,23 @@ private void InitializeComponent() // this.l10NSharpExtender1.SetLocalizableToolTip(this.supportToolStripMenuItem, null); this.l10NSharpExtender1.SetLocalizationComment(this.supportToolStripMenuItem, null); - this.l10NSharpExtender1.SetLocalizingId(this.supportToolStripMenuItem, "Shell.Shell.SupportMenuItem"); + this.l10NSharpExtender1.SetLocalizingId(this.supportToolStripMenuItem, "Shell.SupportMenuItem"); this.supportToolStripMenuItem.Name = "supportToolStripMenuItem"; this.supportToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.supportToolStripMenuItem.Text = "Support..."; this.supportToolStripMenuItem.Click += new System.EventHandler(this.supportToolStripMenuItem_Click); // + // giveFeedbackToolStripMenuItem + // + this.l10NSharpExtender1.SetLocalizableToolTip(this.giveFeedbackToolStripMenuItem, "Report a bug or suggest an improvement to HearThis"); + this.l10NSharpExtender1.SetLocalizationComment(this.giveFeedbackToolStripMenuItem, null); + this.l10NSharpExtender1.SetLocalizationPriority(this.giveFeedbackToolStripMenuItem, L10NSharp.LocalizationPriority.NotLocalizable); + this.l10NSharpExtender1.SetLocalizingId(this.giveFeedbackToolStripMenuItem, "Shell.GiveFeedbackMenuItem"); + this.giveFeedbackToolStripMenuItem.Name = "giveFeedbackToolStripMenuItem"; + this.giveFeedbackToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.giveFeedbackToolStripMenuItem.Text = "Give Feedback..."; + this.giveFeedbackToolStripMenuItem.Click += new System.EventHandler(this.giveFeedbackToolStripMenuItem_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.BackColor = System.Drawing.Color.DarkRed; @@ -464,6 +477,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.Panel _multiVoiceMarginPanel; private System.Windows.Forms.ToolStripMenuItem checkForProblemsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem giveFeedbackToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem readAndRecordToolStripMenuItem; } } diff --git a/src/HearThis/UI/Shell.cs b/src/HearThis/UI/Shell.cs index 34f98baf..de1f3079 100644 --- a/src/HearThis/UI/Shell.cs +++ b/src/HearThis/UI/Shell.cs @@ -28,6 +28,7 @@ using SIL.Windows.Forms.ReleaseNotes; using Paratext.Data; using SIL.DblBundle.Text; +using SIL.Email; using SIL.Reporting; using SIL.Windows.Forms.Extensions; using static System.String; @@ -1019,7 +1020,34 @@ private void _mergeHearThisPackItem_Click(object sender, EventArgs e) progressDlg.SetDone(); } } - + + private void giveFeedbackToolStripMenuItem_Click(object sender, EventArgs e) + { + var model = new GiveFeedbackViewModel(this, Project.PathToLastClipRecorded); + using (var dlg = new GiveFeedbackDlg(model)) + { + if (dlg.ShowDialog(this) == DialogResult.OK) + { + model.IssueFeedback(); + + try + { + var emailProvider = EmailProviderFactory.PreferredEmailProvider(); + var emailMessage = emailProvider.CreateMessage(); + emailMessage.To.Add(ErrorReport.EmailAddress); + emailMessage.Subject = dlg.Title; + emailMessage.Body = "TODO: Complete this"; + if (emailMessage.Send(emailProvider)) + Close(); + } + catch (Exception) + { + //swallow it and go to the alternate method + } + } + } + } + private void MenuDropDownOpening(object sender, EventArgs e) { var menuItem = sender as ToolStripDropDownButton; diff --git a/src/HearThisTests/HearThisTests.csproj b/src/HearThisTests/HearThisTests.csproj index 7a582339..c611a878 100644 --- a/src/HearThisTests/HearThisTests.csproj +++ b/src/HearThisTests/HearThisTests.csproj @@ -10,7 +10,7 @@ Properties HearThisTests HearThisTests - NET472 + net472 false 512