diff --git a/CodeNav.Shared/Models/CodeClassItem.cs b/CodeNav.Shared/Models/CodeClassItem.cs index 63f6b2d..2dbfdd5 100644 --- a/CodeNav.Shared/Models/CodeClassItem.cs +++ b/CodeNav.Shared/Models/CodeClassItem.cs @@ -1,10 +1,12 @@ #nullable enable using CodeNav.Helpers; +using Microsoft.VisualStudio.PlatformUI; using System; using System.Collections.Generic; using System.Linq; using System.Windows; +using System.Windows.Input; using System.Windows.Media; namespace CodeNav.Models @@ -69,5 +71,12 @@ public Visibility HasMembersVisibility : Visibility.Collapsed; } } + + public ICommand ToggleIsExpandedCommand => new DelegateCommand(ToggleIsExpanded); + public void ToggleIsExpanded(object args) + { + IsDoubleClicked = true; + IsExpanded = !IsExpanded; + } } } diff --git a/CodeNav.Shared/Models/CodeItem.cs b/CodeNav.Shared/Models/CodeItem.cs index 59c5cab..aa0abc0 100644 --- a/CodeNav.Shared/Models/CodeItem.cs +++ b/CodeNav.Shared/Models/CodeItem.cs @@ -14,6 +14,7 @@ using System.Runtime.Serialization; using Task = System.Threading.Tasks.Task; using Microsoft.VisualStudio.Shell; +using System.Threading; namespace CodeNav.Models { @@ -108,6 +109,8 @@ public bool ContextMenuIsOpen set => SetProperty(ref _contextMenuIsOpen, value); } + public bool IsDoubleClicked; + #region Fonts private float _fontSize; public float FontSize @@ -199,10 +202,20 @@ public Color NameBackgroundColor #region Commands public ICommand ClickItemCommand => new DelegateCommand(ClickItem); - public void ClickItem(object args) + public void ClickItem() => ClickItemAsync().FireAndForget(); + + private async Task ClickItemAsync() { + await Task.Delay(200); + + if (IsDoubleClicked) + { + IsDoubleClicked = false; + return; + } + HistoryHelper.AddItemToHistory(this); - DocumentHelper.ScrollToLine(StartLinePosition, FilePath).FireAndForget(); + await DocumentHelper.ScrollToLine(StartLinePosition, FilePath); } public ICommand GoToDefinitionCommand => new DelegateCommand(GoToDefinition); diff --git a/CodeNav.Shared/Styles/PlusMinusExpanderStyles.xaml b/CodeNav.Shared/Styles/PlusMinusExpanderStyles.xaml index 50ee680..8804641 100644 --- a/CodeNav.Shared/Styles/PlusMinusExpanderStyles.xaml +++ b/CodeNav.Shared/Styles/PlusMinusExpanderStyles.xaml @@ -69,9 +69,7 @@ -