diff --git a/BrowserSelect/BrowserSelect.csproj b/BrowserSelect/BrowserSelect.csproj index 70f019a..b9cb46d 100644 --- a/BrowserSelect/BrowserSelect.csproj +++ b/BrowserSelect/BrowserSelect.csproj @@ -66,6 +66,12 @@ frm_About.cs + + Form + + + frm_settings.cs + @@ -81,6 +87,9 @@ frm_About.cs + + frm_settings.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/BrowserSelect/Form1.cs b/BrowserSelect/Form1.cs index d27074a..4255523 100644 --- a/BrowserSelect/Form1.cs +++ b/BrowserSelect/Form1.cs @@ -36,8 +36,7 @@ private void Form1_Load(object sender, EventArgs e) { } private void show_setting(object sender, EventArgs e) { - MessageBox.Show("I failed to come up with anything to be configured.\n" + - "The program is pretty straightforward , please submit an issue if you think something should be here."); + new frm_settings().ShowDialog(); } private void show_about(object sender, EventArgs e) { diff --git a/BrowserSelect/Properties/AssemblyInfo.cs b/BrowserSelect/Properties/AssemblyInfo.cs index 8335e93..09fccea 100644 --- a/BrowserSelect/Properties/AssemblyInfo.cs +++ b/BrowserSelect/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BrowserSelect")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] diff --git a/BrowserSelect/frm_settings.Designer.cs b/BrowserSelect/frm_settings.Designer.cs new file mode 100644 index 0000000..d2eb38c --- /dev/null +++ b/BrowserSelect/frm_settings.Designer.cs @@ -0,0 +1,81 @@ +namespace BrowserSelect { + partial class frm_settings { + /// + /// 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.btn_setdefault = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // btn_setdefault + // + this.btn_setdefault.Location = new System.Drawing.Point(12, 104); + this.btn_setdefault.Name = "btn_setdefault"; + this.btn_setdefault.Size = new System.Drawing.Size(137, 23); + this.btn_setdefault.TabIndex = 0; + this.btn_setdefault.Text = "Set as Default Browser"; + this.btn_setdefault.UseVisualStyleBackColor = true; + this.btn_setdefault.Click += new System.EventHandler(this.btn_setdefault_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(9, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(140, 92); + this.label1.TabIndex = 1; + this.label1.Text = "This is for windows 7 , windows 8 and newer detect this program automatically and" + + " prompt for default browser on first url opened after installation."; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(9, 141); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(140, 80); + this.label2.TabIndex = 2; + this.label2.Text = "If you think there should be any other options here that is missing please submit" + + " an issue on the github page and i\'ll see if i can add it."; + // + // frm_settings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(161, 222); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.btn_setdefault); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "frm_settings"; + this.Text = "Settings"; + this.Load += new System.EventHandler(this.frm_settings_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button btn_setdefault; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/BrowserSelect/frm_settings.cs b/BrowserSelect/frm_settings.cs new file mode 100644 index 0000000..9db90e8 --- /dev/null +++ b/BrowserSelect/frm_settings.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Microsoft.Win32; + +namespace BrowserSelect { + public partial class frm_settings : Form { + public frm_settings() { + InitializeComponent(); + } + + private void frm_settings_Load(object sender, EventArgs e) { + using (RegistryKey key = Registry.CurrentUser.OpenSubKey( + @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice")) { + var default_browser = key.GetValue("ProgId"); + + //disable the set default if already default + if (default_browser != null && (string)default_browser == "bselectURL") + btn_setdefault.Enabled = false; + } + } + + private void btn_setdefault_Click(object sender, EventArgs e) { + //http + using (RegistryKey key = Registry.CurrentUser.CreateSubKey( + @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice")) { + key.SetValue("ProgId", "bselectURL"); + } + //https + using (RegistryKey key = Registry.CurrentUser.CreateSubKey( + @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice")) { + key.SetValue("ProgId", "bselectURL"); + } + + btn_setdefault.Enabled = false; + } + } +} diff --git a/BrowserSelect/frm_settings.resx b/BrowserSelect/frm_settings.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BrowserSelect/frm_settings.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/BrowserSelect/installer.nsi b/BrowserSelect/installer.nsi index f036a02..f188b1e 100644 --- a/BrowserSelect/installer.nsi +++ b/BrowserSelect/installer.nsi @@ -37,6 +37,7 @@ Section "Dummy Section" SecDummy ;ADD YOUR OWN FILES HERE... File "/oname=BrowserSelect.exe" ".\bin\Release\BrowserSelect.exe" + createShortCut "$SMPROGRAMS\BrowserSelect.lnk" "$INSTDIR\BrowserSelect.exe" ;Store installation folder WriteRegStr HKCU "Software\BrowserSelect" "" $INSTDIR @@ -92,6 +93,7 @@ Section "Uninstall" Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\BrowserSelect.exe" + Delete "$SMPROGRAMS\BrowserSelect.lnk" RMDir "$INSTDIR"