mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature<Stashes>: supports clear all stashes
This commit is contained in:
parent
4d7b16dc75
commit
f92f5746b9
4 changed files with 46 additions and 2 deletions
|
@ -542,4 +542,5 @@
|
||||||
<sys:String x:Key="Text.BadArchiveFile">Invalid path for archive file</sys:String>
|
<sys:String x:Key="Text.BadArchiveFile">Invalid path for archive file</sys:String>
|
||||||
<sys:String x:Key="Text.Required">This field is required</sys:String>
|
<sys:String x:Key="Text.Required">This field is required</sys:String>
|
||||||
<sys:String x:Key="Text.ConfirmRemoveRepo">You are removing repository '{0}'. Are you sure to continue?</sys:String>
|
<sys:String x:Key="Text.ConfirmRemoveRepo">You are removing repository '{0}'. Are you sure to continue?</sys:String>
|
||||||
|
<sys:String x:Key="Text.ConfirmClearStashes">You are trying to clear all stashes. Are you sure to continue?</sys:String>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
|
@ -541,4 +541,5 @@
|
||||||
<sys:String x:Key="Text.BadArchiveFile">非法的存档文件路径!</sys:String>
|
<sys:String x:Key="Text.BadArchiveFile">非法的存档文件路径!</sys:String>
|
||||||
<sys:String x:Key="Text.Required">内容未填写!</sys:String>
|
<sys:String x:Key="Text.Required">内容未填写!</sys:String>
|
||||||
<sys:String x:Key="Text.ConfirmRemoveRepo">正在将 '{0}' 从列表中移除,是否要继续?</sys:String>
|
<sys:String x:Key="Text.ConfirmRemoveRepo">正在将 '{0}' 从列表中移除,是否要继续?</sys:String>
|
||||||
|
<sys:String x:Key="Text.ConfirmClearStashes">您正在丢弃所有的贮藏,一经操作,无法回退,是否继续?</sys:String>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
|
@ -26,25 +26,43 @@
|
||||||
|
|
||||||
<!-- Stashes List Group -->
|
<!-- Stashes List Group -->
|
||||||
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1">
|
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1">
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Path
|
<Path
|
||||||
|
Grid.Column="0"
|
||||||
Margin="4,0"
|
Margin="4,0"
|
||||||
Width="12" Height="12"
|
Width="12" Height="12"
|
||||||
Fill="{DynamicResource Brush.FG2}"
|
Fill="{DynamicResource Brush.FG2}"
|
||||||
Data="{StaticResource Icon.Stashes}"/>
|
Data="{StaticResource Icon.Stashes}"/>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
Margin="4,0,0,0"
|
Margin="4,0,0,0"
|
||||||
Text="{DynamicResource Text.Stashes.Stashes}"
|
Text="{DynamicResource Text.Stashes.Stashes}"
|
||||||
Foreground="{DynamicResource Brush.FG2}"
|
Foreground="{DynamicResource Brush.FG2}"
|
||||||
FontWeight="Bold"/>
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
<controls:Loading
|
<controls:Loading
|
||||||
|
Grid.Column="2"
|
||||||
x:Name="waiting"
|
x:Name="waiting"
|
||||||
Width="12" Height="12"
|
Width="12" Height="12"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
Visibility="Collapsed"/>
|
Visibility="Collapsed"/>
|
||||||
</StackPanel>
|
|
||||||
|
<controls:IconButton
|
||||||
|
Grid.Column="4"
|
||||||
|
Click="ClearAll"
|
||||||
|
Width="14" Height="14"
|
||||||
|
Margin="8,0"
|
||||||
|
Icon="{StaticResource Icon.Clear}"/>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Stashes List -->
|
<!-- Stashes List -->
|
||||||
|
|
|
@ -25,6 +25,30 @@ namespace SourceGit.Views.Widgets {
|
||||||
changeList.ItemsSource = null;
|
changeList.ItemsSource = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClearAll(object sender, RoutedEventArgs e) {
|
||||||
|
var confirmDialog = new ConfirmDialog(
|
||||||
|
App.Text("Apply.Warn"),
|
||||||
|
App.Text("ConfirmClearStashes"),
|
||||||
|
async () => {
|
||||||
|
waiting.Visibility = Visibility.Visible;
|
||||||
|
waiting.IsAnimating = true;
|
||||||
|
Models.Watcher.SetEnabled(repo, false);
|
||||||
|
await Task.Run(() => {
|
||||||
|
new Commands.Command() {
|
||||||
|
Cwd = repo,
|
||||||
|
Args = "stash clear",
|
||||||
|
}.Exec();
|
||||||
|
});
|
||||||
|
Models.Watcher.SetEnabled(repo, true);
|
||||||
|
waiting.Visibility = Visibility.Collapsed;
|
||||||
|
waiting.IsAnimating = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
confirmDialog.Owner = App.Current.MainWindow;
|
||||||
|
confirmDialog.ShowDialog();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
private async void OnStashSelectionChanged(object sender, SelectionChangedEventArgs e) {
|
private async void OnStashSelectionChanged(object sender, SelectionChangedEventArgs e) {
|
||||||
changeList.ItemsSource = null;
|
changeList.ItemsSource = null;
|
||||||
selected = null;
|
selected = null;
|
||||||
|
|
Loading…
Reference in a new issue