From 18e8036e118d7de5ebbaea861d8c7d84adc52aad Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 18 Oct 2022 11:24:42 +0800 Subject: [PATCH] feature: enable mouse double-click on repository --- src/Resources/Locales/en_US.xaml | 1 + src/Resources/Locales/zh_CN.xaml | 1 + src/Views/Widgets/Welcome.xaml | 115 +++++++++++++++--------------- src/Views/Widgets/Welcome.xaml.cs | 12 +++- 4 files changed, 71 insertions(+), 58 deletions(-) diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index e3ee6da2..e880d98a 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -538,4 +538,5 @@ Invalid relative path Invalid path for archive file This field is required + You are removing repository '{0}'. Are you sure to continue? \ No newline at end of file diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 049c0aea..41e34d21 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -537,4 +537,5 @@ 非法的子路径! 非法的存档文件路径! 内容未填写! + 正在将 '{0}' 从列表中移除,是否要继续? \ No newline at end of file diff --git a/src/Views/Widgets/Welcome.xaml b/src/Views/Widgets/Welcome.xaml index e908a720..cc898115 100644 --- a/src/Views/Widgets/Welcome.xaml +++ b/src/Views/Widgets/Welcome.xaml @@ -27,10 +27,11 @@ - - - - + + + + + - + - + @@ -120,48 +117,54 @@ - - - - - - - - - - - - + + + + + + + + + + + + + - + - - + + + + - - - - - - + + + + + + + + + + diff --git a/src/Views/Widgets/Welcome.xaml.cs b/src/Views/Widgets/Welcome.xaml.cs index fdddc5d6..da169d09 100644 --- a/src/Views/Widgets/Welcome.xaml.cs +++ b/src/Views/Widgets/Welcome.xaml.cs @@ -106,11 +106,19 @@ namespace SourceGit.Views.Widgets { var repo = (sender as Button).DataContext as Models.Repository; if (repo == null) return; - Models.Preference.Instance.RemoveRepository(repo.Path); - UpdateVisibles(); + 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); + 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;