From 5cf8a4d422c752c9fe20bc70fc85ffd962a67f03 Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Wed, 29 Jan 2020 10:03:44 +0100 Subject: [PATCH] Removed some warnings, and added dotnet core 3.1 support --- azure-pipelines.yml | 131 ++++++++++-------- src/Changelog.txt | 14 +- src/Directory.Build.props | 13 +- src/NotifyIconWpf.sln | 1 + src/NotifyIconWpf/Interop/AppBarInfo.cs | 60 +++++--- src/NotifyIconWpf/NotifyIconWpf.csproj | 8 +- src/Sample Project/Sample Project.csproj | 6 +- .../Sample Project_fpsqmi4v_wpftmp.csproj | 65 --------- .../Windowless Sample.csproj | 6 +- .../Windowless Sample_2p2cnbpd_wpftmp.csproj | 48 ------- .../WindowsFormsSample.csproj | 6 +- 11 files changed, 151 insertions(+), 207 deletions(-) delete mode 100644 src/Sample Project/Sample Project_fpsqmi4v_wpftmp.csproj delete mode 100644 src/Windowless Sample/Windowless Sample_2p2cnbpd_wpftmp.csproj diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4558e6a..2c28e1c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,71 +4,88 @@ # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net trigger: -- master -- feature/* + batch: true + branches: + include: + - master + - feature/* + exclude: + - gh-pages -pr: -- master +stages: +- stage: Build + jobs: + - job: Build + pool: + vmImage: 'Windows-latest' -pool: - vmImage: 'windows-latest' + variables: + solution: '**/src/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' -variables: - solution: '**/src/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' + steps: -steps: -- task: DotNetCoreInstaller@2 - displayName: 'Use .NET Core sdk 3.0' - inputs: - version: '3.0.100' + - task: NuGetToolInstaller@1 -- task: NuGetToolInstaller@0 - displayName: 'Use NuGet 5.2.0' - inputs: - versionSpec: 5.2.0 - checkLatest: true + - task: UseDotNet@2 + displayName: 'Use .NET Core sdk 3.1' + inputs: + packageType: sdk + version: 3.1.101 -- task: NuGetCommand@2 - displayName: NuGet restore - inputs: - restoreSolution: '$(solution)' - feedsToUse: config + - task: DotNetCoreCLI@2 + displayName: Test + inputs: + command: test + projects: '$(solution)' + arguments: '--configuration Debug /p:Platform="$(buildPlatform)" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura' -- task: VSBuild@1 - displayName: 'Build solution **\src\*.sln' - inputs: - vsVersion: 'latest' - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' + - task: DotNetCoreCLI@2 + displayName: Build + inputs: + command: build + projects: '$(solution)' + arguments: '--configuration $(buildConfiguration) /p:Platform="$(buildPlatform)"' -- task: replacetokens@3 - inputs: - rootDirectory: 'templates\Dapplo.Microsoft.Extensions.Hosting.CaliburnMicro.Template\content' - targetFiles: '*.csproj' - encoding: 'auto' - writeBOM: true - actionOnMissing: 'fail' - keepToken: false - tokenPrefix: '#{' - tokenSuffix: '}#' + - task: CopyFiles@2 + displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)' + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: | + **\bin\$(buildConfiguration)\*.nupkg + TargetFolder: '$(Build.ArtifactStagingDirectory)' + flattenFolders: true -- script: nuget pack templates\Dapplo.Microsoft.Extensions.Hosting.CaliburnMicro.Template\Dapplo.Microsoft.Extensions.Hosting.CaliburnMicro.Template.nuspec -Version $(Build.BuildNumber) + - publish: $(Build.ArtifactStagingDirectory) + artifact: drop -- task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(system.defaultworkingdirectory)' - Contents: | - **\bin\$(BuildConfiguration)\*.nupkg - *Template*.nupkg - **\TestResults\**\*.coverage - TargetFolder: '$(build.artifactstagingdirectory)' - flattenFolders: true +- stage: Deploy + jobs: + - deployment: DeployNuGet + pool: + vmImage: 'Windows-2019' -- task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' + environment: 'NuGet' + strategy: + # default deployment strategy + runOnce: + deploy: + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: 'drop' + + - task: NuGetToolInstaller@0 + displayName: 'Use NuGet 5.4.0' + inputs: + versionSpec: 5.4.0 + checkLatest: true + + - task: NuGetCommand@2 + displayName: 'NuGet push' + inputs: + command: push + packagesToPush: '$(Pipeline.Workspace)/drop/*.nupkg;!$(Pipeline.Workspace)/drop/*.symbols.nupkg' + nuGetFeedType: external + publishFeedCredentials: 'NotifyIcon nuget push' diff --git a/src/Changelog.txt b/src/Changelog.txt index b56facf..cda6bed 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -1,7 +1,19 @@ hardcodet.net NotifyIcon for WPF - Changelog -Copyright (c) 2009-2016 Philipp Sumi +Copyright (c) 2009-2020 Philipp Sumi Contact and Information: http://www.hardcodet.net +1.0.9 (2020.xx.xx) +***** + +ADD Added dotnet core 3.0 and 3.1 support + + +1.0.8 (2016.04.02) +***** + +FIX Delayed message sink listener causing interop issues. + + 1.0.7 (2016.04.01) ***** diff --git a/src/Directory.Build.props b/src/Directory.Build.props index be08a97..2f97e19 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,12 +1,11 @@ - 7.3 + latest true true - true true $(MSBuildProjectName.Contains('Sample')) - Copyright (c) 2016 Philipp Sumi + Copyright (c) 2009-2020 Philipp Sumi hardcodet.net Philipp Sumi http://www.hardcodet.net/wp-content/themes/inove/favicon.ico @@ -23,6 +22,10 @@ Source code and extensive sample application available at http://www.hardcodet.n NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast + + true + + DEBUG;TRACE True @@ -46,11 +49,11 @@ Source code and extensive sample application available at http://www.hardcodet.n - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/NotifyIconWpf.sln b/src/NotifyIconWpf.sln index ca00f14..e7ea44b 100644 --- a/src/NotifyIconWpf.sln +++ b/src/NotifyIconWpf.sln @@ -5,6 +5,7 @@ VisualStudioVersion = 16.0.28711.60 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C37AE34D-A8C4-4AEC-995C-3C763300934E}" ProjectSection(SolutionItems) = preProject + ..\azure-pipelines.yml = ..\azure-pipelines.yml Changelog.txt = Changelog.txt Directory.Build.props = Directory.Build.props global.json = global.json diff --git a/src/NotifyIconWpf/Interop/AppBarInfo.cs b/src/NotifyIconWpf/Interop/AppBarInfo.cs index a5d2ee1..c6b94e8 100644 --- a/src/NotifyIconWpf/Interop/AppBarInfo.cs +++ b/src/NotifyIconWpf/Interop/AppBarInfo.cs @@ -6,9 +6,12 @@ using System.Runtime.InteropServices; namespace Hardcodet.Wpf.TaskbarNotification.Interop { + /// + /// This contains the logic to access the location of the app bar and communicate with it. + /// public class AppBarInfo { - [DllImport("user32.dll")] + [DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("shell32.dll")] @@ -18,24 +21,22 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop private static extern int SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni); - - private const int ABE_BOTTOM = 3; - private const int ABE_LEFT = 0; - private const int ABE_RIGHT = 2; - private const int ABE_TOP = 1; - private const int ABM_GETTASKBARPOS = 0x00000005; - // SystemParametersInfo constants - private const uint SPI_GETWORKAREA = 0x0030; private APPBARDATA m_data; + /// + /// Get on which edge the app bar is located + /// public ScreenEdge Edge { get { return (ScreenEdge) m_data.uEdge; } } + /// + /// Get the working area + /// public Rectangle WorkArea { get { return GetRectangle(m_data.rc); } @@ -44,9 +45,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop private Rectangle GetRectangle(RECT rc) { return new Rectangle(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); - } + } - public void GetPosition(string strClassName, string strWindowName) + /// + /// Update the location of the appbar with the specified classname and window name. + /// + /// string + /// string + private void GetPosition(string strClassName, string strWindowName) { m_data = new APPBARDATA(); m_data.cbSize = (uint) Marshal.SizeOf(m_data.GetType()); @@ -68,23 +74,41 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop } } - + /// + /// Updates the system taskbar position + /// public void GetSystemTaskBarPosition() { GetPosition("Shell_TrayWnd", null); } - + /// + /// A value that specifies an edge of the screen. + /// public enum ScreenEdge { + /// + /// Undefined + /// Undefined = -1, - Left = ABE_LEFT, - Top = ABE_TOP, - Right = ABE_RIGHT, - Bottom = ABE_BOTTOM + /// + /// Left edge. + /// + Left = 0, + /// + /// Top edge. + /// + Top = 1, + /// + /// Right edge. + /// + Right = 2, + /// + /// Bottom edge. + /// + Bottom = 3 } - [StructLayout(LayoutKind.Sequential)] private struct APPBARDATA { diff --git a/src/NotifyIconWpf/NotifyIconWpf.csproj b/src/NotifyIconWpf/NotifyIconWpf.csproj index 94c3f93..f0f9cd9 100644 --- a/src/NotifyIconWpf/NotifyIconWpf.csproj +++ b/src/NotifyIconWpf/NotifyIconWpf.csproj @@ -4,14 +4,14 @@ Hardcodet.Wpf.TaskbarNotification NotifyIcon for WPF NotifyIcon WPF - net45;net472;netcoreapp3.0 - + net45;net472;netcoreapp3.0;netcoreapp3.1 + - + - + diff --git a/src/Sample Project/Sample Project.csproj b/src/Sample Project/Sample Project.csproj index 31c9755..cf29fcd 100644 --- a/src/Sample Project/Sample Project.csproj +++ b/src/Sample Project/Sample Project.csproj @@ -1,7 +1,7 @@  WinExe - net472 + net472;netcoreapp3.1 Samples Sample Project Sample Project @@ -11,10 +11,10 @@ - + - + diff --git a/src/Sample Project/Sample Project_fpsqmi4v_wpftmp.csproj b/src/Sample Project/Sample Project_fpsqmi4v_wpftmp.csproj deleted file mode 100644 index 1a84673..0000000 --- a/src/Sample Project/Sample Project_fpsqmi4v_wpftmp.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - WinExe - Samples - Sample Project - Sample Project - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Windowless Sample/Windowless Sample.csproj b/src/Windowless Sample/Windowless Sample.csproj index a4285cf..928655b 100644 --- a/src/Windowless Sample/Windowless Sample.csproj +++ b/src/Windowless Sample/Windowless Sample.csproj @@ -1,7 +1,7 @@  WinExe - net45;net472;netcoreapp3.0 + net45;net472;netcoreapp3.0;netcoreapp3.1 Windowless_Sample Windowless Sample Windowless Sample @@ -11,10 +11,10 @@ - + - + diff --git a/src/Windowless Sample/Windowless Sample_2p2cnbpd_wpftmp.csproj b/src/Windowless Sample/Windowless Sample_2p2cnbpd_wpftmp.csproj deleted file mode 100644 index b3d4fdd..0000000 --- a/src/Windowless Sample/Windowless Sample_2p2cnbpd_wpftmp.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - WinExe - Windowless_Sample - Windowless Sample - Windowless Sample - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WindowsFormsSample/WindowsFormsSample.csproj b/src/WindowsFormsSample/WindowsFormsSample.csproj index 132d8f5..3cfb103 100644 --- a/src/WindowsFormsSample/WindowsFormsSample.csproj +++ b/src/WindowsFormsSample/WindowsFormsSample.csproj @@ -1,7 +1,7 @@  WinExe - net472 + net472;netcoreapp3.1 WindowsFormsSample.Program WindowsFormsSample WindowsFormsSample @@ -11,9 +11,9 @@ - + - +