From 1beafbc84cc3daa757bf0f113231979a80851a6f Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 14 Oct 2022 20:56:57 +0800 Subject: [PATCH] style: re-design the style for Welcome page --- src/Views/Widgets/Welcome.xaml | 84 ++++++++++++++----------------- src/Views/Widgets/Welcome.xaml.cs | 13 +++-- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/Views/Widgets/Welcome.xaml b/src/Views/Widgets/Welcome.xaml index 3c0a8880..0c65b5a3 100644 --- a/src/Views/Widgets/Welcome.xaml +++ b/src/Views/Widgets/Welcome.xaml @@ -132,54 +132,48 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + - + - - + + - - - - - - - - - + + + + + + diff --git a/src/Views/Widgets/Welcome.xaml.cs b/src/Views/Widgets/Welcome.xaml.cs index 8ff4c429..33eea2be 100644 --- a/src/Views/Widgets/Welcome.xaml.cs +++ b/src/Views/Widgets/Welcome.xaml.cs @@ -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"));