Merge branch 'develop'

This commit is contained in:
punker76
2021-03-27 11:18:38 +01:00
116 changed files with 597 additions and 687 deletions

View File

@@ -28,13 +28,13 @@ stages:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.5.1'
versionSpec: '5.8.0'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.1.2'
displayName: 'Install .NET Core SDK 5.0'
inputs:
packageType: sdk
version: 3.1.201
version: 5.0.100
- task: DotNetCoreCLI@2
displayName: Build
@@ -57,7 +57,7 @@ stages:
- task: NuGetCommand@2
displayName: 'Publish to wpf-notifyicon feed'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
command: 'push'
versioningScheme: byBuildNumber

View File

@@ -1,11 +1,13 @@
hardcodet.net NotifyIcon for WPF - Changelog
Copyright (c) 2009-2020 Philipp Sumi
Copyright (c) 2009-2021 Philipp Sumi
Contact and Information: http://www.hardcodet.net
1.0.9 (2020.xx.xx)
1.1.0 (2021.03.27)
*****
ADD Added dotnet core 3.0 and 3.1 support
ADD Added dotnet core 3.1 and .Net 5 support.
ADD Added strong naming for assembly.
FIX When change dpi, the ContextMenu's position was wrong.
1.0.8 (2016.04.02)

View File

@@ -1,13 +1,17 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net45;net462;net472;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<LangVersion>latest</LangVersion>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
<Copyright>Copyright (c) 2009-2020 Philipp Sumi</Copyright>
<DebugSymbols>True</DebugSymbols>
<DebugType>embedded</DebugType>
<Copyright>Copyright (c) 2009-2021 Philipp Sumi</Copyright>
<Company>hardcodet.net</Company>
<Authors>Philipp Sumi</Authors>
<Authors>Philipp Sumi, Robin Krom, Jan Karger</Authors>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/hardcodet/wpf-notifyicon</RepositoryUrl>
<RepositoryType>git</RepositoryType>
@@ -18,7 +22,6 @@
Source code and extensive sample application available at http://www.hardcodet.net/projects/wpf-notifyicon</Description>
<Summary>NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform.</Summary>
<language />
<tags>NotifyIcon WPF Tray Notify ToolTip Popup Balloon Toast</tags>
</PropertyGroup>
@@ -27,18 +30,15 @@ Source code and extensive sample application available at http://www.hardcodet.n
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>embedded</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize>true</Optimize>
<DebugType>embedded</DebugType>
<DebugSymbols>True</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<Choose>
<When Condition=" '$(IsSampleProject)' != 'true' ">
@@ -48,11 +48,14 @@ Source code and extensive sample application available at http://www.hardcodet.n
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NotifyIconWpf.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.1.91">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<None Include="$(SolutionDir)\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

View File

