Skip to content

Commit

Permalink
Removed further inused classes.
Browse files Browse the repository at this point in the history
Fixed some issues in package & pane
  • Loading branch information
StefanKert committed Mar 20, 2019
1 parent 9fbfd93 commit ed47ff2
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 56 deletions.
5 changes: 0 additions & 5 deletions src/BuildVision.UI/BuildVision.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\Indicators\Indicators.Test.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Page>
<Page Include="MainWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
2 changes: 1 addition & 1 deletion src/BuildVision.UI/Components/ControlView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@
</Grid>
</StackPanel>

<components:ProjectGrid DataContext="{Binding}" Grid.Row="1"/>
<!--<components:ProjectGrid DataContext="{Binding}" Grid.Row="1"/>-->
</Grid>
</UserControl>
3 changes: 0 additions & 3 deletions src/BuildVision.UI/Components/ControlView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ public partial class ControlView : UserControl
public ControlView()
{
InitializeComponent();

// Ensure the current culture passed into bindings is the OS culture.
// By default, WPF uses en-US as the culture, regardless of the system settings.
Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);

//Grid.TargetUpdated += GridOnTargetUpdated;
}

private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
Expand Down
2 changes: 2 additions & 0 deletions src/BuildVision.UI/Components/ProjectGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public partial class ProjectGrid : UserControl
public ProjectGrid()
{
InitializeComponent();

Grid.TargetUpdated += GridOnTargetUpdated;
}

private void GridOnTargetUpdated(object sender, DataTransferEventArgs e)
Expand Down
28 changes: 0 additions & 28 deletions src/BuildVision.UI/Controls/Indicators/Indicators.Test.xaml

This file was deleted.

4 changes: 2 additions & 2 deletions src/BuildVision.UI/ViewModels/BuildVisionPaneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ public void SyncColumnSettings()

public void OnControlSettingsChanged(ControlSettings settings)
{
//ControlSettings.InitFrom(settings);
ControlSettings.InitFrom(settings);

GenerateColumns();

// Refresh build message
//Refresh build message
//if (_buildState == BuildState.Done)
//{
// Model.TextCurrentState = getBuildMessage(_buildInfo);
Expand Down
49 changes: 41 additions & 8 deletions src/BuildVision/Core/BuildVisionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ public sealed partial class BuildVisionPackage : AsyncPackage, IPackageContext
private DTE _dte;
private DTE2 _dte2;
private SolutionEvents _solutionEvents;
private BuildVisionPaneViewModel _viewModel;
private IVsSolutionBuildManager2 _solutionBuildManager;
private IVsSolutionBuildManager5 _solutionBuildManager4;
private IBuildInformationProvider _buildInformationProvider;
private uint _updateSolutionEvents4Cookie;
private readonly Guid _parsingErrorsLoggerId = new Guid("{64822131-DC4D-4087-B292-61F7E06A7B39}");
private BuildOutputLogger _buildLogger;
private SolutionBuildEvents _solutionBuildEvents;
private ISolutionProvider _solutionProvider;
private IBuildingProjectsProvider _buildingProjectsProvider;
Expand Down Expand Up @@ -121,10 +118,12 @@ private async void ShowToolWindowAsync(object sender, EventArgs e)
{
try
{
var window = ShowToolWindow(Guid.Parse(PackageGuids.GuidBuildVisionToolWindowString));

// Get the instance number 0 of this tool window. This window is single instance so this instance
// is actually the only one.
// The last flag is set to true so that if the tool window does not exists it will be created.
var window = FindToolWindow(typeof(BuildVisionPane), 0, true);
// var window = FindToolWindow(typeof(BuildVisionPane), 0, true);
if (window == null || window.Frame == null)
throw new InvalidOperationException(Resources.CanNotCreateWindow);

Expand All @@ -138,20 +137,54 @@ private async void ShowToolWindowAsync(object sender, EventArgs e)
}
}

public void NotifyControlSettingsChanged()

ToolWindowPane ShowToolWindow(Guid windowGuid)
{
ControlSettingsChanged(ControlSettings);
ThreadHelper.ThrowIfNotOnUIThread();


var shell = GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;
IVsWindowFrame frame;
if (ErrorHandler.Failed(shell.FindToolWindow((uint)__VSCREATETOOLWIN.CTW_fForceCreate,
ref windowGuid, out frame)))
{
return null;
}
if (ErrorHandler.Failed(frame.Show()))
{
return null;
}

object docView = null;
if (ErrorHandler.Failed(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView)))
{
return null;
}
return docView as ToolWindowPane;
}

