Skip to content

Commit

Permalink
- fixed restoring extraQL window after it was minimized to system tra…
Browse files Browse the repository at this point in the history
…y (e.g. when starting a 2nd extraQL instance)

- added tray menu items for "Open extraQL" and "Start Server Browser" (if present)
  • Loading branch information
PredatH0r committed Nov 14, 2015
1 parent cd5e8c9 commit 12fa401
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 73 deletions.
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ c:\program files (x86)\Steam\SteamApps\workshop\content\282440\539252269
Changelog
=========

Version 2.7.1
---
- fixed restoring extraQL window after it was minimized to system tray (e.g. when starting a 2nd extraQL instance)
- added tray menu items for "Open extraQL" and "Start Server Browser" (if present)

Version 2.7
---
- added command line parameter /background to start extraQL minimized (used by SteamServerBrowser when auto-starting extraQL)
Expand Down
150 changes: 85 additions & 65 deletions source/MainForm.Designer.cs

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

40 changes: 32 additions & 8 deletions source/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ExtraQL
{
public partial class MainForm : Form
{
public const string Version = "2.7";
public const string Version = "2.7.1";

private readonly Config config;
private readonly HttpServer server;
Expand Down Expand Up @@ -48,6 +48,8 @@ public MainForm(Config config)
this.servlets = new Servlets(this.server, this.scriptRepository, this.Log, this, config.AppBaseDir);
this.UpdateServletSettings();

this.miStartServerBrowser.Visible = this.GetServerBrowserExe() != null;

this.ActiveControl = this.btnStartQL;
}
#endregion
Expand Down Expand Up @@ -277,13 +279,27 @@ private void trayIcon_MouseUp(object sender, MouseEventArgs e)
}
#endregion

#region miOpenExtraQl_Click
private void miOpenExtraQl_Click(object sender, EventArgs e)
{
this.SetFormVisibility(true);
}
#endregion

#region miStartQL_Click
private void miStartQL_Click(object sender, EventArgs e)
{
this.Launch();
}
#endregion

#region miStartServerBrowser_Click()
private void miStartServerBrowser_Click(object sender, EventArgs e)
{
this.StartServerBrowser();
}
#endregion

#region miQuit_Click
private void miQuit_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -644,25 +660,34 @@ private void SetFormVisibility(bool visible)
}
else
{
this.WindowState = FormWindowState.Minimized;
if (this.cbSystemTray.Checked)
this.Hide();
else
this.WindowState = FormWindowState.Minimized;
}
}
#endregion

#region GetServerBrowserExe()
private string GetServerBrowserExe()
{
var wsPath = this.GetSteamWorkshopPath();
wsPath = Path.Combine(Path.GetDirectoryName(wsPath) ?? ".", @"543312745\ServerBrowser.exe");
return File.Exists(wsPath) ? wsPath : null;
}
#endregion

#region StartServerBrowser()
private void StartServerBrowser()
{
var proc = Process.GetProcessesByName("ServerBrowser");
if (proc.Length == 0)
{
var wsPath = this.GetSteamWorkshopPath();
wsPath = Path.Combine(Path.GetDirectoryName(wsPath) ?? ".", @"543312745\ServerBrowser.exe");
if (File.Exists(wsPath))
Process.Start(wsPath);
var exe = this.GetServerBrowserExe();
if (exe != null)
Process.Start(exe);
else
Log("Could not find " + wsPath + ".\nMake sure you have steam workshop item 543312745 installed.");
Log("Could not find ServerBrowser.exe.\nMake sure you have steam workshop item 543312745 installed.");
}
else
Win32.ShowWindow(proc[0].MainWindowHandle, 1);
Expand All @@ -677,6 +702,5 @@ private void CloseServerBrowser()
Win32.SendMessage(p.MainWindowHandle, Win32.WM_CLOSE, 0, 0);
}
#endregion

}
}
1 change: 1 addition & 0 deletions source/Servlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ private void BringToFront(Stream stream, Uri uri, string request)

form.BeginInvoke((ThreadStart)(() =>
{
this.form.Visible = true;
this.form.WindowState = FormWindowState.Normal;
this.form.BringToFront();
this.form.Activate();
Expand Down

0 comments on commit 12fa401

Please sign in to comment.