Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all windows start in the center of the screen or their parent window #903

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion TwitchDownloaderWPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ protected override void OnStartup(StartupEventArgs e)
var windowsThemeService = new WindowsThemeService();
ThemeServiceSingleton = new ThemeService(this, windowsThemeService);

MainWindow = new MainWindow();
MainWindow = new MainWindow
{
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
MainWindow.Show();
}

Expand Down
12 changes: 10 additions & 2 deletions TwitchDownloaderWPF/PageChatDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -572,7 +576,11 @@ private void checkCropEnd_OnCheckStateChanged(object sender, RoutedEventArgs e)

private void MenuItemEnqueue_Click(object sender, RoutedEventArgs e)
{
WindowQueueOptions queueOptions = new WindowQueueOptions(this);
var queueOptions = new WindowQueueOptions(this)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
queueOptions.ShowDialog();
}

Expand Down
18 changes: 15 additions & 3 deletions TwitchDownloaderWPF/PageChatRender.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)
private void btnSettings_Click(object sender, RoutedEventArgs e)
{
SaveSettings();
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -616,7 +620,11 @@ private async void SplitBtnRender_Click(object sender, RoutedEventArgs e)

if (ReferenceEquals(sender, MenuItemPartialRender))
{
WindowRangeSelect window = new WindowRangeSelect(currentRender);
var window = new WindowRangeSelect(currentRender)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
window.ShowDialog();

if (window.OK)
Expand Down Expand Up @@ -711,7 +719,11 @@ private void MenuItemEnqueue_Click(object sender, RoutedEventArgs e)

private void EnqueueRender()
{
var queueOptions = new WindowQueueOptions(this);
var queueOptions = new WindowQueueOptions(this)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
queueOptions.ShowDialog();
}

Expand Down
12 changes: 10 additions & 2 deletions TwitchDownloaderWPF/PageChatUpdate.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -645,7 +649,11 @@ private void checkEnd_OnCheckStateChanged(object sender, RoutedEventArgs e)

private void MenuItemEnqueue_Click(object sender, RoutedEventArgs e)
{
WindowQueueOptions queueOptions = new WindowQueueOptions(this);
var queueOptions = new WindowQueueOptions(this)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
queueOptions.ShowDialog();
}
}
Expand Down
12 changes: 10 additions & 2 deletions TwitchDownloaderWPF/PageClipDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -271,7 +275,11 @@ private void BtnCancel_Click(object sender, RoutedEventArgs e)

private void MenuItemEnqueue_Click(object sender, RoutedEventArgs e)
{
WindowQueueOptions queueOptions = new WindowQueueOptions(this);
var queueOptions = new WindowQueueOptions(this)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
queueOptions.ShowDialog();
}

Expand Down
24 changes: 20 additions & 4 deletions TwitchDownloaderWPF/PageQueue.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -167,19 +171,31 @@ private void numRender_ValueChanged(object sender, HandyControl.Data.FunctionEve

private void btnUrlList_Click(object sender, RoutedEventArgs e)
{
WindowUrlList window = new WindowUrlList();
var window = new WindowUrlList
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
window.ShowDialog();
}

private void btnVods_Click(object sender, RoutedEventArgs e)
{
WindowMassDownload window = new WindowMassDownload(DownloadType.Video);
var window = new WindowMassDownload(DownloadType.Video)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
window.ShowDialog();
}

private void btnClips_Click(object sender, RoutedEventArgs e)
{
WindowMassDownload window = new WindowMassDownload(DownloadType.Clip);
var window = new WindowMassDownload(DownloadType.Clip)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
window.ShowDialog();
}

Expand Down
12 changes: 10 additions & 2 deletions TwitchDownloaderWPF/PageVodDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ private void btnDonate_Click(object sender, RoutedEventArgs e)

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
WindowSettings settings = new WindowSettings();
var settings = new WindowSettings
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
settings.ShowDialog();
btnDonate.Visibility = Settings.Default.HideDonation ? Visibility.Collapsed : Visibility.Visible;
}
Expand Down Expand Up @@ -474,7 +478,11 @@ private void MenuItemEnqueue_Click(object sender, RoutedEventArgs e)

if (ValidateInputs())
{
WindowQueueOptions queueOptions = new WindowQueueOptions(this);
var queueOptions = new WindowQueueOptions(this)
{
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
queueOptions.ShowDialog();
}
else
Expand Down
6 changes: 5 additions & 1 deletion TwitchDownloaderWPF/WindowMassDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ private void btnQueue_Click(object sender, RoutedEventArgs e)
{
if (selectedItems.Count > 0)
{
WindowQueueOptions queue = new WindowQueueOptions(selectedItems);
var queue = new WindowQueueOptions(selectedItems)
{
Owner = this,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
if (queue.ShowDialog().GetValueOrDefault())
this.Close();
}
Expand Down
6 changes: 5 additions & 1 deletion TwitchDownloaderWPF/WindowUrlList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ private async void btnQueue_Click(object sender, RoutedEventArgs e)
return;
}

WindowQueueOptions queue = new WindowQueueOptions(dataList);
var queue = new WindowQueueOptions(dataList)
{
Owner = this,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
if (queue.ShowDialog().GetValueOrDefault())
this.Close();

Expand Down
Loading