diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1d9fadf..a0f0424 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index cc136e1..849d6d3 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,6 +22,12 @@ Source code and extensive sample application available at http://www.hardcodet.n NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast + + true + + + false + true @@ -48,8 +54,14 @@ Source code and extensive sample application available at http://www.hardcodet.n true + + true + ..\NotifyIconWpf.snk + false + + - + all runtime; build; native; contentfiles; analyzers diff --git a/src/NotifyIconWpf.snk b/src/NotifyIconWpf.snk new file mode 100644 index 0000000..30e2369 Binary files /dev/null and b/src/NotifyIconWpf.snk differ diff --git a/src/NotifyIconWpf/BalloonIcon.cs b/src/NotifyIconWpf/BalloonIcon.cs index 4979133..bda8c85 100644 --- a/src/NotifyIconWpf/BalloonIcon.cs +++ b/src/NotifyIconWpf/BalloonIcon.cs @@ -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 diff --git a/src/NotifyIconWpf/Interop/SystemInfo.cs b/src/NotifyIconWpf/Interop/SystemInfo.cs index 3171a8b..9671af6 100644 --- a/src/NotifyIconWpf/Interop/SystemInfo.cs +++ b/src/NotifyIconWpf/Interop/SystemInfo.cs @@ -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 /// 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; } /// /// Returns the DPI X Factor /// - public static double DpiFactorX => DpiFactors.X; + public static double DpiFactorX { get; private set; } = 1; /// /// Returns the DPI Y Factor /// - public static double DpiFactorY => DpiFactors.Y; + public static double DpiFactorY { get; private set; } = 1; } } \ No newline at end of file diff --git a/src/NotifyIconWpf/Interop/WindowMessageSink.cs b/src/NotifyIconWpf/Interop/WindowMessageSink.cs index 19b5eac..97f0392 100644 --- a/src/NotifyIconWpf/Interop/WindowMessageSink.cs +++ b/src/NotifyIconWpf/Interop/WindowMessageSink.cs @@ -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 diff --git a/src/NotifyIconWpf/Interop/WindowsMessages.cs b/src/NotifyIconWpf/Interop/WindowsMessages.cs index 2d4b8ec..51ae1bf 100644 --- a/src/NotifyIconWpf/Interop/WindowsMessages.cs +++ b/src/NotifyIconWpf/Interop/WindowsMessages.cs @@ -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 diff --git a/src/NotifyIconWpf/NotifyIconWpf.csproj b/src/NotifyIconWpf/NotifyIconWpf.csproj index 454fc1b..1307fc6 100644 --- a/src/NotifyIconWpf/NotifyIconWpf.csproj +++ b/src/NotifyIconWpf/NotifyIconWpf.csproj @@ -4,11 +4,14 @@ Hardcodet.NotifyIcon.Wpf NotifyIcon for WPF NotifyIcon WPF - net45;net472;netcoreapp3.0;netcoreapp3.1 + net45;net472;netcoreapp3.1 + true + NotifyIconWpf.snk + false - - + + diff --git a/src/NotifyIconWpf/NotifyIconWpf.snk b/src/NotifyIconWpf/NotifyIconWpf.snk new file mode 100644 index 0000000..ec0afc5 Binary files /dev/null and b/src/NotifyIconWpf/NotifyIconWpf.snk differ diff --git a/src/NotifyIconWpf/PopupActivationMode.cs b/src/NotifyIconWpf/PopupActivationMode.cs index 1415f39..a8eac95 100644 --- a/src/NotifyIconWpf/PopupActivationMode.cs +++ b/src/NotifyIconWpf/PopupActivationMode.cs @@ -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 diff --git a/src/NotifyIconWpf/TaskbarIcon.Declarations.cs b/src/NotifyIconWpf/TaskbarIcon.Declarations.cs index b4a582e..2e994f3 100644 --- a/src/NotifyIconWpf/TaskbarIcon.Declarations.cs +++ b/src/NotifyIconWpf/TaskbarIcon.Declarations.cs @@ -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 diff --git a/src/NotifyIconWpf/TaskbarIcon.cs b/src/NotifyIconWpf/TaskbarIcon.cs index b590a6b..afc2a7b 100644 --- a/src/NotifyIconWpf/TaskbarIcon.cs +++ b/src/NotifyIconWpf/TaskbarIcon.cs @@ -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 diff --git a/src/NotifyIconWpf/Util.cs b/src/NotifyIconWpf/Util.cs index 5e753f6..22fa7a3 100644 --- a/src/NotifyIconWpf/Util.cs +++ b/src/NotifyIconWpf/Util.cs @@ -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 diff --git a/src/Sample Project/Sample Project.csproj b/src/Sample Project/Sample Project.csproj index cf29fcd..d2e0cac 100644 --- a/src/Sample Project/Sample Project.csproj +++ b/src/Sample Project/Sample Project.csproj @@ -5,15 +5,10 @@ Samples Sample Project Sample Project - true - - - - diff --git a/src/Windowless Sample/Windowless Sample.csproj b/src/Windowless Sample/Windowless Sample.csproj index 928655b..8b973fe 100644 --- a/src/Windowless Sample/Windowless Sample.csproj +++ b/src/Windowless Sample/Windowless Sample.csproj @@ -1,18 +1,14 @@  WinExe - net45;net472;netcoreapp3.0;netcoreapp3.1 + net45;net472;netcoreapp3.1 Windowless_Sample Windowless Sample Windowless Sample - true - - - diff --git a/src/WindowsFormsSample/Form1.cs b/src/WindowsFormsSample/Form1.cs index 9e32170..1d30d71 100644 --- a/src/WindowsFormsSample/Form1.cs +++ b/src/WindowsFormsSample/Form1.cs @@ -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) diff --git a/src/WindowsFormsSample/WindowsFormsSample.csproj b/src/WindowsFormsSample/WindowsFormsSample.csproj index 3cfb103..85bae38 100644 --- a/src/WindowsFormsSample/WindowsFormsSample.csproj +++ b/src/WindowsFormsSample/WindowsFormsSample.csproj @@ -5,14 +5,11 @@ WindowsFormsSample.Program WindowsFormsSample WindowsFormsSample - true + true - - - diff --git a/src/global.json b/src/global.json index 7bf4830..db989f5 100644 --- a/src/global.json +++ b/src/global.json @@ -1,6 +1,7 @@ { "sdk": { - "version": "3.1.200", - "rollForward": "latestPatch" + "version": "3.1.100", + "rollForward": "latestMajor", + "allowPrerelease": true } } \ No newline at end of file