From 15d479c92a1dda427c8d8c976210f43096e1962a Mon Sep 17 00:00:00 2001 From: Christian Soltenborn Date: Sat, 13 Apr 2019 10:46:18 +0200 Subject: [PATCH] changed donations request --- .../GoogleTestExtensionOptionsPage.cs | 2 - .../VsPackage.GTA/ReleaseNotes/Donations.cs | 13 -- .../ReleaseNotes/ReleaseNotesCreator.cs | 5 +- .../ReleaseNotesDialog.Designer.cs | 147 +++++++++--------- .../ReleaseNotes/ReleaseNotesDialog.cs | 15 +- .../VsPackage.GTA/VsPackage.GTA.csproj | 1 - 6 files changed, 81 insertions(+), 102 deletions(-) delete mode 100644 GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/Donations.cs diff --git a/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs b/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs index 49cfe09bf..cff4e760c 100644 --- a/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs +++ b/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs @@ -5,7 +5,6 @@ using System.IO; using System.Threading; using GoogleTestAdapter.Common; -using GoogleTestAdapter.VsPackage.GTA.ReleaseNotes; using GoogleTestAdapter.VsPackage.Helpers; namespace GoogleTestAdapter.VsPackage @@ -71,7 +70,6 @@ private void DisplayReleaseNotes(string html) HtmlFile = new Uri($"file://{htmlFile}") }) { - dialog.AddExternalUri(Donations.Uri); dialog.Closed += (sender, args) => File.Delete(htmlFile); dialog.ShowDialog(); } diff --git a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/Donations.cs b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/Donations.cs deleted file mode 100644 index be73ccb70..000000000 --- a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/Donations.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace GoogleTestAdapter.VsPackage.GTA.ReleaseNotes -{ - public static class Donations - { - public static readonly Uri Uri = new Uri("https://github.com/csoltenborn/GoogleTestAdapter#donations"); - - public static readonly string Header = $@"
Please consider to donate!
-
-"; - } -} \ No newline at end of file diff --git a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesCreator.cs b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesCreator.cs index 975e055d9..68716f220 100644 --- a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesCreator.cs +++ b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesCreator.cs @@ -1,7 +1,6 @@ using System; using System.IO; using CommonMark; -using GoogleTestAdapter.VsPackage.GTA.ReleaseNotes; namespace GoogleTestAdapter.VsPackage.ReleaseNotes { @@ -23,9 +22,7 @@ private string CreateMarkdown() if (_formerlyInstalledVersion == _currentVersion) return ""; - string releaseNotes = Donations.Header; - - releaseNotes += Environment.NewLine + CreateHeader(); + string releaseNotes = CreateHeader(); int startIndex = Array.IndexOf(Versions, _currentVersion); int endIndex = _formerlyInstalledVersion == null ? -1 : Array.IndexOf(Versions, _formerlyInstalledVersion); diff --git a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.Designer.cs b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.Designer.cs index dbc873a98..9cb54a4e5 100644 --- a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.Designer.cs +++ b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.Designer.cs @@ -1,11 +1,16 @@ -namespace GoogleTestAdapter.VsPackage.ReleaseNotes +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace GoogleTestAdapter.VsPackage.ReleaseNotes { partial class ReleaseNotesDialog { /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private IContainer components = null; /// /// Clean up any resources being used. @@ -28,17 +33,17 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReleaseNotesDialog)); - this.RootPanel = new System.Windows.Forms.TableLayoutPanel(); - this.NavigationPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.BackButton = new System.Windows.Forms.Button(); - this.ForwardButton = new System.Windows.Forms.Button(); - this.WebBrowser = new System.Windows.Forms.WebBrowser(); - this.OkButtonPanel = new System.Windows.Forms.TableLayoutPanel(); - this.DonateButton = new System.Windows.Forms.Button(); - this.OkButton = new System.Windows.Forms.Button(); - this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.components = new Container(); + ComponentResourceManager resources = new ComponentResourceManager(typeof(ReleaseNotesDialog)); + this.RootPanel = new TableLayoutPanel(); + this.NavigationPanel = new FlowLayoutPanel(); + this.BackButton = new Button(); + this.ForwardButton = new Button(); + this.WebBrowser = new WebBrowser(); + this.OkButtonPanel = new TableLayoutPanel(); + this.DonateButton = new Button(); + this.OkButton = new Button(); + this.toolTip = new ToolTip(this.components); this.RootPanel.SuspendLayout(); this.NavigationPanel.SuspendLayout(); this.OkButtonPanel.SuspendLayout(); @@ -47,21 +52,21 @@ private void InitializeComponent() // RootPanel // this.RootPanel.ColumnCount = 2; - this.RootPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.RootPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.RootPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + this.RootPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); this.RootPanel.Controls.Add(this.NavigationPanel, 0, 0); this.RootPanel.Controls.Add(this.WebBrowser, 0, 1); this.RootPanel.Controls.Add(this.OkButtonPanel, 0, 2); - this.RootPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.RootPanel.Location = new System.Drawing.Point(0, 0); - this.RootPanel.Margin = new System.Windows.Forms.Padding(7); + this.RootPanel.Dock = DockStyle.Fill; + this.RootPanel.Location = new Point(0, 0); + this.RootPanel.Margin = new Padding(7); this.RootPanel.Name = "RootPanel"; this.RootPanel.RowCount = 3; - this.RootPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.RootPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.RootPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.RootPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); - this.RootPanel.Size = new System.Drawing.Size(1829, 1251); + this.RootPanel.RowStyles.Add(new RowStyle()); + this.RootPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + this.RootPanel.RowStyles.Add(new RowStyle()); + this.RootPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); + this.RootPanel.Size = new Size(1829, 1251); this.RootPanel.TabIndex = 0; // // NavigationPanel @@ -70,21 +75,21 @@ private void InitializeComponent() this.RootPanel.SetColumnSpan(this.NavigationPanel, 2); this.NavigationPanel.Controls.Add(this.BackButton); this.NavigationPanel.Controls.Add(this.ForwardButton); - this.NavigationPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.NavigationPanel.Location = new System.Drawing.Point(7, 7); - this.NavigationPanel.Margin = new System.Windows.Forms.Padding(7); + this.NavigationPanel.Dock = DockStyle.Fill; + this.NavigationPanel.Location = new Point(7, 7); + this.NavigationPanel.Margin = new Padding(7); this.NavigationPanel.Name = "NavigationPanel"; - this.NavigationPanel.Size = new System.Drawing.Size(1815, 65); + this.NavigationPanel.Size = new Size(1815, 65); this.NavigationPanel.TabIndex = 3; // // BackButton // this.BackButton.AccessibleName = "Go back"; this.BackButton.Enabled = false; - this.BackButton.Location = new System.Drawing.Point(7, 7); - this.BackButton.Margin = new System.Windows.Forms.Padding(7); + this.BackButton.Location = new Point(7, 7); + this.BackButton.Margin = new Padding(7); this.BackButton.Name = "BackButton"; - this.BackButton.Size = new System.Drawing.Size(54, 51); + this.BackButton.Size = new Size(54, 51); this.BackButton.TabIndex = 3; this.BackButton.Text = "<"; this.BackButton.UseVisualStyleBackColor = true; @@ -93,10 +98,10 @@ private void InitializeComponent() // this.ForwardButton.AccessibleName = "Go forward"; this.ForwardButton.Enabled = false; - this.ForwardButton.Location = new System.Drawing.Point(75, 7); - this.ForwardButton.Margin = new System.Windows.Forms.Padding(7); + this.ForwardButton.Location = new Point(75, 7); + this.ForwardButton.Margin = new Padding(7); this.ForwardButton.Name = "ForwardButton"; - this.ForwardButton.Size = new System.Drawing.Size(54, 51); + this.ForwardButton.Size = new Size(54, 51); this.ForwardButton.TabIndex = 4; this.ForwardButton.Text = ">"; this.ForwardButton.UseVisualStyleBackColor = true; @@ -106,44 +111,44 @@ private void InitializeComponent() this.WebBrowser.AccessibleName = "Browser"; this.WebBrowser.AllowWebBrowserDrop = false; this.RootPanel.SetColumnSpan(this.WebBrowser, 2); - this.WebBrowser.Dock = System.Windows.Forms.DockStyle.Fill; + this.WebBrowser.Dock = DockStyle.Fill; this.WebBrowser.IsWebBrowserContextMenuEnabled = false; - this.WebBrowser.Location = new System.Drawing.Point(7, 86); - this.WebBrowser.Margin = new System.Windows.Forms.Padding(7); - this.WebBrowser.MinimumSize = new System.Drawing.Size(47, 45); + this.WebBrowser.Location = new Point(7, 86); + this.WebBrowser.Margin = new Padding(7); + this.WebBrowser.MinimumSize = new Size(47, 45); this.WebBrowser.Name = "WebBrowser"; this.WebBrowser.ScriptErrorsSuppressed = true; - this.WebBrowser.Size = new System.Drawing.Size(1815, 1079); + this.WebBrowser.Size = new Size(1815, 1079); this.WebBrowser.TabIndex = 2; this.WebBrowser.WebBrowserShortcutsEnabled = false; - this.WebBrowser.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.WebBrowser_Navigating); + this.WebBrowser.Navigating += new WebBrowserNavigatingEventHandler(this.WebBrowser_Navigating); // // OkButtonPanel // - this.OkButtonPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.OkButtonPanel.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); this.OkButtonPanel.AutoSize = true; this.OkButtonPanel.ColumnCount = 2; this.RootPanel.SetColumnSpan(this.OkButtonPanel, 2); - this.OkButtonPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.OkButtonPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.OkButtonPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); + this.OkButtonPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); this.OkButtonPanel.Controls.Add(this.DonateButton, 0, 0); this.OkButtonPanel.Controls.Add(this.OkButton, 1, 0); - this.OkButtonPanel.Location = new System.Drawing.Point(7, 1179); - this.OkButtonPanel.Margin = new System.Windows.Forms.Padding(7); + this.OkButtonPanel.Location = new Point(7, 1179); + this.OkButtonPanel.Margin = new Padding(7); this.OkButtonPanel.Name = "OkButtonPanel"; this.OkButtonPanel.RowCount = 1; - this.OkButtonPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.OkButtonPanel.Size = new System.Drawing.Size(1815, 65); + this.OkButtonPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + this.OkButtonPanel.Size = new Size(1815, 65); this.OkButtonPanel.TabIndex = 4; // // DonateButton // this.DonateButton.AccessibleName = "Close release notes dialog"; - this.DonateButton.Anchor = System.Windows.Forms.AnchorStyles.None; - this.DonateButton.Location = new System.Drawing.Point(303, 7); - this.DonateButton.Margin = new System.Windows.Forms.Padding(7); + this.DonateButton.Anchor = AnchorStyles.None; + this.DonateButton.Location = new Point(303, 7); + this.DonateButton.Margin = new Padding(7); this.DonateButton.Name = "DonateButton"; - this.DonateButton.Size = new System.Drawing.Size(301, 51); + this.DonateButton.Size = new Size(301, 51); this.DonateButton.TabIndex = 0; this.DonateButton.Text = "Cool - I want to donate!"; this.DonateButton.UseVisualStyleBackColor = true; @@ -151,30 +156,30 @@ private void InitializeComponent() // OkButton // this.OkButton.AccessibleName = "Close release notes dialog"; - this.OkButton.Anchor = System.Windows.Forms.AnchorStyles.None; - this.OkButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.OkButton.Location = new System.Drawing.Point(1273, 7); - this.OkButton.Margin = new System.Windows.Forms.Padding(7); + this.OkButton.Anchor = AnchorStyles.None; + this.OkButton.DialogResult = DialogResult.Cancel; + this.OkButton.Location = new Point(1273, 7); + this.OkButton.Margin = new Padding(7); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(175, 51); + this.OkButton.Size = new Size(175, 51); this.OkButton.TabIndex = 1; - this.OkButton.Text = "Whatever..."; + this.OkButton.Text = "Thanks anyways..."; this.OkButton.UseVisualStyleBackColor = true; // // ReleaseNotesDialog // this.AcceptButton = this.OkButton; this.AccessibleName = "Release notes of Google Test Adapter"; - this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new SizeF(14F, 29F); + this.AutoScaleMode = AutoScaleMode.Font; this.CancelButton = this.OkButton; this.CausesValidation = false; - this.ClientSize = new System.Drawing.Size(1829, 1251); + this.ClientSize = new Size(1829, 1251); this.Controls.Add(this.RootPanel); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(7); + this.Icon = ((Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new Padding(7); this.Name = "ReleaseNotesDialog"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.StartPosition = FormStartPosition.CenterParent; this.Text = "Google Test Adapter: Release notes"; this.RootPanel.ResumeLayout(false); this.RootPanel.PerformLayout(); @@ -186,14 +191,14 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.TableLayoutPanel RootPanel; - private System.Windows.Forms.WebBrowser WebBrowser; - private System.Windows.Forms.Button OkButton; - private System.Windows.Forms.FlowLayoutPanel NavigationPanel; - private System.Windows.Forms.Button BackButton; - private System.Windows.Forms.Button ForwardButton; - private System.Windows.Forms.TableLayoutPanel OkButtonPanel; - private System.Windows.Forms.ToolTip toolTip; - private System.Windows.Forms.Button DonateButton; + private TableLayoutPanel RootPanel; + private WebBrowser WebBrowser; + private Button OkButton; + private FlowLayoutPanel NavigationPanel; + private Button BackButton; + private Button ForwardButton; + private TableLayoutPanel OkButtonPanel; + private ToolTip toolTip; + private Button DonateButton; } } \ No newline at end of file diff --git a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.cs b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.cs index 99717e602..b3fc02cfa 100644 --- a/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.cs +++ b/GoogleTestAdapter/VsPackage.GTA/ReleaseNotes/ReleaseNotesDialog.cs @@ -1,20 +1,18 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; -using GoogleTestAdapter.VsPackage.GTA.ReleaseNotes; namespace GoogleTestAdapter.VsPackage.ReleaseNotes { public partial class ReleaseNotesDialog : Form { - private readonly ISet _externalUris = new HashSet(); + private static readonly Uri DonationsUri = new Uri("https://github.com/csoltenborn/GoogleTestAdapter#donations"); public ReleaseNotesDialog() { InitializeComponent(); - Load += (sender, args) => DonateButton.Select(); + Load += (sender, args) => OkButton.Select(); WebBrowser.CanGoBackChanged += (sender, args) => BackButton.Enabled = WebBrowser.CanGoBack; BackButton.Click += (sender, args) => WebBrowser.GoBack(); @@ -25,7 +23,7 @@ public ReleaseNotesDialog() OkButton.Click += (sender, args) => Close(); DonateButton.Click += (sender, args) => { - OpenUriInDefaultBrowser(Donations.Uri); + OpenUriInDefaultBrowser(DonationsUri); Close(); }; } @@ -36,14 +34,9 @@ internal Uri HtmlFile set => WebBrowser.Url = value; } - internal void AddExternalUri(Uri externalUri) - { - _externalUris.Add(externalUri); - } - private void WebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { - if (_externalUris.Contains(e.Url)) + if (DonationsUri.Equals(e.Url)) { e.Cancel = true; OpenUriInDefaultBrowser(e.Url); diff --git a/GoogleTestAdapter/VsPackage.GTA/VsPackage.GTA.csproj b/GoogleTestAdapter/VsPackage.GTA/VsPackage.GTA.csproj index d023155e9..c41375c23 100644 --- a/GoogleTestAdapter/VsPackage.GTA/VsPackage.GTA.csproj +++ b/GoogleTestAdapter/VsPackage.GTA/VsPackage.GTA.csproj @@ -74,7 +74,6 @@ - Form