From fa3ff6f2db57c1714f070be44e0bc37f11d642a5 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 2 Apr 2021 22:45:19 +0800 Subject: [PATCH] style<*>: remove Waiting panel; adjustment for high dpi screens; --- src/Resources/Locales/en_US.xaml | 3 --- src/Resources/Locales/zh_CN.xaml | 3 --- src/UI/About.xaml | 2 +- src/UI/Blame.xaml | 2 +- src/UI/Dashboard.xaml | 19 ++++++++------- src/UI/Dashboard.xaml.cs | 9 +++++-- src/UI/FileHistories.xaml | 6 ++--- src/UI/FolderDialog.xaml | 6 ++--- src/UI/InteractiveRebase.xaml | 6 +++-- src/UI/Launcher.xaml | 7 +++--- src/UI/SettingDialog.xaml | 2 +- src/UI/UpdateAvailable.xaml | 2 +- src/UI/Waiting.xaml | 9 ------- src/UI/Waiting.xaml.cs | 41 -------------------------------- src/UI/WorkingCopy.xaml | 30 +++++++++++++---------- src/UI/WorkingCopy.xaml.cs | 35 ++++++++++++++++++++------- 16 files changed, 79 insertions(+), 103 deletions(-) delete mode 100644 src/UI/Waiting.xaml delete mode 100644 src/UI/Waiting.xaml.cs diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 09702b2e..cdc851ea 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -411,9 +411,6 @@ Revert merge request detected! Press 'Abort' to restore original HEAD Merge request detected! Press 'Abort' to restore original HEAD - WAITING SUBMOUDLE UPDATE COMPLETE... - WAITING STAGE COMPLETE... - Git has NOT been configured.\nPlease to go [Preference] and configure it first. Path[{0}] not exists! Can NOT locate bash.exe. Make sure bash.exe exists under the same folder with git.exe diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 83833b45..bc2f6903 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -411,9 +411,6 @@ 检测到回滚提交冲突! 检测到分支合并冲突! - 等待子模块更新完成... - 等待暂存完成 ... - GIT尚未配置。请打开【偏好设置】配置GIT路径。 路径({0})不存在或不可读取! 无法找到bash.exe,请确保其在git.exe同目录中! diff --git a/src/UI/About.xaml b/src/UI/About.xaml index 56f88e60..5438964b 100644 --- a/src/UI/About.xaml +++ b/src/UI/About.xaml @@ -14,7 +14,7 @@ - + diff --git a/src/UI/Blame.xaml b/src/UI/Blame.xaml index 74a0538f..595b9e1d 100644 --- a/src/UI/Blame.xaml +++ b/src/UI/Blame.xaml @@ -14,7 +14,7 @@ - + @@ -188,7 +190,7 @@ - + diff --git a/src/UI/Launcher.xaml b/src/UI/Launcher.xaml index 159109ad..75e28517 100644 --- a/src/UI/Launcher.xaml +++ b/src/UI/Launcher.xaml @@ -6,7 +6,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:source="clr-namespace:SourceGit" xmlns:local="clr-namespace:SourceGit.UI" - xmlns:helpers="clr-namespace:SourceGit.Helpers" xmlns:converters="clr-namespace:SourceGit.Converters" mc:Ignorable="d" MinWidth="800" MinHeight="600" @@ -21,7 +20,7 @@ - + @@ -110,11 +109,11 @@ - + - + diff --git a/src/UI/SettingDialog.xaml b/src/UI/SettingDialog.xaml index 7059eb00..5bbd607f 100644 --- a/src/UI/SettingDialog.xaml +++ b/src/UI/SettingDialog.xaml @@ -18,7 +18,7 @@ - + diff --git a/src/UI/UpdateAvailable.xaml b/src/UI/UpdateAvailable.xaml index ca637ae6..795079c2 100644 --- a/src/UI/UpdateAvailable.xaml +++ b/src/UI/UpdateAvailable.xaml @@ -14,7 +14,7 @@ - + diff --git a/src/UI/Waiting.xaml b/src/UI/Waiting.xaml deleted file mode 100644 index dc8db808..00000000 --- a/src/UI/Waiting.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/src/UI/Waiting.xaml.cs b/src/UI/Waiting.xaml.cs deleted file mode 100644 index 71b415b6..00000000 --- a/src/UI/Waiting.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace SourceGit.UI { - - /// - /// General waiting dialog. - /// - public partial class Waiting : UserControl { - - /// - /// Constructor. - /// - public Waiting() { - InitializeComponent(); - } - - /// - /// Show this dialog. - /// - /// - /// - /// - public static void Show(Git.Repository repo, string tipKey, Action job) { - var dialog = new Waiting(); - var tip = dialog.FindResource(tipKey) as string; - if (tip != null) dialog.txtTip.Text = tip; - - var popup = repo.GetPopupManager(); - popup?.Show(dialog); - popup?.Lock(); - Task.Run(() => { - job.Invoke(); - dialog.Dispatcher.Invoke(() => { - popup?.Close(true); - }); - }); - } - } -} diff --git a/src/UI/WorkingCopy.xaml b/src/UI/WorkingCopy.xaml index 6e14a1d0..1134dfb0 100644 --- a/src/UI/WorkingCopy.xaml +++ b/src/UI/WorkingCopy.xaml @@ -29,7 +29,7 @@ - + @@ -45,12 +45,12 @@ - + @@ -58,22 +58,29 @@ + + - - - @@ -218,6 +224,8 @@ + + @@ -230,10 +238,8 @@ - - - + diff --git a/src/UI/WorkingCopy.xaml.cs b/src/UI/WorkingCopy.xaml.cs index 940d0ed3..42407185 100644 --- a/src/UI/WorkingCopy.xaml.cs +++ b/src/UI/WorkingCopy.xaml.cs @@ -338,7 +338,7 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); stage.Click += (o, e) => { - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(node.FilePath)); + DoStage(node.FilePath); e.Handled = true; }; @@ -410,7 +410,7 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Format("FileCM.StageMulti", changes.Count); stage.Click += (o, e) => { - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); + DoStage(files.ToArray()); e.Handled = true; }; @@ -480,7 +480,7 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); stage.Click += (o, e) => { - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(change.Path)); + DoStage(change.Path); e.Handled = true; }; @@ -552,8 +552,8 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Format("FileCM.StageMulti", changes.Count); - stage.Click += (o, e) => { - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); + stage.Click += (o, e) => { + DoStage(files.ToArray()); e.Handled = true; }; @@ -614,12 +614,25 @@ namespace SourceGit.UI { } } - if (files.Count == 0) return; - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); + if (files.Count > 0) DoStage(files.ToArray()); } private void StageAll(object sender, RoutedEventArgs e) { - Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage()); + DoStage(); + } + + private void DoStage(params string[] files) { + DoubleAnimation anim = new DoubleAnimation(0, 360, TimeSpan.FromSeconds(1)); + anim.RepeatBehavior = RepeatBehavior.Forever; + iconStaging.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, anim); + iconStaging.Visibility = Visibility.Visible; + Task.Run(() => { + Repo.Stage(files); + Dispatcher.Invoke(() => { + iconStaging.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, null); + iconStaging.Visibility = Visibility.Collapsed; + }); + }); } #endregion @@ -964,7 +977,13 @@ namespace SourceGit.UI { txtCommitMsg.GetBindingExpression(TextBox.TextProperty).UpdateSource(); if (Validation.GetHasError(txtCommitMsg)) return; + DoubleAnimation anim = new DoubleAnimation(0, 360, TimeSpan.FromSeconds(1)); + anim.RepeatBehavior = RepeatBehavior.Forever; + iconCommiting.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, anim); + iconCommiting.Visibility = Visibility.Visible; bool succ = await Task.Run(() => Repo.DoCommit(CommitMessage, amend)); + iconCommiting.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, null); + iconCommiting.Visibility = Visibility.Collapsed; if (!succ) return; ClearMessage();