Skip to content

Commit

Permalink
Merge pull request #6 from DarkOoze/master
Browse files Browse the repository at this point in the history
Add VS2022 support
  • Loading branch information
LaggAt authored Aug 17, 2022
2 parents dfd8929 + 5ce45a3 commit 3cbd83f
Show file tree
Hide file tree
Showing 18 changed files with 255 additions and 391 deletions.
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

0 comments on commit 3cbd83f

Please sign in to comment.