private ToolWindowPane GetWindowPane(Type windowType)
public void NotifyControlSettingsChanged()
{
return FindToolWindow(windowType, 0, false) ?? FindToolWindow(windowType, 0, true);
ControlSettingsChanged(ControlSettings);
}

public async Task ExecuteCommandAsync(string commandName)
{
await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);
_dte.ExecuteCommand(commandName);
}


async Task EnsurePackageLoaded(Guid packageGuid)
{
await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);

var shell = await GetServiceAsync(typeof(SVsShell)) as IVsShell;
if (shell != null)
{
IVsPackage vsPackage;
ErrorHandler.ThrowOnFailure(shell.LoadPackage(ref packageGuid, out vsPackage));
}
}
}
}
17 changes: 8 additions & 9 deletions src/BuildVision/Core/BuildVisionPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using BuildVision.Tool.Building;
using BuildVision.Exports.Services;
using BuildVision.Views.Settings;
using Microsoft.VisualStudio.Shell.Interop;

namespace BuildVision.Tool
{
Expand Down Expand Up @@ -43,7 +44,7 @@ public BuildVisionPane()
Caption = Resources.ToolWindowTitle;
BitmapResourceID = 301;
BitmapIndex = 1;
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
//FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
}

protected override void Initialize()
Expand All @@ -55,6 +56,7 @@ protected override void Initialize()

viewModelTask = JoinableTaskFactory.RunAsync(() => InitializeAsync(asyncPackage));

base.Initialize();
}

public Task<BuildVisionPaneViewModel> GetViewModelAsync() => viewModelTask.JoinAsync();
Expand All @@ -64,25 +66,22 @@ async Task<BuildVisionPaneViewModel> InitializeAsync(AsyncPackage asyncPackage)
await JoinableTaskFactory.SwitchToMainThreadAsync();
try
{
var sp = (AsyncPackage) Package;
Assumes.Present(sp);
var solutionProvider = await sp.GetServiceAsync(typeof(ISolutionProvider)) as ISolutionProvider;
var solutionProvider = await asyncPackage.GetServiceAsync(typeof(ISolutionProvider)) as ISolutionProvider;
Assumes.Present(solutionProvider);
var buildInformationProvider = await sp.GetServiceAsync(typeof(IBuildInformationProvider)) as IBuildInformationProvider;
var buildInformationProvider = await asyncPackage.GetServiceAsync(typeof(IBuildInformationProvider)) as IBuildInformationProvider;
Assumes.Present(buildInformationProvider);
var buildingProjectsProvider = await sp.GetServiceAsync(typeof(IBuildingProjectsProvider)) as IBuildingProjectsProvider;
var buildingProjectsProvider = await asyncPackage.GetServiceAsync(typeof(IBuildingProjectsProvider)) as IBuildingProjectsProvider;
Assumes.Present(buildingProjectsProvider);
var buildService = await sp.GetServiceAsync(typeof(IBuildService)) as IBuildService;
var buildService = await asyncPackage.GetServiceAsync(typeof(IBuildService)) as IBuildService;
Assumes.Present(buildService);
var packageSettingsProvider = await sp.GetServiceAsync(typeof(IPackageSettingsProvider)) as IPackageSettingsProvider;
var packageSettingsProvider = await asyncPackage.GetServiceAsync(typeof(IPackageSettingsProvider)) as IPackageSettingsProvider;
Assumes.Present(packageSettingsProvider);

var viewModel = new BuildVisionPaneViewModel(buildService, buildingProjectsProvider, buildInformationProvider, packageSettingsProvider, solutionProvider);

View = CreateControlView();
View.DataContext = viewModel;
_controlCreatedSuccessfully = true;
base.Initialize();
return viewModel;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ private void LoadSettings()
var value = _settingsStore.GetString(settingsCategoryName, settingsPropertyName);
Settings = legacySerialized.Deserialize(value);
}
else
{
Settings = new ControlSettings();
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit ed47ff2

Please sign in to comment.