diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index df714d9b..deb1c29d 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -399,6 +399,9 @@ STASHES CHANGES + Confirm To Drop Stash + Drop : + COMMIT : {0} -> {1} UPDATE AVAILABLE diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 38f71cde..5622c791 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -398,6 +398,9 @@ 贮藏列表 查看变更 + 丢弃贮藏确认 + 丢弃贮藏 : + 对比提交 : {0} -> {1} 检测更新 diff --git a/src/Views/Popups/StashDropConfirm.xaml b/src/Views/Popups/StashDropConfirm.xaml new file mode 100644 index 00000000..dfc1def2 --- /dev/null +++ b/src/Views/Popups/StashDropConfirm.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/Views/Popups/StashDropConfirm.xaml.cs b/src/Views/Popups/StashDropConfirm.xaml.cs new file mode 100644 index 00000000..1becaafc --- /dev/null +++ b/src/Views/Popups/StashDropConfirm.xaml.cs @@ -0,0 +1,33 @@ +using System.Threading.Tasks; + +namespace SourceGit.Views.Popups { + /// + /// 确认丢弃选中的贮藏 + /// + public partial class StashDropConfirm : Controls.PopupWidget { + private string repo; + private string stash; + + public StashDropConfirm(string repo, string stash, string msg) { + this.repo = repo; + this.stash = stash; + + InitializeComponent(); + + txtTarget.Text = stash + " - " + msg; + } + + public override string GetTitle() { + return App.Text("StashDropConfirm"); + } + + public override Task Start() { + return Task.Run(() => { + Models.Watcher.SetEnabled(repo, false); + new Commands.Stash(repo).Drop(stash); + Models.Watcher.SetEnabled(repo, true); + return true; + }); + } + } +} diff --git a/src/Views/Widgets/Stashes.xaml.cs b/src/Views/Widgets/Stashes.xaml.cs index a428ab74..90f5e122 100644 --- a/src/Views/Widgets/Stashes.xaml.cs +++ b/src/Views/Widgets/Stashes.xaml.cs @@ -65,7 +65,7 @@ namespace SourceGit.Views.Widgets { var delete = new MenuItem(); delete.Header = App.Text("StashCM.Drop"); - delete.Click += (o, e) => Start(() => new Commands.Stash(repo).Drop(stash.Name)); + delete.Click += (o, e) => new Popups.StashDropConfirm(repo, stash.Name, stash.Message).Show(); var menu = new ContextMenu(); menu.Items.Add(apply);