From d26446c1b01d90575b386cbea469def51321e4c2 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 29 Nov 2020 22:34:48 +0800 Subject: [PATCH] optimize: use IsLoaded instead of checking element with null --- src/UI/Dashboard.xaml.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UI/Dashboard.xaml.cs b/src/UI/Dashboard.xaml.cs index 2b99798f..b10c2798 100644 --- a/src/UI/Dashboard.xaml.cs +++ b/src/UI/Dashboard.xaml.cs @@ -92,8 +92,8 @@ namespace SourceGit.UI { args = args + "--branches --remotes --tags"; } - var commits = repo.Commits(args); - histories.SetCommits(commits); + var data = repo.Commits(args); + histories.SetCommits(data); }); } @@ -463,7 +463,7 @@ namespace SourceGit.UI { #region WORKSPACE private void SwitchWorkingCopy(object sender, RoutedEventArgs e) { - if (commits == null || histories == null || stashes == null) return; + if (!IsLoaded) return; commits.Visibility = Visibility.Visible; histories.Visibility = Visibility.Collapsed; @@ -475,7 +475,7 @@ namespace SourceGit.UI { } private void SwitchHistories(object sender, RoutedEventArgs e) { - if (commits == null || histories == null || stashes == null) return; + if (!IsLoaded) return; commits.Visibility = Visibility.Collapsed; histories.Visibility = Visibility.Visible; @@ -487,7 +487,7 @@ namespace SourceGit.UI { } private void SwitchStashes(object sender, RoutedEventArgs e) { - if (commits == null || histories == null || stashes == null) return; + if (!IsLoaded) return; commits.Visibility = Visibility.Collapsed; histories.Visibility = Visibility.Collapsed;