Skip to content

Commit

Permalink
#13
Browse files Browse the repository at this point in the history
  • Loading branch information
sboulema committed Nov 28, 2016
1 parent 65044d1 commit 4427fdf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions TSVN/Helpers/CommandHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file added TSVN/Resources/Document_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions TSVN/TSVN.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<ItemGroup>
<Resource Include="Resources\FolderOpen_16x.png" />
<Resource Include="Resources\Folder_16x.png" />
<Resource Include="Resources\Document_16x.png" />
<Content Include="Resources\GettingStartedGuide.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
Expand Down
11 changes: 6 additions & 5 deletions TSVN/TSVNToolWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
15 changes: 10 additions & 5 deletions TSVN/TSVNToolWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Update(List<string> 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);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4427fdf

Please sign in to comment.