diff --git a/TSVN/Helpers/CommandHelper.cs b/TSVN/Helpers/CommandHelper.cs index 4fa4a66..39d7da2 100644 --- a/TSVN/Helpers/CommandHelper.cs +++ b/TSVN/Helpers/CommandHelper.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Windows.Forms; using SamirBoulema.TSVN.Properties; using Process = System.Diagnostics.Process; diff --git a/TSVN/Resources/Document_16x.png b/TSVN/Resources/Document_16x.png new file mode 100644 index 0000000..5004e3a Binary files /dev/null and b/TSVN/Resources/Document_16x.png differ diff --git a/TSVN/TSVN.csproj b/TSVN/TSVN.csproj index c6295f8..c54f67a 100644 --- a/TSVN/TSVN.csproj +++ b/TSVN/TSVN.csproj @@ -235,6 +235,7 @@ + Always true diff --git a/TSVN/TSVNToolWindow.cs b/TSVN/TSVNToolWindow.cs index a1a0c78..8c045d1 100644 --- a/TSVN/TSVNToolWindow.cs +++ b/TSVN/TSVNToolWindow.cs @@ -42,17 +42,18 @@ public override void OnToolWindowCreated() _solutionEvents = dte.Events.SolutionEvents; _solutionEvents.Opened += SolutionEvents_Opened; + _tsvnToolWindowControl.GotFocus += _tsvnToolWindowControl_GotFocus; + _tsvnToolWindowControl.HideUnversionedButton.IsChecked = Settings.Default.HideUnversioned; _tsvnToolWindowControl.Update(_commandHelper.GetPendingChanges(), _fileHelper.GetSolutionDir()); } - private void SolutionEvents_Opened() - { - _tsvnToolWindowControl.Update(_commandHelper.GetPendingChanges(), _fileHelper.GetSolutionDir()); - } + private void _tsvnToolWindowControl_GotFocus(object sender, System.Windows.RoutedEventArgs e) => Update(); + private void SolutionEvents_Opened() => Update(); + private void DocumentEvents_DocumentSaved(Document document) => Update(); - private void DocumentEvents_DocumentSaved(Document document) + private void Update() { _tsvnToolWindowControl.Update(_commandHelper.GetPendingChanges(), _fileHelper.GetSolutionDir()); } diff --git a/TSVN/TSVNToolWindowControl.xaml.cs b/TSVN/TSVNToolWindowControl.xaml.cs index 8d922b7..7bbd842 100644 --- a/TSVN/TSVNToolWindowControl.xaml.cs +++ b/TSVN/TSVNToolWindowControl.xaml.cs @@ -43,7 +43,7 @@ public void Update(List pendingChanges, string solutionDir) if (!string.IsNullOrEmpty(solutionDir)) { - var root = new TreeViewItem() { Header = new Label() { Content = $"Changes ({pendingChanges.Count})" }, + var root = new TreeViewItem { Header = new Label { Content = $"Changes ({pendingChanges.Count})" }, IsExpanded = true, FontWeight = FontWeights.Bold, Margin = new Thickness(0,0,0,10) }; var solutionDirItem = CreateFolderTreeViewItem(solutionDir, "S", false); @@ -126,10 +126,15 @@ private TSVNTreeViewItem CreateFileTreeViewItem(string text, string solutionDir, stack.Orientation = Orientation.Horizontal; // create Image - Image image = new Image(); - image.Source = ToImageSource(System.Drawing.Icon.ExtractAssociatedIcon(item.Path)); - image.Width = 16; - image.Height = 16; + var image = new Image + { + Source = + File.Exists(item.Path) + ? ToImageSource(Icon.ExtractAssociatedIcon(item.Path)) + : new BitmapImage(new Uri("Resources\\Document_16x.png", UriKind.Relative)), + Width = 16, + Height = 16 + }; // Label Label lbl = new Label();