mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature<StashDropConfirm>: need confirm before drop selected stash
This commit is contained in:
parent
5acc768478
commit
7e4c5bc7a4
5 changed files with 73 additions and 1 deletions
|
@ -399,6 +399,9 @@
|
|||
<sys:String x:Key="Text.Stashes.Stashes">STASHES</sys:String>
|
||||
<sys:String x:Key="Text.Stashes.Changes">CHANGES</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.StashDropConfirm">Confirm To Drop Stash</sys:String>
|
||||
<sys:String x:Key="Text.StashDropConfirm.Label">Drop :</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.TwoCommitsDiff">COMMIT : {0} -> {1}</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.UpdateAvailable">UPDATE AVAILABLE</sys:String>
|
||||
|
|
|
@ -398,6 +398,9 @@
|
|||
<sys:String x:Key="Text.Stashes.Stashes">贮藏列表</sys:String>
|
||||
<sys:String x:Key="Text.Stashes.Changes">查看变更</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.StashDropConfirm">丢弃贮藏确认</sys:String>
|
||||
<sys:String x:Key="Text.StashDropConfirm.Label">丢弃贮藏 :</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.TwoCommitsDiff">对比提交 : {0} -> {1}</sys:String>
|
||||
|
||||
<sys:String x:Key="Text.UpdateAvailable">检测更新</sys:String>
|
||||
|
|
33
src/Views/Popups/StashDropConfirm.xaml
Normal file
33
src/Views/Popups/StashDropConfirm.xaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<controls:PopupWidget
|
||||
x:Class="SourceGit.Views.Popups.StashDropConfirm"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="500">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
Margin="0,0,8,0"
|
||||
Text="{DynamicResource Text.StashDropConfirm.Label}"
|
||||
HorizontalAlignment="Right"/>
|
||||
<StackPanel
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center">
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icon.Stashes}"/>
|
||||
<TextBlock x:Name="txtTarget" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</controls:PopupWidget>
|
33
src/Views/Popups/StashDropConfirm.xaml.cs
Normal file
33
src/Views/Popups/StashDropConfirm.xaml.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.Views.Popups {
|
||||
/// <summary>
|
||||
/// 确认丢弃选中的贮藏
|
||||
/// </summary>
|
||||
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<bool> Start() {
|
||||
return Task.Run(() => {
|
||||
Models.Watcher.SetEnabled(repo, false);
|
||||
new Commands.Stash(repo).Drop(stash);
|
||||
Models.Watcher.SetEnabled(repo, true);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue