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>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Control MouseDoubleClick="OnDoubleClickRepository">
|
<Border
|
||||||
<Control.Template>
|
Height="36"
|
||||||
<ControlTemplate>
|
Margin="2"
|
||||||
<Border
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
Height="36"
|
Background="{DynamicResource Brush.Contents}">
|
||||||
Margin="2"
|
<Grid Margin="8,0">
|
||||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
<Grid.ColumnDefinitions>
|
||||||
Background="{DynamicResource Brush.Contents}">
|
<ColumnDefinition Width="Auto"/>
|
||||||
<Grid Margin="8,0">
|
<ColumnDefinition Width="Auto"/>
|
||||||
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<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>
|
||||||
<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">
|
<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 Width="8" Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}">
|
||||||
<Path.Data>
|
<Path.Data>
|
||||||
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
||||||
</Path.Data>
|
</Path.Data>
|
||||||
</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}"/>
|
<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="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">
|
<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}"/>
|
<Path Width="15" Data="{StaticResource Icon.Folder.Open}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||||
</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="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}"/>
|
<Path Width="15" Data="{StaticResource Icon.DiffWith}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||||
</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="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}"/>
|
<Path Width="14" Data="{StaticResource Icon.Terminal}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||||
</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="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}"/>
|
<Path Width="10" Data="{StaticResource Icon.Close}" Fill="{DynamicResource Brush.Accent1}"/>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
|
||||||
</Control.Template>
|
|
||||||
</Control>
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
|
@ -69,23 +69,25 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
private void OnRemoveRepository(object sender, RoutedEventArgs e) {
|
private void OnRemoveRepository(object sender, RoutedEventArgs e) {
|
||||||
var repo = (sender as Button).DataContext as Models.Repository;
|
var repo = (sender as Button).DataContext as Models.Repository;
|
||||||
|
if (repo == null) return;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
CheckAndOpen(repo.Path);
|
CheckAndOpen(repo.Path);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExploreRepository(object sender, RoutedEventArgs e) {
|
private void OnExploreRepository(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;
|
||||||
|
|
||||||
Process.Start("explorer", repo.Path);
|
Process.Start("explorer", repo.Path);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +95,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
private void OnChangeRepositoryBookmark(object sender, RoutedEventArgs e) {
|
private void OnChangeRepositoryBookmark(object sender, RoutedEventArgs e) {
|
||||||
var btn = (sender as Button);
|
var btn = (sender as Button);
|
||||||
var repo = btn.DataContext as Models.Repository;
|
var repo = btn.DataContext as Models.Repository;
|
||||||
|
if (repo == null) return;
|
||||||
|
|
||||||
var menu = new ContextMenu();
|
var menu = new ContextMenu();
|
||||||
menu.Placement = PlacementMode.Bottom;
|
menu.Placement = PlacementMode.Bottom;
|
||||||
|
@ -130,6 +133,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
private void OnOpenRepositoryTerminal(object sender, RoutedEventArgs e) {
|
private void OnOpenRepositoryTerminal(object sender, RoutedEventArgs e) {
|
||||||
var repo = (sender as Button).DataContext as Models.Repository;
|
var repo = (sender as Button).DataContext as Models.Repository;
|
||||||
|
if (repo == null) return;
|
||||||
|
|
||||||
var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
|
var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
|
||||||
if (!File.Exists(bash)) {
|
if (!File.Exists(bash)) {
|
||||||
Models.Exception.Raise(App.Text("MissingBash"));
|
Models.Exception.Raise(App.Text("MissingBash"));
|
||||||
|
|
Loading…
Reference in a new issue