Skip to content

Commit

Permalink
Add user configurable option to launch staight to settings if now URL…
Browse files Browse the repository at this point in the history
… is provided
  • Loading branch information
lucasnz committed Sep 8, 2021
1 parent f8c3cbd commit 7a6cdc3
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 22 deletions.
9 changes: 6 additions & 3 deletions BrowserSelect/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ public void updateBrowsers()
}

private void Form1_Load(object sender, EventArgs e)
{
{
this.AutoSize = true;
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.KeyPreview = true;
this.Text = Program.url;
// set the form icon from .exe file icon
this.Icon = IconExtractor.fromFile(Application.ExecutablePath);
// create a wildcard rule for this domain (always button)
_alwaysRule = generate_rule(Program.url);
if (Program.url != "")
{
_alwaysRule = generate_rule(Program.url);
this.Text = Program.url;
}
// check for new version
if (Settings.Default.last_version != "nope")
{
Expand Down
6 changes: 3 additions & 3 deletions BrowserSelect/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ static void Main(string[] args)
// display main form
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
if (url != "")
Application.Run(new Form1());
else
if (url == "" && (Boolean)Settings.Default.LaunchToSettings)
Application.Run(new frm_settings());
else
Application.Run(new Form1());
}

private static Boolean load_browser(Uri uri)
Expand Down
12 changes: 12 additions & 0 deletions BrowserSelect/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions BrowserSelect/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
<Setting Name="Rules" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="LaunchToSettings" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
3 changes: 3 additions & 0 deletions BrowserSelect/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<setting name="Rules" serializeAs="String">
<value />
</setting>
<setting name="LaunchToSettings" serializeAs="String">
<value>False</value>
</setting>
</BrowserSelect.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
33 changes: 18 additions & 15 deletions BrowserSelect/frm_settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions BrowserSelect/frm_settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private void frm_settings_Load(object sender, EventArgs e)
}

chk_check_update.Checked = Settings.Default.check_update != "nope";
chk_launch_settings.Checked = (Boolean)Settings.Default.LaunchToSettings;
}

private Boolean check_rules()
Expand Down Expand Up @@ -422,5 +423,11 @@ private void btn_down_Click(object sender, EventArgs e)
Debug.WriteLine(ex);
}
}

private void chk_launch_settings_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.LaunchToSettings = ((CheckBox)sender).Checked;
Settings.Default.Save();
}
}
}
2 changes: 1 addition & 1 deletion BrowserSelect/frm_settings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="linkLabel1.Text" xml:space="preserve">
<value>Using this section you can add rules that based on them browser select will automatically choose a browser instead of displaying the list for you to choose manually. more information and examples can be found on the project's github.
<value>Using this section you can add rules to enable BrowserSelect to automatically choose a browser instead of displaying the browser list. More information and examples on filters, plus feature requests, bug reports or suggestions can be found on the project's github.
</value>
</data>
<metadata name="type.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand Down

0 comments on commit 7a6cdc3

Please sign in to comment.