mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature<Welcome>: enable mouse double-click on repository
This commit is contained in:
parent
249f918994
commit
18e8036e11
4 changed files with 71 additions and 58 deletions
|
@ -538,4 +538,5 @@
|
||||||
<sys:String x:Key="Text.BadRelativePath">Invalid relative path</sys:String>
|
<sys:String x:Key="Text.BadRelativePath">Invalid relative path</sys:String>
|
||||||
<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>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
|
@ -537,4 +537,5 @@
|
||||||
<sys:String x:Key="Text.BadRelativePath">非法的子路径!</sys:String>
|
<sys:String x:Key="Text.BadRelativePath">非法的子路径!</sys:String>
|
||||||
<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>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
|
@ -27,10 +27,11 @@
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
|
<ColumnDefinition Width="8"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
@ -41,43 +42,39 @@
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Width="32" Height="28"
|
Background="Transparent" BorderThickness="0"
|
||||||
Style="{DynamicResource Style.Button.Link}"
|
|
||||||
ToolTip="{DynamicResource Text.Welcome.OpenOrInit}"
|
ToolTip="{DynamicResource Text.Welcome.OpenOrInit}"
|
||||||
Click="OnOpenClicked">
|
Click="OnOpenClicked">
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icon.NewTab}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="16" Height="16" Data="{StaticResource Icon.Folder.Open}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Width="32" Height="28"
|
Background="Transparent" BorderThickness="0"
|
||||||
Style="{DynamicResource Style.Button.Link}"
|
|
||||||
ToolTip="{DynamicResource Text.Welcome.Clone}"
|
ToolTip="{DynamicResource Text.Welcome.Clone}"
|
||||||
Click="OnCloneClicked">
|
Click="OnCloneClicked">
|
||||||
<Path Width="16" Height="15" Data="{StaticResource Icon.Pull}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="15" Height="15" Data="{StaticResource Icon.Pull}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
Width="32" Height="28"
|
Background="Transparent" BorderThickness="0"
|
||||||
Style="{DynamicResource Style.Button.Link}"
|
|
||||||
ToolTip="{DynamicResource Text.Welcome.OpenTerminal}"
|
ToolTip="{DynamicResource Text.Welcome.OpenTerminal}"
|
||||||
Click="OnOpenTerminalClicked">
|
Click="OnOpenTerminalClicked">
|
||||||
<Path Width="16" Height="14" Data="{StaticResource Icon.Terminal}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icon.Terminal}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="5"
|
Grid.Column="5"
|
||||||
Width="32" Height="28"
|
Background="Transparent" BorderThickness="0"
|
||||||
Style="{DynamicResource Style.Button.Link}"
|
|
||||||
ToolTip="{DynamicResource Text.Welcome.Sort}"
|
ToolTip="{DynamicResource Text.Welcome.Sort}"
|
||||||
Click="OnSortMethodClicked">
|
Click="OnSortMethodClicked">
|
||||||
<Path Width="16" Height="14" Data="{StaticResource Icon.Sort}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="16" Height="16" Data="{StaticResource Icon.Sort}"/>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Search Bar -->
|
<!-- Search Bar -->
|
||||||
<Grid Grid.Row="1" Grid.Column="1" Margin="2,8" Height="28" VerticalAlignment="Top">
|
<Grid Grid.Row="1" Grid.Column="1" Margin="0,8" Height="28" VerticalAlignment="Top">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="24"/>
|
<ColumnDefinition Width="24"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
|
@ -120,21 +117,21 @@
|
||||||
|
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
<Control MouseDoubleClick="OnDoubleClickRepository">
|
||||||
|
<Control.Template>
|
||||||
|
<ControlTemplate>
|
||||||
<Border
|
<Border
|
||||||
Height="36"
|
Height="36"
|
||||||
Margin="2"
|
|
||||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
Background="{DynamicResource Brush.Contents}">
|
Background="{DynamicResource Brush.Contents}">
|
||||||
<Grid Margin="8,0">
|
<Grid Margin="8,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="32"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Button Grid.Column="0" Background="Transparent" Width="16" BorderThickness="0" ToolTip="{DynamicResource Text.RepoCM.Bookmark}" Click="OnChangeRepositoryBookmark">
|
<Button Grid.Column="0" Background="Transparent" Width="16" BorderThickness="0" ToolTip="{DynamicResource Text.RepoCM.Bookmark}" Click="OnChangeRepositoryBookmark">
|
||||||
|
@ -145,23 +142,29 @@
|
||||||
</Path>
|
</Path>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<TextBlock Grid.Column="1" Margin="8,0" Text="{Binding Name}" FontSize="12pt" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
<StackPanel Grid.Column="1" Margin="8,0" Orientation="Horizontal">
|
||||||
<TextBlock Grid.Column="2" Text="{Binding Path}" FontSize="10pt" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" Foreground="{DynamicResource Brush.FG2}"/>
|
<TextBlock Text="{Binding Name}" FontSize="12pt" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
||||||
|
<TextBlock Text="{Binding Path}" FontSize="10pt" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" Margin="8,0" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<Button Grid.Column="4" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Open}" Click="OnOpenRepository">
|
<Button Grid.Column="2" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Open}" Click="OnOpenRepository">
|
||||||
<Path Width="15" Data="{StaticResource Icon.Folder.Open}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="15" Data="{StaticResource Icon.Folder.Open}"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Column="5" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Explore}" Click="OnExploreRepository">
|
<Button Grid.Column="3" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Explore}" Click="OnExploreRepository">
|
||||||
<Path Width="15" Data="{StaticResource Icon.DiffWith}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="14" Data="{StaticResource Icon.DiffWith}"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Column="6" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.Welcome.OpenTerminal}" Click="OnOpenRepositoryTerminal">
|
<Button Grid.Column="4" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.Welcome.OpenTerminal}" Click="OnOpenRepositoryTerminal">
|
||||||
<Path Width="14" Data="{StaticResource Icon.Terminal}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="14" Data="{StaticResource Icon.Terminal}"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Column="7" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.Welcome.Delete}" Click="OnRemoveRepository">
|
<Button Grid.Column="5" Margin="8,0,0,0" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.Welcome.Delete}" Click="OnRemoveRepository">
|
||||||
<Path Width="10" Data="{StaticResource Icon.Close}" Fill="{DynamicResource Brush.Accent1}"/>
|
<Path Width="10" Data="{StaticResource Icon.Close}"/>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Control.Template>
|
||||||
|
</Control>
|
||||||
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
|
@ -106,11 +106,19 @@ namespace SourceGit.Views.Widgets {
|
||||||
var repo = (sender as Button).DataContext as Models.Repository;
|
var repo = (sender as Button).DataContext as Models.Repository;
|
||||||
if (repo == null) return;
|
if (repo == null) return;
|
||||||
|
|
||||||
|
var result = MessageBox.Show(App.Text("ConfirmRemoveRepo", repo.Path), App.Text("Apply.Warn"), MessageBoxButton.YesNo);
|
||||||
|
if (result == MessageBoxResult.Yes) {
|
||||||
Models.Preference.Instance.RemoveRepository(repo.Path);
|
Models.Preference.Instance.RemoveRepository(repo.Path);
|
||||||
UpdateVisibles();
|
UpdateVisibles();
|
||||||
|
}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDoubleClickRepository(object sender, MouseButtonEventArgs e) {
|
||||||
|
OnOpenRepository(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnOpenRepository(object sender, RoutedEventArgs e) {
|
private void OnOpenRepository(object sender, RoutedEventArgs e) {
|
||||||
var repo = (sender as Control).DataContext as Models.Repository;
|
var repo = (sender as Control).DataContext as Models.Repository;
|
||||||
if (repo == null) return;
|
if (repo == null) return;
|
||||||
|
|
Loading…
Reference in a new issue