style<Welcome,PageTabBar>: re-design the style for Welcome page

This commit is contained in:
leo 2022-10-14 20:56:57 +08:00
parent 5ef6642306
commit 1beafbc84c
2 changed files with 48 additions and 49 deletions

View file

@ -132,9 +132,6 @@
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Control MouseDoubleClick="OnDoubleClickRepository">
<Control.Template>
<ControlTemplate>
<Border <Border
Height="36" Height="36"
Margin="2" Margin="2"
@ -177,9 +174,6 @@
</Button> </Button>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate>
</Control.Template>
</Control>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>

View file

@ -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"));