Skip to content

Commit

Permalink
Window now minimizes after initial message, clarified instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
BOLL7708 committed Feb 8, 2021
1 parent 86b0982 commit cc76b83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions OpenVRStartup/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ static void Main(string[] _)
if (LogUtils.LogFileExists(PATH_LOGFILE))
{
_isReady = true;
IntPtr winHandle = Process.GetCurrentProcess().MainWindowHandle;
ShowWindow(winHandle, SW_SHOWMINIMIZED);
Minimize();
}
else {
Utils.PrintInfo("\n========================");
Expand All @@ -43,8 +42,9 @@ static void Main(string[] _)
Utils.Print($"\nWhen it runs it will in turn run all {FILE_PATTERN} files in the {PATH_STARTFOLDER} folder.");
Utils.Print($"\nIf there are {FILE_PATTERN} files in {PATH_STOPFOLDER} it will stay and run those on shutdown.");
Utils.Print("\nThis message is only shown once, to see it again delete the log file.");
Utils.Print("\nPress [Enter] in this window to continue execution.");
Utils.Print("\nPress [Enter] in this window to continue execution.\nIf there are shutdown scripts the window will remain in the task bar.");
Console.ReadLine();
Minimize();
_isReady = true;
}

Expand All @@ -54,6 +54,11 @@ static void Main(string[] _)
OpenVR.Shutdown();
}

private static void Minimize() {
IntPtr winHandle = Process.GetCurrentProcess().MainWindowHandle;
ShowWindow(winHandle, SW_SHOWMINIMIZED);
}

private static bool _isConnected = false;

private static void Worker()
Expand Down Expand Up @@ -124,7 +129,7 @@ private static void RunScripts(string folder) {
LogUtils.WriteLineToCache($"Found: {files.Length} script(s) in {folder}");
foreach (var file in files)
{
LogUtils.WriteLineToCache($"Executing: {file} from {folder}");
LogUtils.WriteLineToCache($"Executing: {file}");
var path = Path.Combine(Environment.CurrentDirectory, file);
Process p = new Process();
p.StartInfo.CreateNoWindow = true;
Expand All @@ -133,7 +138,7 @@ private static void RunScripts(string folder) {
p.StartInfo.Arguments = $"/C \"{path}\"";
p.Start();
}
if (files.Length == 0) LogUtils.WriteLineToCache($"Did not find any .cmd files to execute in {folder}");
if (files.Length == 0) LogUtils.WriteLineToCache($"Did not find any {FILE_PATTERN} files to execute in {folder}");
}
catch (Exception e)
{
Expand All @@ -143,6 +148,7 @@ private static void RunScripts(string folder) {

private static void WaitForQuit()
{
Utils.Print("This window remains to wait for the shutdown of SteamVR to run additional scripts on exit.");
var shouldRun = true;
while(shouldRun)
{
Expand Down
2 changes: 1 addition & 1 deletion OpenVRStartup/Properties/Resources.Designer.cs

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

2 changes: 1 addition & 1 deletion OpenVRStartup/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Version" xml:space="preserve">
<value>v0.10</value>
<value>v0.11</value>
</data>
</root>

0 comments on commit cc76b83

Please sign in to comment.