mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-22 17:29:12 -05:00
Added strong naming and fixed a dependency (#34)
* Added strong naming for the .NET Framework 4.x dlls as was discussed in #3. Strong naming doesn't help for security but it's sometimes needed as companies want to build strongly named assemblies themselves, and these can only use other strong named assembly. The general way to do this, is to sign the assembly with a public known snk file (Which is in the repository) so it's strongly named but without negative side effects. * Fixed a tricky issue with .resx files, concerns GenerateResourceUsePreserializedResources and dependencies. * Fixed the copyright years. * Fixed an issue with SystemInfo, somehow the DpiFactorX/DpiFactorY weren't initialized. * As net45 doesn't build with "dotnet build", we need to use msbuild instead. * Removing unneeded packages for net4x * msbuild needs nuget restore before the build to work * Make sure that PRs don't push the packages to the nuget feed (will fail anyway)
This commit is contained in:
@@ -32,17 +32,24 @@ stages:
|
||||
versionSpec: '5.5.1'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk 3.1.2'
|
||||
displayName: 'Use .NET Core sdk 3.1.6'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: 3.1.201
|
||||
version: 3.1.302
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Build
|
||||
- task: NuGetCommand@2
|
||||
displayName: NuGet restore
|
||||
inputs:
|
||||
command: build
|
||||
projects: '$(solution)'
|
||||
arguments: '--configuration $(buildConfiguration) /p:Platform="$(buildPlatform)"'
|
||||
command: 'restore'
|
||||
restoreSolution: '$(solution)'
|
||||
feedsToUse: config
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: Build and package
|
||||
inputs:
|
||||
solution: '$(solution)'
|
||||
platform: $(buildPlatform)
|
||||
configuration: $(buildConfiguration)
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
|
||||
@@ -58,7 +65,7 @@ stages:
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: 'Publish to wpf-notifyicon feed'
|
||||
condition: succeeded()
|
||||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
|
||||
inputs:
|
||||
command: 'push'
|
||||
versioningScheme: byBuildNumber
|
||||
|
||||
@@ -22,6 +22,12 @@ Source code and extensive sample application available at http://www.hardcodet.n
|
||||
<tags>NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast</tags>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<GenerateResourceUsePreserializedResources>false</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
@@ -48,8 +54,14 @@ Source code and extensive sample application available at http://www.hardcodet.n
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\NotifyIconWpf.snk</AssemblyOriginatorKeyFile>
|
||||
<DelaySign>false</DelaySign>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="3.1.91">
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="3.2.31">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
BIN
src/NotifyIconWpf.snk
Normal file
BIN
src/NotifyIconWpf.snk
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the Code Project Open License (CPOL);
|
||||
// either version 1.0 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// THIS COPYRIGHT NOTICE MAY NOT BE REMOVED FROM THIS FILE
|
||||
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
@@ -7,29 +30,34 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// </summary>
|
||||
public static class SystemInfo
|
||||
{
|
||||
private static readonly System.Windows.Point DpiFactors;
|
||||
|
||||
static SystemInfo()
|
||||
{
|
||||
UpdateFactors();
|
||||
}
|
||||
|
||||
internal static void UpdateFactors()
|
||||
{
|
||||
using (var source = new HwndSource(new HwndSourceParameters()))
|
||||
{
|
||||
if (source.CompositionTarget?.TransformToDevice != null)
|
||||
{
|
||||
DpiFactors = new System.Windows.Point(source.CompositionTarget.TransformToDevice.M11, source.CompositionTarget.TransformToDevice.M22);
|
||||
DpiFactorX = source.CompositionTarget.TransformToDevice.M11;
|
||||
DpiFactorY = source.CompositionTarget.TransformToDevice.M22;
|
||||
return;
|
||||
}
|
||||
DpiFactors = new System.Windows.Point(1, 1);
|
||||
}
|
||||
|
||||
DpiFactorX = DpiFactorY = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the DPI X Factor
|
||||
/// </summary>
|
||||
public static double DpiFactorX => DpiFactors.X;
|
||||
public static double DpiFactorX { get; private set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the DPI Y Factor
|
||||
/// </summary>
|
||||
public static double DpiFactorY => DpiFactors.Y;
|
||||
public static double DpiFactorY { get; private set; } = 1;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
<AssemblyName>Hardcodet.NotifyIcon.Wpf</AssemblyName>
|
||||
<AssemblyTitle>NotifyIcon for WPF</AssemblyTitle>
|
||||
<Product>NotifyIcon WPF</Product>
|
||||
<TargetFrameworks>net45;net472;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net45;net472;netcoreapp3.1</TargetFrameworks>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>NotifyIconWpf.snk</AssemblyOriginatorKeyFile>
|
||||
<DelaySign>false</DelaySign>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
|
||||
<PackageReference Include="System.Resources.Extensions" Version="4.7.0" PrivateAssets="All" />
|
||||
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
|
||||
<PackageReference Include="System.Resources.Extensions" Version="4.7.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
|
||||
BIN
src/NotifyIconWpf/NotifyIconWpf.snk
Normal file
BIN
src/NotifyIconWpf/NotifyIconWpf.snk
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// hardcodet.net NotifyIcon for WPF
|
||||
// Copyright (c) 2009 - 2013 Philipp Sumi
|
||||
// Copyright (c) 2009 - 2020 Philipp Sumi
|
||||
// Contact and Information: http://www.hardcodet.net
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the Code Project Open License (CPOL);
|
||||
// either version 1.0 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
|
||||
@@ -5,15 +5,10 @@
|
||||
<RootNamespace>Samples</RootNamespace>
|
||||
<AssemblyTitle>Sample Project</AssemblyTitle>
|
||||
<Product>Sample Project</Product>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
|
||||
<PackageReference Include="System.Resources.Extensions" Version="4.7.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<Reference Include="PresentationFramework.Aero" />
|
||||
<Reference Include="System.Xaml" />
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFrameworks>net45;net472;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net45;net472;netcoreapp3.1</TargetFrameworks>
|
||||
<RootNamespace>Windowless_Sample</RootNamespace>
|
||||
<AssemblyTitle>Windowless Sample</AssemblyTitle>
|
||||
<Product>Windowless Sample</Product>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
|
||||
<PackageReference Include="System.Resources.Extensions" Version="4.7.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@@ -19,12 +19,14 @@ namespace WindowsFormsSample
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
notifyIcon = new TaskbarIcon();
|
||||
notifyIcon.Icon = Resources.Led;
|
||||
notifyIcon.ToolTipText = "Left-click to open popup";
|
||||
notifyIcon.Visibility = Visibility.Visible;
|
||||
notifyIcon = new TaskbarIcon
|
||||
{
|
||||
Icon = Resources.Led,
|
||||
ToolTipText = "Left-click to open popup",
|
||||
Visibility = Visibility.Visible,
|
||||
TrayPopup = new FancyPopup()
|
||||
};
|
||||
|
||||
notifyIcon.TrayPopup = new FancyPopup();
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
|
||||
@@ -5,14 +5,11 @@
|
||||
<StartupObject>WindowsFormsSample.Program</StartupObject>
|
||||
<AssemblyTitle>WindowsFormsSample</AssemblyTitle>
|
||||
<Product>WindowsFormsSample</Product>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
|
||||
<PackageReference Include="System.Resources.Extensions" Version="4.7.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "3.1.200",
|
||||
"rollForward": "latestPatch"
|
||||
"version": "3.1.100",
|
||||
"rollForward": "latestMajor",
|
||||
"allowPrerelease": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user