Compare commits

...
1 Commits
4 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<LangVersion>preview</LangVersion>
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
<Version>0.8.2</Version>
<Version>0.8.3</Version>
</PropertyGroup>
<ItemGroup>
@@ -190,7 +190,7 @@ namespace Daybreak.Services.ApplicationLauncher
var retries = 0;
while (true)
{
await Task.Delay(1000);
await Task.Delay(100);
retries++;
var gwProcess = Process.GetProcessesByName("gw").FirstOrDefault();
if (gwProcess is null && retries < MaxRetries)
@@ -202,10 +202,21 @@ namespace Daybreak.Services.ApplicationLauncher
throw new InvalidOperationException("Newly launched gw process not detected");
}
if (gwProcess.MainWindowHandle != IntPtr.Zero)
if (gwProcess.MainWindowHandle == IntPtr.Zero)
{
return true;
continue;
}
int titleLength = NativeMethods.GetWindowTextLength(gwProcess.MainWindowHandle);
var titleBuffer = new StringBuilder(titleLength);
var readCount = NativeMethods.GetWindowText(gwProcess.MainWindowHandle, titleBuffer, titleLength + 1);
var title = titleBuffer.ToString();
if (title != "Guild Wars")
{
continue;
}
return true;
}
}
+4
View File
@@ -113,5 +113,9 @@ namespace Pepa.Wpf.Utilities
public static extern bool SetWindowPos(IntPtr hwnd, IntPtr insertAfter, int x, int y, int cx, int cy, uint flags);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd, int cmd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
}
}
+1
View File
@@ -163,6 +163,7 @@ namespace Daybreak.Views
{
throw new InvalidOperationException($"Unable to set guildwars on desired screen. No screen with id {id}");
}
await Task.Delay(1000);
this.screenManager.MoveGuildwarsToScreen(desiredScreen);
}