Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VS2022 support #6

Merged
merged 5 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions ActivityWatch.API/ActivityWatch.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -33,18 +32,16 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
Expand All @@ -65,10 +62,12 @@
<Compile Include="V1\NSwagGenerated.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
<None Include="packages.config" />
<None Include="V1\NSwagConfig.nswag" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file removed ActivityWatch.API/Key.snk
Binary file not shown.
4 changes: 2 additions & 2 deletions ActivityWatch.API/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.9.0")]
[assembly: AssemblyFileVersion("1.9.0")]
4 changes: 0 additions & 4 deletions ActivityWatch.API/packages.config

This file was deleted.

35 changes: 19 additions & 16 deletions ActivityWatchVS/AWPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,52 +82,55 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
{
_progress = progress;
_progress.Report(new ServiceProgressData("ActivityWatchVS starting"));
this.DisposalToken.Register(() => shutdown());
this.DisposalToken.Register(() => this.Dispose());

// background thread
await BackgroundThreadInitialization();
await JoinableTaskFactory.StartOnIdle(() => BackgroundThreadInitializationAsync(), VsTaskRunContext.UIThreadBackgroundPriority);

// main thread
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await MainThreadInitialization();
await MainThreadInitializationAsync();

_isReady = true;
_progress.Report(new ServiceProgressData("ActivityWatchVS running"));
}

private async Task BackgroundThreadInitialization()
private async Task BackgroundThreadInitializationAsync()
{
// Logger
_logService = new Services.LogService(this, await GetServiceAsync(typeof(SVsGeneralOutputWindowPane)) as IVsOutputWindowPane);

try
{
// ... Services VS
_dte2Service = await GetServiceAsync(typeof(DTE)) as DTE2;

// ... our Services
_awBinaryService = new Services.AwBinaryService(this);
_eventService = new Services.EventService(this);
_awBinaryService = new AwBinaryService(this);
_eventService = new EventService(this);

// we are ready to send events

// ... Listeners
_dte2EventListener = new Listeners.DTE2EventListener(this);
_dte2EventListener = new DTE2EventListener(this);
}
catch (Exception ex)
{
_logService.Log(ex, "ActivityWatchVS: This is a bug, please report it!", activate: true);
_logService?.Log(ex, "ActivityWatchVS: This is a bug, please report it!");
}
}

private async Task MainThreadInitialization()
private async Task MainThreadInitializationAsync()
{
try {
await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);

// Logger
_logService = new LogService(this, await GetServiceAsync(typeof(SVsGeneralOutputWindowPane)) as IVsOutputWindowPane);

try
{
// single class for AW ini file and our own settings
_awOptions = await Services.AWOptionService.InitializeAsync(this);
_awOptions = Services.AWOptionService.Initialize(this);
}
catch (Exception ex)
{
_logService.Log(ex, "ActivityWatchVS: This is a bug, please report it!", activate: true);
_logService.Log(ex, "ActivityWatchVS: This is a bug, please report it!");
}
}

Expand Down
Loading