diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index e8bace1e..1fdc8d54 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -114,7 +114,7 @@ namespace SourceGit.ViewModels repo.Close(); last.Node = new RepositoryNode() { Id = Guid.NewGuid().ToString() }; - last.Data = new Welcome(); + last.Data = Welcome.Instance; GC.Collect(); } diff --git a/src/ViewModels/LauncherPage.cs b/src/ViewModels/LauncherPage.cs index 00c145b3..5fce2bf3 100644 --- a/src/ViewModels/LauncherPage.cs +++ b/src/ViewModels/LauncherPage.cs @@ -27,7 +27,7 @@ namespace SourceGit.ViewModels public LauncherPage() { _node = new RepositoryNode() { Id = Guid.NewGuid().ToString() }; - _data = new Welcome(); + _data = Welcome.Instance; } public LauncherPage(RepositoryNode node, Repository repo) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 73a500b5..bff80053 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -8,7 +8,6 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.Imaging; -using Avalonia.Platform; using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; diff --git a/src/ViewModels/Welcome.cs b/src/ViewModels/Welcome.cs index a6fa1a8a..d4569d05 100644 --- a/src/ViewModels/Welcome.cs +++ b/src/ViewModels/Welcome.cs @@ -9,10 +9,7 @@ namespace SourceGit.ViewModels { public class Welcome : ObservableObject { - public bool IsClearSearchVisible - { - get => !string.IsNullOrEmpty(_searchFilter); - } + public static Welcome Instance => _instance; public AvaloniaList RepositoryNodes { @@ -25,10 +22,7 @@ namespace SourceGit.ViewModels set { if (SetProperty(ref _searchFilter, value)) - { Referesh(); - OnPropertyChanged(nameof(IsClearSearchVisible)); - } } } @@ -205,6 +199,7 @@ namespace SourceGit.ViewModels } } + private static Welcome _instance = new Welcome(); private string _searchFilter = string.Empty; } } diff --git a/src/Views/Welcome.axaml b/src/Views/Welcome.axaml index 96e6bb14..fef229a2 100644 --- a/src/Views/Welcome.axaml +++ b/src/Views/Welcome.axaml @@ -42,7 +42,7 @@ -