From dccfdb0ab1c9d96d7ea1ff3e5624f40d87fc5d80 Mon Sep 17 00:00:00 2001 From: Vitalii Ganzha Date: Wed, 30 Dec 2015 23:36:25 -0800 Subject: [PATCH] Skeleton for custom options page --- .../SoundSelectControl.Designer.cs | 72 ++++++++++ VsDingExtensionProject/SoundSelectControl.cs | 22 ++++ .../SoundSelectControl.resx | 120 +++++++++++++++++ .../SoundsSelectOptionsPage.cs | 78 +++++++++++ .../SoundsSelectOptionsPage.resx | 123 ++++++++++++++++++ .../VsDingExtensionProject.csproj | 15 +++ .../VsDingExtensionProjectPackage.cs | 3 +- 7 files changed, 432 insertions(+), 1 deletion(-) create mode 100644 VsDingExtensionProject/SoundSelectControl.Designer.cs create mode 100644 VsDingExtensionProject/SoundSelectControl.cs create mode 100644 VsDingExtensionProject/SoundSelectControl.resx create mode 100644 VsDingExtensionProject/SoundsSelectOptionsPage.cs create mode 100644 VsDingExtensionProject/SoundsSelectOptionsPage.resx diff --git a/VsDingExtensionProject/SoundSelectControl.Designer.cs b/VsDingExtensionProject/SoundSelectControl.Designer.cs new file mode 100644 index 0000000..97a6f67 --- /dev/null +++ b/VsDingExtensionProject/SoundSelectControl.Designer.cs @@ -0,0 +1,72 @@ +namespace VitaliiGanzha.VsDingExtension +{ + partial class SoundSelectControl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Location = new System.Drawing.Point(42, 45); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(80, 17); + this.checkBox1.TabIndex = 0; + this.checkBox1.Text = "checkBox1"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(24, 106); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(80, 17); + this.checkBox2.TabIndex = 1; + this.checkBox2.Text = "checkBox2"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // SoundSelectControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.checkBox2); + this.Controls.Add(this.checkBox1); + this.Name = "SoundSelectControl"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox checkBox2; + } +} diff --git a/VsDingExtensionProject/SoundSelectControl.cs b/VsDingExtensionProject/SoundSelectControl.cs new file mode 100644 index 0000000..36a62d9 --- /dev/null +++ b/VsDingExtensionProject/SoundSelectControl.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace VitaliiGanzha.VsDingExtension +{ + public partial class SoundSelectControl : UserControl + { + internal SoundsSelectOptionsPage optionsPage; + + public SoundSelectControl() + { + InitializeComponent(); + } + } +} diff --git a/VsDingExtensionProject/SoundSelectControl.resx b/VsDingExtensionProject/SoundSelectControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/VsDingExtensionProject/SoundSelectControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/VsDingExtensionProject/SoundsSelectOptionsPage.cs b/VsDingExtensionProject/SoundsSelectOptionsPage.cs new file mode 100644 index 0000000..4730e39 --- /dev/null +++ b/VsDingExtensionProject/SoundsSelectOptionsPage.cs @@ -0,0 +1,78 @@ +using Microsoft.VisualStudio.Shell; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace VitaliiGanzha.VsDingExtension +{ + [Guid("1735471A-D4F2-4385-8AF8-5E9E98409A9C")] + public class SoundsSelectOptionsPage : DialogPage + { + #region Fields + + private SoundSelectControl optionsControl; + + #endregion Fields + + #region Properties + + /// + /// Gets the window an instance of DialogPage that it uses as its user interface. + /// + /// + /// The window this dialog page will use for its UI. + /// This window handle must be constant, so if you are + /// returning a Windows Forms control you must make sure + /// it does not recreate its handle. If the window object + /// implements IComponent it will be sited by the + /// dialog page so it can get access to global services. + /// + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + protected override IWin32Window Window + { + get + { + if (optionsControl == null) + { + optionsControl = new SoundSelectControl(); + optionsControl.Location = new Point(0, 0); + optionsControl.optionsPage = this; + } + return optionsControl; + } + } + + /// + /// Gets or sets the path to the image file. + /// + /// The property that needs to be persisted. + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] + public string CustomBitmap { get; set; } + + #endregion Properties + + #region Methods + + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (optionsControl != null) + { + optionsControl.Dispose(); + optionsControl = null; + } + } + base.Dispose(disposing); + } + + #endregion Methods + + private void InitializeComponent() + { + + } + } +} diff --git a/VsDingExtensionProject/SoundsSelectOptionsPage.resx b/VsDingExtensionProject/SoundsSelectOptionsPage.resx new file mode 100644 index 0000000..e5858cc --- /dev/null +++ b/VsDingExtensionProject/SoundsSelectOptionsPage.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + False + + \ No newline at end of file diff --git a/VsDingExtensionProject/VsDingExtensionProject.csproj b/VsDingExtensionProject/VsDingExtensionProject.csproj index 56553e1..768f05d 100644 --- a/VsDingExtensionProject/VsDingExtensionProject.csproj +++ b/VsDingExtensionProject/VsDingExtensionProject.csproj @@ -169,6 +169,15 @@ Resources.resx + + UserControl + + + SoundSelectControl.cs + + + Component + @@ -179,6 +188,12 @@ Resources.Designer.cs Designer + + SoundSelectControl.cs + + + SoundsSelectOptionsPage.cs + true VSPackage diff --git a/VsDingExtensionProject/VsDingExtensionProjectPackage.cs b/VsDingExtensionProject/VsDingExtensionProjectPackage.cs index 2daf3e7..7f22586 100644 --- a/VsDingExtensionProject/VsDingExtensionProjectPackage.cs +++ b/VsDingExtensionProject/VsDingExtensionProjectPackage.cs @@ -23,7 +23,8 @@ [InstalledProductRegistration("#110", "#112", "1.1", IconResourceID = 400)] [Guid(GuidList.guidVsDingExtensionProjectPkgString)] [ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")] - [ProvideOptionPage(typeof(OptionsDialog), "Ding", "Options", 0, 0, true)] + [ProvideOptionPage(typeof(OptionsDialog), "Ding", "General settings", 0, 0, true)] + [ProvideOptionPage(typeof(SoundsSelectOptionsPage), "Ding", "Overrride sounds", 100, 102, true, new string[] { "Change custom sounds" })] public sealed class VsDingExtensionProjectPackage : Package, IDisposable { private DTE2 applicationObject;