hardcodet / wpf-notifyicon

NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform
Other
810 stars 125 forks source link

Does it work with Windows 10 1903? #16

Closed apetitjean closed 4 years ago

Lakritzator commented 4 years ago

Did you try? For me it works fine.

apetitjean commented 4 years ago

The first example (code based) in the docs worked for me but not the ones involving XAML.

I'm using PowerShell but it should work. Here's my code

Add-Type –assemblyName PresentationFramework, PresentationCore, WindowsBase
Add-Type -Path Z:\Dropbox\PowerShell\Hardcodet.NotifyIcon.Wpf.1.0.8.nupkg\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll -PassThru

[XML]$xaml = 
@'
<Window

  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"

>
  <Grid>

    <!--
      in order to create a NotifyIcon, all you need is the
      namespace declaration (see above on line 4) and a simple
      declaration
    -->
    <tb:TaskbarIcon

      IconSource="/Icons/Error.ico"

      ToolTipText="hello world" />

  </Grid>
</Window>
'@

$reader=New-Object System.Xml.XmlNodeReader $xaml 
$Form=[Windows.Markup.XamlReader]::Load($reader)

$Form.ShowDialog() | Out-Null

Here's the error message I get :

At Z:\Dropbox\PowerShell\Demo2.ps1:26 char:31
+       ToolTipText="hello world" />
+                               ~~~~
The string is missing the terminator: ".
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
Lakritzator commented 4 years ago

This question doesn't have anything to do with "does it work with Windows 10 1903" but more if you can get it to work inside of PowerShell.

I'm not an .NET PowerShell expert, couldn't get it working as expected. But it was locating a place on the icon tray, so it seems to be more of an issue with getting the xaml to work.

Lakritzator commented 4 years ago

Closing this, as I cannot help you with this, and besides there hasn't been any activity since my last remark.