Skip to content

Commit

Permalink
Merge pull request #7 from StefanKoell/update-deps
Browse files Browse the repository at this point in the history
Update dependencies and remove .net5.0
  • Loading branch information
StefanKoell authored Jun 22, 2023
2 parents 162be77 + 931235d commit dbdcd7b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![NuGet Version](https://img.shields.io/nuget/v/RoyalApps.Community.ExternalApps.WinForms.svg?style=flat)](https://www.nuget.org/packages/RoyalApps.Community.ExternalApps.WinForms)
[![NuGet Downloads](https://img.shields.io/nuget/dt/RoyalApps.Community.ExternalApps.WinForms.svg?color=green)](https://www.nuget.org/packages/RoyalApps.Community.ExternalApps.WinForms)
[![.NET Framework](https://img.shields.io/badge/.NET%20Framework-%3E%3D%204.62-512bd4)](https://dotnet.microsoft.com/download)
[![.NET](https://img.shields.io/badge/.NET-%3E%3D%20%205.0-blueviolet)](https://dotnet.microsoft.com/download)
[![.NET](https://img.shields.io/badge/.NET-%3E%3D%20%206.0-blueviolet)](https://dotnet.microsoft.com/download)

RoyalApps.Community.ExternalApps contains projects/packages to easily embed/use other external applications in an application.
![Screenshot](https://raw.githubusercontent.com/royalapplications/royalapps-community-externalapps/main/docs/assets/Screenshot.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void MenuItemApplication_DropDownOpening(object sender, EventArgs e)
MenuItemDetach.Enabled = false;
MenuItemApplication.Tag = null;

if (ActiveControl.FindFocusedControl() is not ExternalAppHost externalAppHost)
if (ActiveControl?.FindFocusedControl() is not ExternalAppHost externalAppHost)
return;

MenuItemApplication.Tag = externalAppHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
Expand All @@ -25,8 +25,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>RoyalApps_1024.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>0.3.4</Version>
<Version>0.3.5</Version>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -22,7 +22,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>net472;net5.0-windows;net6.0-windows;net7.0-windows</TargetFrameworks>
<TargetFrameworks>net472;net6.0-windows;net7.0-windows</TargetFrameworks>
<RuntimeIdentifiers>win</RuntimeIdentifiers>
<UseWindowsForms>true</UseWindowsForms>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -34,15 +34,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.1.619-beta">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.2-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows' or '$(TargetFramework)' == 'net6.0-windows' or '$(TargetFramework)' == 'net7.0-windows'">
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="System.Management" Version="7.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
var provider = new ProcessWindowProvider(_loggerFactory.CreateLogger<ProcessWindowProvider>());
window = provider
.GetProcessWindows()
.First(w => w.WindowHandle.Value == queryWindowEventArgs.WindowHandle);
.First(w => w.WindowHandle.Value.ToInt32() == queryWindowEventArgs.WindowHandle);
}

if (window == null)
Expand Down Expand Up @@ -312,11 +312,10 @@ public async Task StartAsync(CancellationToken cancellationToken)
configuration.Executable ?? string.Empty,
configuration.Arguments ?? string.Empty)
{
WindowStyle = configuration.StartHidden && !configuration.StartExternal
WindowStyle = configuration is {StartHidden: true, StartExternal: false}
? ProcessWindowStyle.Minimized
: ProcessWindowStyle.Normal,
CreateNoWindow = configuration.StartHidden &&
!configuration.StartExternal,
CreateNoWindow = configuration is {StartHidden: true, StartExternal: false},
UseShellExecute = true,
WorkingDirectory = configuration.WorkingDirectory ?? ".",
LoadUserProfile = configuration.LoadUserProfile,
Expand Down Expand Up @@ -376,13 +375,8 @@ public async Task StartAsync(CancellationToken cancellationToken)
if (managementBaseObject is not ManagementObject wmiWin32Process)
continue;

var commandLine = wmiWin32Process["CommandLine"] != null
? wmiWin32Process["CommandLine"].ToString()
: string.Empty;

var processIdString = wmiWin32Process["ProcessId"] != null
? wmiWin32Process["ProcessId"].ToString()
: string.Empty;
var commandLine = wmiWin32Process["CommandLine"].ToString();
var processIdString = wmiWin32Process["ProcessId"].ToString();

// check if we can parse the process id and if we have a valid command line
if (!int.TryParse(processIdString, out var processId))
Expand Down

0 comments on commit dbdcd7b

Please # to comment.