mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
style<Welcome,PageTabBar>: re-design the style for Welcome page
This commit is contained in:
parent
5ef6642306
commit
1beafbc84c
2 changed files with 48 additions and 49 deletions
|
@ -132,54 +132,48 @@
|
|||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Control MouseDoubleClick="OnDoubleClickRepository">
|
||||
<Control.Template>
|
||||
<ControlTemplate>
|
||||
<Border
|
||||
Height="36"
|
||||
Margin="2"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}">
|
||||
<Grid Margin="8,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border
|
||||
Height="36"
|
||||
Margin="2"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}">
|
||||
<Grid Margin="8,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Column="0" Background="Transparent" Width="16" BorderThickness="0" ToolTip="{DynamicResource Text.RepoCM.Bookmark}" Click="OnChangeRepositoryBookmark">
|
||||
<Path Width="8" Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}">
|
||||
<Path.Data>
|
||||
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Button>
|
||||
<Button Grid.Column="0" Background="Transparent" Width="16" BorderThickness="0" ToolTip="{DynamicResource Text.RepoCM.Bookmark}" Click="OnChangeRepositoryBookmark">
|
||||
<Path Width="8" Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}">
|
||||
<Path.Data>
|
||||
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</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}"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Path}" FontSize="10pt" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
<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}"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Path}" FontSize="10pt" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
|
||||
<Button Grid.Column="4" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Open}" Click="OnOpenRepository">
|
||||
<Path Width="15" Data="{StaticResource Icon.Folder.Open}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="5" 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}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="6" 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}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="7" 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}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Control.Template>
|
||||
</Control>
|
||||
<Button Grid.Column="4" BorderThickness="0" Background="Transparent" ToolTip="{DynamicResource Text.RepoCM.Open}" Click="OnOpenRepository">
|
||||
<Path Width="15" Data="{StaticResource Icon.Folder.Open}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="5" 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}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="6" 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}"/>
|
||||
</Button>
|
||||
<Button Grid.Column="7" 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}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
|
|
@ -69,23 +69,25 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
private void OnRemoveRepository(object sender, RoutedEventArgs e) {
|
||||
var repo = (sender as Button).DataContext as Models.Repository;
|
||||
if (repo == null) return;
|
||||
|
||||
Models.Preference.Instance.RemoveRepository(repo.Path);
|
||||
UpdateVisibles();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnDoubleClickRepository(object sender, MouseButtonEventArgs e) {
|
||||
OnOpenRepository(sender, e);
|
||||
}
|
||||
|
||||
private void OnOpenRepository(object sender, RoutedEventArgs e) {
|
||||
var repo = (sender as Control).DataContext as Models.Repository;
|
||||
if (repo == null) return;
|
||||
|
||||
CheckAndOpen(repo.Path);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnExploreRepository(object sender, RoutedEventArgs e) {
|
||||
var repo = (sender as Control).DataContext as Models.Repository;
|
||||
if (repo == null) return;
|
||||
|
||||
Process.Start("explorer", repo.Path);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -93,6 +95,7 @@ namespace SourceGit.Views.Widgets {
|
|||
private void OnChangeRepositoryBookmark(object sender, RoutedEventArgs e) {
|
||||
var btn = (sender as Button);
|
||||
var repo = btn.DataContext as Models.Repository;
|
||||
if (repo == null) return;
|
||||
|
||||
var menu = new ContextMenu();
|
||||
menu.Placement = PlacementMode.Bottom;
|
||||
|
@ -130,6 +133,8 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
private void OnOpenRepositoryTerminal(object sender, RoutedEventArgs e) {
|
||||
var repo = (sender as Button).DataContext as Models.Repository;
|
||||
if (repo == null) return;
|
||||
|
||||
var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
|
||||
if (!File.Exists(bash)) {
|
||||
Models.Exception.Raise(App.Text("MissingBash"));
|
||||
|
|
Loading…
Reference in a new issue