Skip to content

Commit

Permalink
Fixed #52 + bumped version to 1.4.1 + fixed resize on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
zumoshi committed Aug 24, 2019
1 parent 4de6c81 commit c13c037
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 99 deletions.
7 changes: 2 additions & 5 deletions BrowserSelect.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserSelect", "BrowserSelect\BrowserSelect.csproj", "{E54EB455-1766-4D7C-B494-73187586F023}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{9606494E-FA74-4D59-8FCD-CB26E8D4023A}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Expand Down
2 changes: 2 additions & 0 deletions BrowserSelect/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Browser
public string icon;
public string additionalArgs = "";

public string Identifier => $"{exec} {additionalArgs}";

public Image string2Icon()
{
byte[] byteArray = Convert.FromBase64String(this.icon);
Expand Down
2 changes: 1 addition & 1 deletion BrowserSelect/Form1.Designer.cs

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

45 changes: 23 additions & 22 deletions BrowserSelect/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,28 @@ namespace BrowserSelect
public partial class Form1 : Form
{
// get the list of Borwsers from registry and remove the ones unchecked from settings
List<Browser> browsers;


List<Browser> browsers = BrowserFinder.find().Where(b => !Settings.Default.HideBrowsers.Contains(b.exec)).ToList();

private ButtonsUC buc;

public Form1()
{


InitializeComponent();
}

public void updateBrowsers()
{
List<Browser> browsers = BrowserFinder.find().Where(b => !Settings.Default.HideBrowsers.Contains(b.exec)).ToList();
SuspendLayout();
browsers = BrowserFinder.find().Where(b => !Settings.Default.HideBrowsers.Contains(b.Identifier)).ToList();
int i = 0;
int width = 0;
for (int k = Controls.Count - 1; k >= 0; k--)
{
Control c = Controls[k];
if (c is BrowserUC)
Controls.RemoveAt(k);
}
// add browserUC objects to the form
this.Controls.Clear();
foreach (var browser in browsers)
{
var buc = new BrowserUC(browser, i);
Expand All @@ -39,36 +42,34 @@ public void updateBrowsers()
buc.Click += browser_click;
this.Controls.Add(buc);
}

this.AutoSize = true;
this.KeyPreview = true;
this.Controls.Add(new ButtonsUC(this) { Left = i * width + 20 });
ResumeLayout();
buc.Left = i * width;
btn_help.Left = i * width;
btn_help.Top = buc.Height - btn_help.Height;
// this.Width = i * 128 + 20 + 20;
}

private void Form1_Load(object sender, EventArgs e)
{

this.updateBrowsers();
// resize the form
//this.Width = i * 128 + 20 + 20;
//this.AutoSize = true;
//this.KeyPreview = true;
{
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);
// add vertical buttons to right of form


// create a wildcard rule for this domain (always button)
_alwaysRule = generate_rule(Program.url);

// check for new version
if (Settings.Default.last_version != "nope")
{
btn_help.BackgroundImage = Resources.update_available;
btn_help.Click -= btn_help_Click;
btn_help.Click += btn_update_click;
}
// add vertical buttons to right of form
buc = new ButtonsUC(this);
this.Controls.Add(buc);
this.updateBrowsers();
center_me();
}

Expand Down
4 changes: 2 additions & 2 deletions BrowserSelect/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.4.1.0")]
[assembly: AssemblyFileVersion("1.4.1.0")]
94 changes: 37 additions & 57 deletions BrowserSelect/frm_settings.Designer.cs

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

Loading

0 comments on commit c13c037

Please sign in to comment.