Skip to content

How to update GeneratedIconSource.Text in C# code after the 2.0.99 release? #83

Answered by myfix16
myfix16 asked this question in Q&A
Discussion options

You must be logged in to vote

I figured out the solution. In this version, you need to call TaskbarIcon.UpdateIcon(GeneratedIcon.ToIcon()) to update the icon manually.

@HavenDV I suppose the update should be done automatically. So I guess the following method in TaskbarIcon.IconSource.cs is not called when a property of GeneratedIcon changes:

async partial void OnIconSourceChanged(ImageSource? oldValue, ImageSource? newValue)
    {
        if (newValue == null)
        {
            Icon = null;
            return;
        }

#if MACOS
        TrayIcon.Icon = NSImage.FromStream(stream);
#else
        Icon = await newValue.ToIconAsync().ConfigureAwait(true);
#endif
    }

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@HavenDV
Comment options

@HavenDV
Comment options

@myfix16
Comment options

@HavenDV
Comment options

Answer selected by myfix16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants