-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8547 from AvaloniaUI/tray-icon-fixes
Tray icon fixes
- Loading branch information
1 parent
dc871e7
commit 0b525bf
Showing
8 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
using System.IO; | ||
using Avalonia.Platform; | ||
|
||
namespace Avalonia.Win32 | ||
{ | ||
class IconImpl : IWindowIconImpl | ||
{ | ||
private Bitmap bitmap; | ||
private Icon icon; | ||
|
||
public IconImpl(Bitmap bitmap) | ||
{ | ||
this.bitmap = bitmap; | ||
} | ||
private readonly Icon icon; | ||
|
||
public IconImpl(Icon icon) | ||
{ | ||
this.icon = icon; | ||
} | ||
|
||
public IntPtr HIcon => icon?.Handle ?? bitmap.GetHicon(); | ||
public IntPtr HIcon => icon.Handle; | ||
|
||
public void Save(Stream outputStream) | ||
{ | ||
if (icon != null) | ||
{ | ||
icon.Save(outputStream); | ||
} | ||
else | ||
{ | ||
bitmap.Save(outputStream, ImageFormat.Png); | ||
} | ||
icon.Save(outputStream); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters