From 96e60da7ad6b1f2d2dec29111d2eaad85b6e6f1b Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 2 Apr 2024 16:23:47 +0800 Subject: [PATCH] ux: auto focus the first input element in popup widget (#49) --- src/SourceGit/ViewModels/Repository.cs | 3 ++ src/SourceGit/Views/AddRemote.axaml | 26 ++++++----- src/SourceGit/Views/AddSubmodule.axaml | 20 +++++---- src/SourceGit/Views/Apply.axaml | 20 +++++---- src/SourceGit/Views/Archive.axaml | 20 +++++---- src/SourceGit/Views/AutoFocusBehaviour.cs | 32 ++++++++++++++ src/SourceGit/Views/Checkout.axaml | 4 +- src/SourceGit/Views/CherryPick.axaml | 10 ++--- src/SourceGit/Views/Cleanup.axaml | 4 +- src/SourceGit/Views/ClearStashes.axaml | 4 +- src/SourceGit/Views/Clone.axaml | 2 +- src/SourceGit/Views/CommitDetail.axaml | 30 ++++++------- src/SourceGit/Views/CreateBranch.axaml | 26 ++++++----- src/SourceGit/Views/CreateGroup.axaml | 3 +- src/SourceGit/Views/CreateTag.axaml | 26 ++++++----- src/SourceGit/Views/DeleteBranch.axaml | 4 +- src/SourceGit/Views/DeleteRemote.axaml | 4 +- .../Views/DeleteRepositoryNode.axaml | 38 ++++++++-------- src/SourceGit/Views/DeleteSubmodule.axaml | 14 +++--- src/SourceGit/Views/DeleteTag.axaml | 10 ++--- src/SourceGit/Views/Discard.axaml | 4 +- src/SourceGit/Views/DropStash.axaml | 14 +++--- src/SourceGit/Views/EditRemote.axaml | 26 ++++++----- src/SourceGit/Views/EditRepositoryNode.axaml | 2 +- .../Views/FastForwardWithoutCheckout.axaml | 4 +- src/SourceGit/Views/Fetch.axaml | 10 ++--- src/SourceGit/Views/GitFlowFinish.axaml | 18 ++++---- src/SourceGit/Views/GitFlowStart.axaml | 22 +++++----- src/SourceGit/Views/Init.axaml | 16 +++---- src/SourceGit/Views/InitGitFlow.axaml | 44 ++++++++++--------- src/SourceGit/Views/Launcher.axaml | 3 +- src/SourceGit/Views/Merge.axaml | 22 +++++----- src/SourceGit/Views/PruneRemote.axaml | 4 +- src/SourceGit/Views/Pull.axaml | 22 +++++----- src/SourceGit/Views/Push.axaml | 22 +++++----- src/SourceGit/Views/PushTag.axaml | 16 +++---- src/SourceGit/Views/Rebase.axaml | 16 +++---- src/SourceGit/Views/RenameBranch.axaml | 20 +++++---- src/SourceGit/Views/RepositoryConfigure.axaml | 38 ++++++++-------- src/SourceGit/Views/Reset.axaml | 22 +++++----- src/SourceGit/Views/Revert.axaml | 10 ++--- src/SourceGit/Views/Reword.axaml | 20 +++++---- src/SourceGit/Views/Squash.axaml | 26 ++++++----- src/SourceGit/Views/StashChanges.axaml | 11 +++-- src/SourceGit/Views/StashesPage.axaml | 22 +++++----- 45 files changed, 401 insertions(+), 333 deletions(-) create mode 100644 src/SourceGit/Views/AutoFocusBehaviour.cs diff --git a/src/SourceGit/ViewModels/Repository.cs b/src/SourceGit/ViewModels/Repository.cs index bdc2291f..9a3626a4 100644 --- a/src/SourceGit/ViewModels/Repository.cs +++ b/src/SourceGit/ViewModels/Repository.cs @@ -568,6 +568,9 @@ namespace SourceGit.ViewModels public void RefreshWorkingCopyChanges() { var changes = new Commands.QueryLocalChanges(FullPath, _includeUntracked).Result(); + if (_workingCopy == null) + return; + var hasUnsolvedConflict = _workingCopy.SetData(changes); var inProgress = null as InProgressContext; diff --git a/src/SourceGit/Views/AddRemote.axaml b/src/SourceGit/Views/AddRemote.axaml index aeef9fa0..4123d501 100644 --- a/src/SourceGit/Views/AddRemote.axaml +++ b/src/SourceGit/Views/AddRemote.axaml @@ -4,31 +4,33 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="using:SourceGit.Models" xmlns:vm="using:SourceGit.ViewModels" + xmlns:v="using:SourceGit.Views" xmlns:c="using:SourceGit.Converters" mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450" x:Class="SourceGit.Views.AddRemote" x:DataType="vm:AddRemote"> + Classes="bold" + Text="{DynamicResource Text.Remote.AddTitle}"/> + HorizontalAlignment="Right" VerticalAlignment="Center" + Margin="0,0,8,0" + Text="{DynamicResource Text.Remote.Name}"/> + Text="{Binding Name, Mode=TwoWay}" + v:AutoFocusBehaviour.IsEnabled="True"/> + HorizontalAlignment="Right" VerticalAlignment="Center" + Margin="0,0,8,0" + Text="{DynamicResource Text.Remote.URL}"/> + Classes="bold" + Text="{DynamicResource Text.Submodule.Add}"/> + HorizontalAlignment="Right" VerticalAlignment="Center" + Margin="0,0,8,0" + Text="{DynamicResource Text.URL}"/> + Text="{Binding Url, Mode=TwoWay}" + v:AutoFocusBehaviour.IsEnabled="True"/> + HorizontalAlignment="Right" VerticalAlignment="Center" + Margin="0,0,8,0" + Text="{DynamicResource Text.Submodule.RelativePath}"/> + Classes="bold" + Text="{DynamicResource Text.Apply.Title}"/> + HorizontalAlignment="Right" VerticalAlignment="Center" + Margin="0,0,8,0" + Text="{DynamicResource Text.Apply.File}"/> + Text="{Binding PatchFile, Mode=TwoWay}" + v:AutoFocusBehaviour.IsEnabled="True">