Skip to content

Commit

Permalink
Show profile name in NotifyIcon tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphinspired committed Dec 11, 2022
1 parent 72024dc commit d2330f6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ValheimServerGUI/Forms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ protected override void OnShown(EventArgs e)

private void OnProfileChanged(string _)
{
this.TrayContextMenuServerName.Text = this.CurrentProfile;
this.RefreshApplicationTitle();
this.RefreshCurrentProfileDisplayed();
}

protected override void OnResize(EventArgs e)
Expand Down Expand Up @@ -1016,16 +1015,20 @@ private void RefreshWorldSelect()
}
}

private void RefreshApplicationTitle()
private void RefreshCurrentProfileDisplayed()
{
var title = Resources.ApplicationTitle;

if (this.CurrentProfile != null)
if (this.CurrentProfile == null)
{
title += $" - {this.CurrentProfile}";
this.Text = Resources.ApplicationTitle;
this.NotifyIcon.Text = "ValheimServerGUI";
this.TrayContextMenuServerName.Text = "No Profile Selected";
}
else
{
this.Text = $"{Resources.ApplicationTitle} - {this.CurrentProfile}";
this.NotifyIcon.Text = $"ValheimServerGUI - {this.CurrentProfile}";
this.TrayContextMenuServerName.Text = $"Profile: {this.CurrentProfile}";
}

this.Text = title;
}

#endregion
Expand Down

0 comments on commit d2330f6

Please sign in to comment.