From bab1a57480dcb6c01f3cd2c3a75a67e713b73f8c Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 26 Jul 2024 15:02:23 +0800 Subject: [PATCH] refactor: using `x:Int32` and `x:String` instead of custom types --- src/Resources/Locales/zh_CN.axaml | 2 +- src/Resources/Locales/zh_TW.axaml | 2 +- src/ViewModels/Discard.cs | 18 ++++------------- src/Views/Discard.axaml | 32 +++++++++++++++++-------------- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 92cfe42f..1b0a0d46 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -197,7 +197,7 @@ 使用外部比对工具查看 放弃更改确认 所有本地址未提交的修改。 - 需要放弃的变更 : + 变更 : 总计{0}项选中更改 本操作不支持回退,请确认后继续!!! 书签 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 56e26678..d75ad3f2 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -197,7 +197,7 @@ 使用外部比對工具檢視 放棄更改確認 所有本地址未提交的修改。 - 需要放棄的變更 : + 變更 : 總計{0}項選中更改 本操作不支援回退,請確認後繼續!!! 書籤 : diff --git a/src/ViewModels/Discard.cs b/src/ViewModels/Discard.cs index 783d3c08..641c5232 100644 --- a/src/ViewModels/Discard.cs +++ b/src/ViewModels/Discard.cs @@ -3,10 +3,6 @@ using System.Threading.Tasks; namespace SourceGit.ViewModels { - public class DiscardModeAll { } - public class DiscardModeSingle { public string File { get; set; } } - public class DiscardModeMulti { public int Count { get; set; } } - public class Discard : Popup { public object Mode @@ -19,7 +15,7 @@ namespace SourceGit.ViewModels { _repo = repo; - Mode = new DiscardModeAll(); + Mode = null; View = new Views.Discard { DataContext = this }; } @@ -30,17 +26,11 @@ namespace SourceGit.ViewModels _isUnstaged = isUnstaged; if (_changes == null) - { - Mode = new DiscardModeAll(); - } + Mode = null; else if (_changes.Count == 1) - { - Mode = new DiscardModeSingle() { File = _changes[0].Path }; - } + Mode = _changes[0].Path; else - { - Mode = new DiscardModeMulti() { Count = _changes.Count }; - } + Mode = _changes.Count; View = new Views.Discard() { DataContext = this }; } diff --git a/src/Views/Discard.axaml b/src/Views/Discard.axaml index 7c066634..73532887 100644 --- a/src/Views/Discard.axaml +++ b/src/Views/Discard.axaml @@ -12,28 +12,32 @@ Classes="bold" Text="{DynamicResource Text.Discard}"/> - + - + + + + + + + + + + + + - + - - + + - + - - - - - - - - +