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

Increase playtime accuracy #395

Merged
merged 7 commits into from
Feb 16, 2024
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
36 changes: 28 additions & 8 deletions CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,29 +523,30 @@ await SpawnDialog(
ContentDialogTheme.Success
);

public static async Task<ContentDialogResult> Dialog_ChangePlaytime(UIElement Content) =>
public static async Task<ContentDialogResult> Dialog_StopGame(UIElement Content) =>
await SpawnDialog(
Lang._Dialogs.ChangePlaytimeTitle,
Lang._Dialogs.ChangePlaytimeSubtitle,
Lang._Dialogs.StopGameTitle,
Lang._Dialogs.StopGameSubtitle,
Content,
Lang._Misc.NoCancel,
Lang._Misc.Yes,
null,
ContentDialogButton.Primary,
ContentDialogTheme.Warning
);
);

public static async Task<ContentDialogResult> Dialog_StopGame(UIElement Content) =>
#region Playtime Dialogs
public static async Task<ContentDialogResult> Dialog_ChangePlaytime(UIElement Content) =>
await SpawnDialog(
Lang._Dialogs.StopGameTitle,
Lang._Dialogs.StopGameSubtitle,
Lang._Dialogs.ChangePlaytimeTitle,
Lang._Dialogs.ChangePlaytimeSubtitle,
Content,
Lang._Misc.NoCancel,
Lang._Misc.Yes,
null,
ContentDialogButton.Primary,
ContentDialogTheme.Warning
);
);

public static async Task<ContentDialogResult> Dialog_ResetPlaytime(UIElement Content)
{
Expand All @@ -566,6 +567,25 @@ public static async Task<ContentDialogResult> Dialog_ResetPlaytime(UIElement Con
);
}

public static async void Dialog_InvalidPlaytime(UIElement Content, int elapsedSeconds = 0)
{
StackPanel stack = new StackPanel() { Orientation = Orientation.Vertical };

stack.Children.Add(new TextBlock() { Text = Lang._Dialogs.InvalidPlaytimeSubtitle1, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) });
stack.Children.Add(new TextBlock() { Text = Lang._Dialogs.InvalidPlaytimeSubtitle2, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) });
stack.Children.Add(new TextBlock() { Text = string.Format(Lang._HomePage.GamePlaytime_Display, elapsedSeconds / 3600, elapsedSeconds % 3600 / 60), FontWeight = FontWeights.Bold, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 4, 0, 4) });
stack.Children.Add(new TextBlock() { Text = Lang._Dialogs.InvalidPlaytimeSubtitle3, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = HorizontalAlignment.Center, FontWeight = FontWeights.Bold, Margin = new Thickness(0, 4, 0, -2) });

await SpawnDialog(
Lang._Dialogs.InvalidPlaytimeTitle,
stack,
Content,
Lang._Misc.Close,
dialogTheme: ContentDialogTheme.Warning
);
}
#endregion

public static async Task<ContentDialogResult> Dialog_MeteredConnectionWarning(UIElement Content)
{
TextBlock texts = new TextBlock { TextWrapping = TextWrapping.Wrap };
Expand Down
Loading
Loading