diff --git a/DICUI/DICUI.csproj b/DICUI/DICUI.csproj
index 52a652c3..718845c5 100644
--- a/DICUI/DICUI.csproj
+++ b/DICUI/DICUI.csproj
@@ -76,6 +76,7 @@
+
diff --git a/DICUI/Data/Constants.cs b/DICUI/Data/Constants.cs
index 7d02baa3..25e6889c 100644
--- a/DICUI/Data/Constants.cs
+++ b/DICUI/Data/Constants.cs
@@ -7,6 +7,8 @@
{
public const string StartDumping = "Start Dumping";
public const string StopDumping = "Stop Dumping";
+
+ public const int LogWindowMarginFromMainWindow = 10;
}
///
diff --git a/DICUI/LogWindow.xaml.cs b/DICUI/LogWindow.xaml.cs
index 12da66e1..d534411a 100644
--- a/DICUI/LogWindow.xaml.cs
+++ b/DICUI/LogWindow.xaml.cs
@@ -16,6 +16,7 @@ using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
+using DICUI.Data;
using DICUI.UI;
namespace DICUI
@@ -135,7 +136,7 @@ namespace DICUI
public void AdjustPositionToMainWindow()
{
this.Left = _mainWindow.Left;
- this.Top = _mainWindow.Top + _mainWindow.Height + 10;
+ this.Top = _mainWindow.Top + _mainWindow.Height + UIElements.LogWindowMarginFromMainWindow;
}
private void GracefullyTerminateProcess()
diff --git a/DICUI/MainWindow.xaml b/DICUI/MainWindow.xaml
index 4b2390f7..734f3de3 100644
--- a/DICUI/MainWindow.xaml
+++ b/DICUI/MainWindow.xaml
@@ -8,7 +8,7 @@
xmlns:utilities="clr-namespace:DICUI.Utilities"
mc:Ignorable="d"
Title="Disc Image Creator GUI" Height="450" Width="600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize"
- LocationChanged="MainWindowLocationChanged" Activated="MainWindowLocationActivated" Closing="MainWindowClosing">
+ LocationChanged="MainWindowLocationChanged" Activated="MainWindowActivated" Closing="MainWindowClosing">
diff --git a/DICUI/MainWindow.xaml.cs b/DICUI/MainWindow.xaml.cs
index d0f1af91..770c25bc 100644
--- a/DICUI/MainWindow.xaml.cs
+++ b/DICUI/MainWindow.xaml.cs
@@ -44,6 +44,17 @@ namespace DICUI
StartStopButton.IsEnabled = false;
DiskScanButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
+
+ if (_options.OpenLogWindowAtStartup)
+ {
+ System.Drawing.Rectangle bounds = WinForms.Screen.PrimaryScreen.WorkingArea;
+
+ this.WindowStartupLocation = WindowStartupLocation.Manual;
+ double combinedHeight = this.Height + _logWindow.Height + UIElements.LogWindowMarginFromMainWindow;
+
+ this.Left = bounds.Left + (bounds.Width - this.Width) / 2;
+ this.Top = bounds.Top + (bounds.Height - combinedHeight) / 2;
+ }
}
@@ -164,12 +175,12 @@ namespace DICUI
_logWindow.AdjustPositionToMainWindow();
}
- private void MainWindowLocationActivated(object sender, EventArgs e)
+ private void MainWindowActivated(object sender, EventArgs e)
{
- if (_logWindow.IsVisible)
+ if (_logWindow.IsVisible && !this.Topmost)
{
_logWindow.Topmost = true;
- this.Topmost = true;
+ _logWindow.Topmost = false;
}
}