From 932db894a5d98a900b3f1de885a394a9870f4661 Mon Sep 17 00:00:00 2001 From: Jai <814683@qq.com> Date: Fri, 23 Jul 2021 13:54:35 +0800 Subject: [PATCH] optimiz: refresh repository information only when switching to tabs --- src/Views/Widgets/Dashboard.xaml.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Views/Widgets/Dashboard.xaml.cs b/src/Views/Widgets/Dashboard.xaml.cs index 1dc0bd70..82f80879 100644 --- a/src/Views/Widgets/Dashboard.xaml.cs +++ b/src/Views/Widgets/Dashboard.xaml.cs @@ -55,13 +55,6 @@ namespace SourceGit.Views.Widgets { InitializeComponent(); InitPages(); - UpdateBraches(); - UpdateWorkingCopy(); - UpdateStashes(); - UpdateTags(); - UpdateSubmodules(); - UpdateSubTrees(); - var watcher = Models.Watcher.Get(repo.Path); watcher.Navigate += NavigateTo; watcher.BranchChanged += UpdateBraches; @@ -79,6 +72,12 @@ namespace SourceGit.Views.Widgets { tagList.ItemsSource = new List(); submoduleList.ItemsSource = new List(); }; + + void FirstShowHandler(object _, DependencyPropertyChangedEventArgs __) { + IsVisibleChanged -= FirstShowHandler; + Refresh(); + } + IsVisibleChanged += FirstShowHandler; } #region POPUP