Skip to content
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
17 changes: 14 additions & 3 deletions windows/src/TablePro.App/Views/AccountKeysView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ private async Task AskForApprovalAsync(string? open)
}
}

private Task ApproveAsync(ApprovalRequest request) => KeyDialogs.ApprovalAsync(this, _workbench, request, null);
private Task<KeyDialogResult> ApproveAsync(ApprovalRequest request) =>
KeyDialogs.ApprovalAsync(this, _workbench, request, null);

private Task RecoverAsync() => KeyDialogs.RecoverAsync(this, _workbench);

Expand Down Expand Up @@ -355,7 +356,7 @@ private async Task RemoveAsync(KeyDevice device)
await KeyDialogs.RemovalAsync(this, _workbench, device).ConfigureAwait(true);
}

private Task ResetAsync(ResetKind kind) => KeyDialogs.ResetAsync(this, _workbench, kind);
private Task<KeyDialogResult> ResetAsync(ResetKind kind) => KeyDialogs.ResetAsync(this, _workbench, kind);

private async Task CancelResetAsync(PendingReset reset)
{
Expand Down Expand Up @@ -438,7 +439,17 @@ private static StackPanel Actions(params Button[] buttons)

private static SettingsCard Card(string automationId, string header, string? description, object? content)
{
var card = new SettingsCard { Header = header, Description = description, Content = content };
var card = new SettingsCard { Header = header };
if (description is not null)
{
card.Description = description;
}

if (content is not null)
{
card.Content = content;
}

AutomationProperties.SetAutomationId(card, automationId);
return card;
}
Expand Down
2 changes: 1 addition & 1 deletion windows/src/TablePro.App/Views/TeamDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static async Task ResolveConflictsAsync(FrameworkElement owner, Workbench
var library = workbench.TeamLibrary;
// A dialog already closing keeps its answer when the sign-in changes, so each answer is checked against it.
var session = workbench.SignInSession;
while (workbench.SignInSession == session && library.Conflicts.FirstOrDefault() is { } conflict)
while (workbench.SignInSession == session && library.Conflicts is [var conflict, ..])
{
var dialog = KeyDialogs.Dialog(owner, "TeamConflictDialog");
dialog.Title = TeamText.ConflictTitle(conflict);
Expand Down
27 changes: 20 additions & 7 deletions windows/src/TablePro.App/Views/TeamKeysView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,16 @@ private void AddTeam(TeamKeysModel model)
TeamsHost.Children.Add(bar);
}

var card = new SettingsExpander
var card = new SettingsExpander { Header = name, Description = Describe(model), IsExpanded = true };
if (model.Work is not null)
{
Header = name,
Description = Describe(model),
Content = model.Work is not null ? Ring() : Action(model),
IsExpanded = true,
};
card.Content = Ring();
}
else if (Action(model) is { } action)
{
card.Content = action;
}

AutomationProperties.SetAutomationId(card, "TeamKeysCard");
AutomationProperties.SetName(card, name);
foreach (var notice in model.Notices)
Expand Down Expand Up @@ -367,7 +370,17 @@ private Button ActionButton(string automationId, string text, Func<Task> run)

private static SettingsCard Card(string automationId, string header, string? description, object? content)
{
var card = new SettingsCard { Header = header, Description = description, Content = content };
var card = new SettingsCard { Header = header };
if (description is not null)
{
card.Description = description;
}

if (content is not null)
{
card.Content = content;
}

AutomationProperties.SetAutomationId(card, automationId);
return card;
}
Expand Down
Loading