mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-10-03 10:36:30 +13:00
13e7cedaa6
Response time for an loaded icon should be faster as update no longer depends on timer Loading icon will now share image source prevents creation of lost of loading icon copies
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
// <copyright file="StaticResources.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace SystemTrayMenu.Resources
|
|
{
|
|
using System.Drawing;
|
|
using System.Windows.Media;
|
|
using SystemTrayMenu.Utilities;
|
|
|
|
internal class StaticResources
|
|
{
|
|
internal static readonly Icon LoadingIcon = Properties.Resources.Loading;
|
|
|
|
private static readonly object LoadingImgSrcLock = new ();
|
|
|
|
private static ImageSource? loadingImgSrc;
|
|
|
|
internal static ImageSource LoadingImgSrc
|
|
{
|
|
get
|
|
{
|
|
if (loadingImgSrc == null)
|
|
{
|
|
lock (LoadingImgSrcLock)
|
|
{
|
|
if (loadingImgSrc == null)
|
|
{
|
|
loadingImgSrc = Properties.Resources.Loading.ToImageSource();
|
|
loadingImgSrc.Freeze(); // Make it accessible by any thread
|
|
}
|
|
}
|
|
}
|
|
|
|
return loadingImgSrc;
|
|
}
|
|
}
|
|
}
|
|
}
|