@@ -1,4 +1,4 @@
<Application x:Class="Samples.App"
<Application x:Class="NotifyIconWpf.Sample.ShowCases.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Main.xaml">

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases
{
/// <summary>
/// Interaction logic for App.xaml

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
namespace NotifyIconWpf.Sample.ShowCases.Commands
{
/// <summary>
/// Closes the current window.

View File

@@ -6,7 +6,7 @@ using System.Windows.Markup;
using System.Windows.Media;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples.Commands
namespace NotifyIconWpf.Sample.ShowCases.Commands
{
/// <summary>
/// Basic implementation of the <see cref="ICommand"/>

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
namespace NotifyIconWpf.Sample.ShowCases.Commands
{
/// <summary>
/// Hides the main window.

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
namespace NotifyIconWpf.Sample.ShowCases.Commands
{
/// <summary>
/// Shows the main window.

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

View File

Before

Width:  |  Height:  |  Size: 667 B

After

Width:  |  Height:  |  Size: 667 B

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.Main"
x:Class="NotifyIconWpf.Sample.ShowCases.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NotifyIcon Samples"
@@ -30,7 +30,7 @@
FontSize="14"
FontStyle="Italic"
FontWeight="Bold"
TextWrapping="Wrap" Text="WPF NotifyIcon 1.0.6 - Samples"/>
TextWrapping="Wrap" Text="{Binding Path=SampleTitle}"/>
<Button
HorizontalAlignment="Left"
Margin="10,133,0,0"
@@ -38,8 +38,8 @@
Width="164"
Height="27"
Content="NotifyIcon Declaration"
x:Name="btnDeclaration"
Click="btnDeclaration_Click" />
x:Name="BtnDeclaration"
Click="BtnDeclaration_Click" />
<TextBlock
HorizontalAlignment="Left"
Margin="10,50,0,0"
@@ -67,8 +67,8 @@
Content="ToolTips - Inline Declaration"
VerticalAlignment="Top"
Height="27"
x:Name="btnInlineToolTip"
Click="btnInlineToolTip_Click" />
x:Name="BtnInlineToolTip"
Click="BtnInlineToolTip_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,244,0,0"
@@ -76,8 +76,8 @@
Content="Popups"
VerticalAlignment="Top"
Height="27"
x:Name="btnPopups"
Click="btnPopups_Click" />
x:Name="BtnPopups"
Click="BtnPopups_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,281,0,0"
@@ -85,8 +85,8 @@
Content="Context Menus"
VerticalAlignment="Top"
Height="27"
x:Name="btnContextMenus"
Click="btnContextMenus_Click" />
x:Name="BtnContextMenus"
Click="BtnContextMenus_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,318,0,0"
@@ -94,8 +94,8 @@
Content="Balloon Tips"
VerticalAlignment="Top"
Height="27"
x:Name="btnBalloons"
Click="btnBalloons_Click" />
x:Name="BtnBalloons"
Click="BtnBalloons_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,355,0,0"
@@ -103,8 +103,8 @@
Content="Commands"
VerticalAlignment="Top"
Height="27"
x:Name="btnCommands"
Click="btnCommands_Click" />
x:Name="BtnCommands"
Click="BtnCommands_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,207,0,0"
@@ -112,8 +112,8 @@
Content="ToolTip User Control"
Height="27"
VerticalAlignment="Top"
x:Name="btnToolTipControl"
Click="btnToolTipControl_Click" />
x:Name="BtnToolTipControl"
Click="BtnToolTipControl_Click" />
<TextBlock
Margin="255.31,50,0,0"
VerticalAlignment="Top"
@@ -136,8 +136,8 @@
VerticalAlignment="Top"
Height="27"
Content="Open Sample Window"
x:Name="btnMainSample"
Click="btnMainSample_Click"
x:Name="BtnMainSample"
Click="BtnMainSample_Click"
Width="164"
HorizontalAlignment="Left" />
<Path
@@ -207,8 +207,8 @@
Content="Events"
VerticalAlignment="Top"
Height="27"
x:Name="btnEvents"
Click="btnEvents_Click" Width="164" HorizontalAlignment="Left" />
x:Name="BtnEvents"
Click="BtnEvents_Click" Width="164" HorizontalAlignment="Left" />
<Button
HorizontalAlignment="Left"
Margin="10,392,0,0"
@@ -216,8 +216,8 @@
Content="Data Binding"
VerticalAlignment="Top"
Height="27"
x:Name="btnDataBinding"
Click="btnDataBinding_Click" />
x:Name="BtnDataBinding"
Click="BtnDataBinding_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,429,0,0"
@@ -225,8 +225,8 @@
Content="MVVM"
VerticalAlignment="Top"
Height="27"
x:Name="btnMvvm"
Click="btnMvvm_Click" />
x:Name="BtnMvvm"
Click="BtnMvvm_Click" />
<Image Margin="562.24,-19,-41.24,440" Source="Images/Logo.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Opacity="0.235">
<Image.RenderTransform>
<TransformGroup>

View File

@@ -0,0 +1,130 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using NotifyIconWpf.Sample.ShowCases.Showcase;
using NotifyIconWpf.Sample.ShowCases.Tutorials;
namespace NotifyIconWpf.Sample.ShowCases
{
/// <summary>
/// Interaction logic for Main.xaml
/// </summary>
public partial class Main : Window
{
public Main()
{
InitializeComponent();
DataContext = this;
}
/// <summary>
/// Sets <see cref="Window.WindowStartupLocation"/> and
/// <see cref="Window.Owner"/> properties of a dialog that
/// is about to be displayed.
/// </summary>
/// <param name="window">The processed window.</param>
private void ShowDialog(Window window)
{
window.Owner = this;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowDialog();
}
private static string Version
{
get
{
var executingAssembly = Assembly.GetExecutingAssembly();
// Use assembly version
string version = executingAssembly.GetName().Version.ToString();
// Use AssemblyFileVersion if available
var assemblyFileVersionAttribute = executingAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>();
if (!string.IsNullOrEmpty(assemblyFileVersionAttribute?.Version))
{
var assemblyFileVersion = new Version(assemblyFileVersionAttribute.Version);
version = assemblyFileVersion.ToString(3);
}
return version.Replace("+", " - ");
}
}
public string SampleTitle { get; } = $"WPF NotifyIcon {Version} - Samples";
private void BtnDeclaration_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new SimpleWindowWithNotifyIcon());
}
private void BtnInlineToolTip_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineToolTipWindow());
}
private void BtnToolTipControl_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new UserControlToolTipWindow());
}
private void BtnPopups_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlinePopupWindow());
}
private void BtnContextMenus_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineContextMenuWindow());
}
private void BtnBalloons_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new BalloonSampleWindow());
}
private void BtnCommands_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new CommandWindow());
}
private void BtnEvents_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new EventVisualizerWindow());
}
private void BtnDataBinding_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new DataBoundToolTipWindow());
}
private void BtnMvvm_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new MvvmSampleWindow());
}
private void BtnMainSample_Click(object sender, RoutedEventArgs e)
{
var sampleWindow = new ShowcaseWindow
{
Owner = this,
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
sampleWindow.ShowDialog();
}
private void OnNavigationRequest(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo
{
FileName = e.Uri.ToString(),
// UseShellExecute is default to false on .NET Core while true on .NET Framework.
// Only this value is set to true, the url link can be opened.
UseShellExecute = true
});
e.Handled = true;
}
}
}

View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateResourceUsePreserializedResources Condition="'$(TargetFramework)' != 'net45'">true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.Resources.Extensions" Version="5.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Compile DependentUpon="%(Filename)" SubType="Code" Update="**\obj\**\*.g$(DefaultLanguageSourceExtension)" />
<Compile DependentUpon="%(Filename)" SubType="Designer" Update="**\*.xaml$(DefaultLanguageSourceExtension)" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="Samples.FancyBalloon"
<UserControl x:Class="NotifyIconWpf.Sample.ShowCases.Showcase.FancyBalloon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -5,7 +5,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases.Showcase
{
/// <summary>
/// Interaction logic for FancyBalloon.xaml

View File

@@ -1,5 +1,5 @@
<UserControl
x:Class="Samples.FancyPopup"
x:Class="NotifyIconWpf.Sample.ShowCases.Showcase.FancyPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Controls;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases.Showcase
{
/// <summary>
/// Interaction logic for FancyPopup.xaml

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d"
x:Class="Samples.FancyToolTip"
x:Class="NotifyIconWpf.Sample.ShowCases.Showcase.FancyToolTip"
x:Name="me"
Width="285"
Height="136">

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases.Showcase
{
/// <summary>
/// Interaction logic for FancyToolTip.xaml

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Commands="clr-namespace:Samples.Commands"
xmlns:tb="http://www.hardcodet.net/taskbar">
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:commands="clr-namespace:NotifyIconWpf.Sample.ShowCases.Commands">
<LinearGradientBrush x:Key="MenuBackground"
EndPoint="0.5,1"
StartPoint="0.5,0">
@@ -55,7 +55,7 @@
</MenuItem>
<MenuItem Header="Show Showcase Window"
Command="{Commands:ShowSampleWindowCommand}"
Command="{commands:ShowSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"
@@ -67,7 +67,7 @@
<Separator />
<MenuItem Header="Hide Showcase Window"
Command="{Commands:HideSampleWindowCommand}"
Command="{commands:HideSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.ShowcaseWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Showcase.ShowcaseWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
@@ -10,8 +10,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:local="clr-namespace:Samples"
xmlns:Commands="clr-namespace:Samples.Commands"
xmlns:commands="clr-namespace:NotifyIconWpf.Sample.ShowCases.Commands"
xmlns:showcase="clr-namespace:NotifyIconWpf.Sample.ShowCases.Showcase"
MinWidth="750"
MinHeight="800"
ResizeMode="NoResize">
@@ -68,17 +68,17 @@
Visibility="{Binding Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=iconVisibility, Mode=Default}"
MenuActivation="{Binding Path=SelectedItem, ElementName=lstMenuTrigger, Mode=Default}"
PopupActivation="{Binding Path=SelectedItem, ElementName=lstPopupTrigger, Mode=Default}"
DoubleClickCommand="{Commands:ShowSampleWindowCommand}"
DoubleClickCommand="{commands:ShowSampleWindowCommand}"
DoubleClickCommandParameter="{Binding RelativeSource={RelativeSource Self}}">
<tb:TaskbarIcon.TrayPopup>
<!-- the control will be put into a popup with an explicit DataContext -->
<local:FancyPopup />
<showcase:FancyPopup />
</tb:TaskbarIcon.TrayPopup>
<tb:TaskbarIcon.TrayToolTip>
<!-- the control will be put into a tooltip with an explicit DataContext -->
<local:FancyToolTip
<showcase:FancyToolTip
Opacity="0.85"
InfoText="{Binding Path=ToolTipText}" />
</tb:TaskbarIcon.TrayToolTip>

View File

@@ -4,7 +4,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Navigation;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases.Showcase
{
/// <summary>
/// Interaction logic for ShowcaseWindow.xaml
@@ -77,7 +77,13 @@ namespace Samples
private void OnNavigationRequest(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
Process.Start(new ProcessStartInfo
{
FileName = e.Uri.ToString(),
// UseShellExecute is default to false on .NET Core while true on .NET Framework.
// Only this value is set to true, the url link can be opened.
UseShellExecute = true
});
e.Handled = true;
}

View File

@@ -1,5 +1,5 @@
<UserControl
x:Class="Samples.WelcomeBalloon"
x:Class="NotifyIconWpf.Sample.ShowCases.Showcase.WelcomeBalloon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,6 +1,6 @@
using System.Windows.Controls;
namespace Samples
namespace NotifyIconWpf.Sample.ShowCases.Showcase
{
/// <summary>
/// Interaction logic for WelcomeBalloon.xaml

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.Tutorials.SimpleWindowWithNotifyIcon"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.SimpleWindowWithNotifyIcon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for SimpleWindowWithNotifyIcon.xaml

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.Tutorials.ToolTips.InlineToolTipWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.InlineToolTipWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.ToolTips
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for Window1.xaml

View File

@@ -1,5 +1,5 @@
<UserControl
x:Class="Samples.Tutorials.ToolTips.SimpleUserControl"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.SimpleUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

View File

@@ -1,6 +1,6 @@
using System.Windows.Controls;
namespace Samples.Tutorials.ToolTips
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for SimpleUserControl.xaml

View File

@@ -1,9 +1,9 @@
<Window
x:Class="Samples.Tutorials.ToolTips.UserControlToolTipWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.UserControlToolTipWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:Samples.Tutorials.ToolTips"
xmlns:tutorials="clr-namespace:NotifyIconWpf.Sample.ShowCases.Tutorials"
Height="300"
Width="300">
<Grid>
@@ -15,7 +15,7 @@
<!-- assign user control as ToolTip -->
<tb:TaskbarIcon.TrayToolTip>
<local:SimpleUserControl />
<tutorials:SimpleUserControl />
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.ToolTips
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for UserControlToolTipWindow.xaml

View File

@@ -1,9 +1,9 @@
<Window
x:Class="Samples.Tutorials.Popups.InlinePopupWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.InlinePopupWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:commands="clr-namespace:Samples.Commands"
xmlns:commands="clr-namespace:NotifyIconWpf.Sample.ShowCases.Commands"
Height="300"
Width="300">
<Grid>

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.Popups
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for InlinePopupWindow.xaml

View File

@@ -1,8 +1,8 @@
<Window x:Class="Samples.Tutorials.ContextMenus.InlineContextMenuWindow"
<Window x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.InlineContextMenuWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:commands="clr-namespace:Samples.Commands"
xmlns:commands="clr-namespace:NotifyIconWpf.Sample.ShowCases.Commands"
Height="300"
Width="300">
<Grid>

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.ContextMenus
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for InlineContextMenuWindow.xaml

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.Tutorials.Balloons.BalloonSampleWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.BalloonSampleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,7 +1,8 @@
using System.Windows;
using System.Windows.Controls.Primitives;
using NotifyIconWpf.Sample.ShowCases.Showcase;
namespace Samples.Tutorials.Balloons
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for BalloonSampleWindow.xaml

View File

@@ -1,19 +1,19 @@
<Window
x:Class="Samples.Tutorials.Commands.CommandWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.CommandWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:Samples.Tutorials.Commands"
Height="300"
Width="300"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tutorials="clr-namespace:NotifyIconWpf.Sample.ShowCases.Tutorials"
mc:Ignorable="d">
<Grid>
<!-- declare the command as a local resource -->
<Grid.Resources>
<local:ShowMessageCommand
<tutorials:ShowMessageCommand
x:Key="MessageCommand" />
</Grid.Resources>

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.Commands
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for CommandWindow.xaml

View File

@@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Tutorials.Commands
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// A simple command that displays the command parameter as
@@ -20,6 +20,10 @@ namespace Samples.Tutorials.Commands
return true;
}
public event EventHandler CanExecuteChanged;
public event EventHandler CanExecuteChanged
{
add => CommandManager.RequerySuggested += value;
remove => CommandManager.RequerySuggested -= value;
}
}
}

View File

@@ -1,5 +1,5 @@
<Window
x:Class="Samples.Tutorials.Events.EventVisualizerWindow"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.EventVisualizerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.Events
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for EventVisualizerWindow.xaml

View File

@@ -1,4 +1,4 @@
<Window x:Class="Samples.Tutorials.DataBinding.DataBoundToolTipWindow"
<Window x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.DataBoundToolTipWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
@@ -9,7 +9,7 @@
<!-- the ToolTipText property is bound to the TextBox below -->
<tb:TaskbarIcon x:Name="MyNotifyIcon1"
IconSource="/Icons/Error.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
ToolTipText="{Binding ElementName=TxtToolTip, Path=Text}">
<!--
The TextBlock bound to the ToolTipText property of the NotifyIcon
@@ -36,7 +36,7 @@
<tb:TaskbarIcon x:Name="MyNotifyIcon2"
DataContext="WPF FTW "
IconSource="/Icons/Inactive.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
ToolTipText="{Binding ElementName=TxtToolTip, Path=Text}">
<tb:TaskbarIcon.TrayToolTip>
@@ -77,7 +77,7 @@
<TextBox Margin="26,0,24,10"
Text="hello world"
TextWrapping="Wrap"
x:Name="txtToolTip"
x:Name="TxtToolTip"
Height="25"
VerticalAlignment="Bottom" />
<TextBlock Margin="26,0,125,45"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.DataBinding
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for DataBoundToolTipWindow.xaml

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Samples.Tutorials.MvvmSample.ClockPopup"
x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.ClockPopup"
x:Name="UserControl"
Height="141"
Width="304">

View File

@@ -1,6 +1,6 @@
using System.Windows.Controls;
namespace Samples.Tutorials.MvvmSample
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for ClockPopup.xaml

View File

@@ -3,7 +3,7 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Threading;
namespace Samples.Tutorials.MvvmSample
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
public class MvvmSampleViewModel : INotifyPropertyChanged
{

View File

@@ -1,13 +1,13 @@
<Window x:Class="Samples.Tutorials.MvvmSample.MvvmSampleWindow"
<Window x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.MvvmSampleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Tutorials.MvvmSample"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:tutorials="clr-namespace:NotifyIconWpf.Sample.ShowCases.Tutorials"
Title="MvvmSampleWindow"
Height="300"
Width="300">
<Window.DataContext>
<local:MvvmSampleViewModel />
<tutorials:MvvmSampleViewModel />
</Window.DataContext>
<Grid>
@@ -20,7 +20,7 @@
ToolTipText="{Binding Timestamp}">
<tb:TaskbarIcon.TrayPopup >
<!-- the popup, here a custom user control, will also get the DataContext of the NotifyIcon -->
<local:ClockPopup Opacity="0.8" />
<tutorials:ClockPopup Opacity="0.8" />
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples.Tutorials.MvvmSample
namespace NotifyIconWpf.Sample.ShowCases.Tutorials
{
/// <summary>
/// Interaction logic for MvvmSampleWindow.xaml

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<!-- Make sure windows Vista and above treat Greenshot as "DPI Aware" See: http://msdn.microsoft.com/en-us/library/ms633543.aspx -->
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">false</gdiScaling>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<maxversiontested Id="10.0.18363.0"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!--Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
<!-- Set UAC level to "asInvoker" and disable registry virtualization -->
<asmv2:trustInfo>
<asmv2:security>
<asmv3:requestedPrivileges>
<!--
The presence of the "requestedExecutionLevel" node will disable
file and registry virtualization on Vista. See:
http://msdn.microsoft.com/en-us/library/aa965884%28v=vs.85%29.aspx
Use the "level" attribute to specify the User Account Control level:
asInvoker = Never prompt for elevation
requireAdministrator = Always prompt for elevation
highestAvailable = Prompt for elevation when started by administrator,
but do not prompt for administrator password when started by
standard user.
-->
<asmv3:requestedExecutionLevel level="asInvoker" />
</asmv3:requestedPrivileges>
</asmv2:security>
</asmv2:trustInfo>
</assembly>

View File

@@ -1,4 +1,4 @@
<Application x:Class="Windowless_Sample.App"
<Application x:Class="NotifyIconWpf.Sample.Windowless.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShutdownMode="OnExplicitShutdown">

View File

@@ -1,7 +1,7 @@
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
namespace Windowless_Sample
namespace NotifyIconWpf.Sample.Windowless
{
/// <summary>
/// Simple application. Check the XAML for comments.

View File

@@ -1,7 +1,7 @@
using System;
using System.Windows.Input;
namespace Windowless_Sample
namespace NotifyIconWpf.Sample.Windowless
{
/// <summary>
/// Simplistic delegate command for the demo.

View File

@@ -1,4 +1,4 @@
<Window x:Class="Windowless_Sample.MainWindow"
<Window x:Class="NotifyIconWpf.Sample.Windowless.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Windowless_Sample
namespace NotifyIconWpf.Sample.Windowless
{
/// <summary>
/// Interaction logic for MainWindow.xaml

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:Windowless_Sample">
xmlns:local="clr-namespace:NotifyIconWpf.Sample.Windowless">
<!-- The taskbar context menu - the first row is a dummy to show off simple data binding -->
<!--

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
namespace Windowless_Sample
namespace NotifyIconWpf.Sample.Windowless
{
/// <summary>
/// Provides bindable properties and commands for the NotifyIcon. In this sample, the

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj" />
</ItemGroup>
<ItemGroup>
<Compile DependentUpon="%(Filename)" SubType="Code" Update="**\obj\**\*.g$(DefaultLanguageSourceExtension)" />
<Compile DependentUpon="%(Filename)" SubType="Designer" Update="**\*.xaml$(DefaultLanguageSourceExtension)" />
</ItemGroup>
</Project>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<!-- Make sure windows Vista and above treat Greenshot as "DPI Aware" See: http://msdn.microsoft.com/en-us/library/ms633543.aspx -->
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">false</gdiScaling>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<maxversiontested Id="10.0.18363.0"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!--Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
<!-- Set UAC level to "asInvoker" and disable registry virtualization -->
<asmv2:trustInfo>
<asmv2:security>
<asmv3:requestedPrivileges>
<!--
The presence of the "requestedExecutionLevel" node will disable
file and registry virtualization on Vista. See:
http://msdn.microsoft.com/en-us/library/aa965884%28v=vs.85%29.aspx
Use the "level" attribute to specify the User Account Control level:
asInvoker = Never prompt for elevation
requireAdministrator = Always prompt for elevation
highestAvailable = Prompt for elevation when started by administrator,
but do not prompt for administrator password when started by
standard user.
-->
<asmv3:requestedExecutionLevel level="asInvoker" />
</asmv3:requestedPrivileges>
</asmv2:security>
</asmv2:trustInfo>
</assembly>

View File

@@ -1,5 +1,5 @@
<UserControl
x:Class="Samples.FancyPopup"
x:Class="NotifyIconWpf.Sample.WindowsForms.FancyPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace Samples
namespace NotifyIconWpf.Sample.WindowsForms
{
/// <summary>
/// Interaction logic for FancyPopup.xaml

View File

@@ -1,4 +1,4 @@
namespace WindowsFormsSample
namespace NotifyIconWpf.Sample.WindowsForms
{
partial class Form1
{

View File

@@ -2,10 +2,9 @@
using System.Windows;
using System.Windows.Forms;
using Hardcodet.Wpf.TaskbarNotification;
using Samples;
using WindowsFormsSample.Properties;
using NotifyIconWpf.Sample.WindowsForms.Properties;
namespace WindowsFormsSample
namespace NotifyIconWpf.Sample.WindowsForms
{
public partial class Form1 : Form
{
@@ -19,12 +18,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)

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -1,28 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFrameworks>net462;net472;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<StartupObject>WindowsFormsSample.Program</StartupObject>
<AssemblyTitle>WindowsFormsSample</AssemblyTitle>
<Product>WindowsFormsSample</Product>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<ApplicationManifest>app.manifest</ApplicationManifest>
<GenerateResourceUsePreserializedResources Condition="'$(TargetFramework)' != 'net45'">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="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Deployment" />
<Reference Include="System.Xaml" />
<Reference Include="System.Windows.Forms" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<PackageReference Include="System.Resources.Extensions" Version="5.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
@@ -30,36 +21,26 @@
<Compile Update="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Update="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile DependentUpon="%(Filename)" Update="**\*.xaml.cs" />
</ItemGroup>
<ItemGroup>
<Compile DependentUpon="%(Filename)" SubType="Code" Update="**\obj\**\*.g$(DefaultLanguageSourceExtension)" />
<Compile DependentUpon="%(Filename)" SubType="Designer" Update="**\*.xaml$(DefaultLanguageSourceExtension)" />
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using System;
using System.Windows.Forms;
namespace WindowsFormsSample
namespace NotifyIconWpf.Sample.WindowsForms
{
internal static class Program
{

View File

@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsSample.Properties {
namespace NotifyIconWpf.Sample.WindowsForms.Properties {
using System;
@@ -19,7 +19,7 @@ namespace WindowsFormsSample.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -39,7 +39,7 @@ namespace WindowsFormsSample.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsSample.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NotifyIconWpf.Sample.WindowsForms.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

View File

@@ -112,13 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Led" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\led.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\Icon\Led.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<!-- Make sure windows Vista and above treat Greenshot as "DPI Aware" See: http://msdn.microsoft.com/en-us/library/ms633543.aspx -->
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">false</gdiScaling>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<maxversiontested Id="10.0.18363.0"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!--Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
<!-- Set UAC level to "asInvoker" and disable registry virtualization -->
<asmv2:trustInfo>
<asmv2:security>
<asmv3:requestedPrivileges>
<!--
The presence of the "requestedExecutionLevel" node will disable
file and registry virtualization on Vista. See:
http://msdn.microsoft.com/en-us/library/aa965884%28v=vs.85%29.aspx
Use the "level" attribute to specify the User Account Control level:
asInvoker = Never prompt for elevation
requireAdministrator = Always prompt for elevation
highestAvailable = Prompt for elevation when started by administrator,
but do not prompt for administrator password when started by
standard user.
-->
<asmv3:requestedExecutionLevel level="asInvoker" />
</asmv3:requestedPrivileges>
</asmv2:security>
</asmv2:trustInfo>
</assembly>

View File

@@ -14,11 +14,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyIconWpf", "NotifyIconWpf\NotifyIconWpf.csproj", "{7AC63864-7638-41C4-969C-D3197EF2BED9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Project", "Sample Project\Sample Project.csproj", "{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyIconWpf.Sample.ShowCases", "NotifyIconWpf.Sample.ShowCases\NotifyIconWpf.Sample.ShowCases.csproj", "{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsFormsSample", "WindowsFormsSample\WindowsFormsSample.csproj", "{F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyIconWpf.Sample.WindowsForms", "NotifyIconWpf.Sample.WindowsForms\NotifyIconWpf.Sample.WindowsForms.csproj", "{F6DC0A6D-D1CE-4AD2-92ED-08FFF0AD4FA8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Windowless Sample", "Windowless Sample\Windowless Sample.csproj", "{964EBFBE-A600-49B2-BDD8-422B46F1D544}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyIconWpf.Sample.Windowless", "NotifyIconWpf.Sample.Windowless\NotifyIconWpf.Sample.Windowless.csproj", "{964EBFBE-A600-49B2-BDD8-422B46F1D544}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

BIN
src/NotifyIconWpf.snk Normal file

Binary file not shown.

View File

@@ -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

View File

@@ -1,3 +1,27 @@
// 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.Diagnostics.Contracts;
using System.Windows.Interop;
namespace Hardcodet.Wpf.TaskbarNotification.Interop
@@ -7,29 +31,55 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
/// </summary>
public static class SystemInfo
{
private static readonly System.Windows.Point DpiFactors;
/// <summary>
/// Make sure the initial value is calculated at the first access
/// </summary>
static SystemInfo()
{
UpdateDpiFactors();
}
/// <summary>
/// This calculates the current DPI values and sets this into the DpiFactorX/DpiFactorY values
/// </summary>
internal static void UpdateDpiFactors()
{
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;
/// <summary>
/// Scale the supplied point to the current DPI settings
/// </summary>
/// <param name="point"></param>
/// <returns>Point</returns>
[Pure]
public static Point ScaleWithDpi(this Point point)
{
return new Point
{
X = (int)(point.X / DpiFactorX),
Y = (int)(point.Y / DpiFactorY)
};
}
}
}

View File

@@ -51,13 +51,6 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
/// </summary>
/// <param name="point">Point</param>
/// <returns>Point</returns>
public static Point GetDeviceCoordinates(Point point)
{
return new Point
{
X = (int)(point.X / SystemInfo.DpiFactorX),
Y = (int)(point.Y / SystemInfo.DpiFactorY)
};
}
public static Point GetDeviceCoordinates(Point point) => point.ScaleWithDpi();
}
}

View File

@@ -9,7 +9,6 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
/// </summary>
public delegate IntPtr WindowProcedureHandler(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
/// <summary>
/// Win API WNDCLASS struct - represents a single window.
/// Used to receive window messages.

View File

@@ -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
@@ -223,9 +223,21 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
/// <param name="lParam">Provides information about the event.</param>
private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
{
if (msg != CallbackMessageId) return;
// Check if it was a callback message
if (msg != CallbackMessageId)
{
// It was not a callback message, but make sure it's not something else we need to process
switch ((WindowsMessages) msg)
{
case WindowsMessages.WM_DPICHANGED:
Debug.WriteLine("DPI Change");
SystemInfo.UpdateDpiFactors();
break;
}
return;
}
var message = (WindowsMessages) lParam.ToInt32();
var message = (WindowsMessages)lParam.ToInt32();
Debug.WriteLine("Got message " + message);
switch (message)
{

View File

@@ -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
@@ -134,6 +134,13 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
/// </summary>
WM_MBUTTONDBLCLK = 0x0209,
/// <summary>
/// Sent when the effective dots per inch (dpi) for a window has changed.
/// The DPI is the scale factor for a window.
/// There are multiple events that can cause the DPI to change.
/// </summary>
WM_DPICHANGED = 0x02e0,
/// <summary>
/// Used to define private messages for use by private window classes, usually of the form WM_USER+x, where x is an integer value.
/// </summary>

View File

@@ -4,22 +4,12 @@
<AssemblyName>Hardcodet.NotifyIcon.Wpf</AssemblyName>
<AssemblyTitle>NotifyIcon for WPF</AssemblyTitle>
<Product>NotifyIcon WPF</Product>
<TargetFrameworks>net45;net472;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.Resources.Extensions" Version="4.7.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<None Include="Diagrams\TaskbarIcon Overview.cd" />
</ItemGroup>
<ItemGroup>
<Compile DependentUpon="%(Filename)" SubType="Code" Update="**\obj\**\*.g$(DefaultLanguageSourceExtension)" />
<Compile DependentUpon="%(Filename)" SubType="Designer" Update="**\*.xaml$(DefaultLanguageSourceExtension)" />

Some files were not shown because too many files have changed in this diff Show More