private static void UpdateIcon(int weekNumber, ref NotifyIcon notifyIcon) { notifyIcon.Text = Resources.Week + weekNumber; System.Drawing.Icon prevIcon = notifyIcon.Icon; notifyIcon.Icon = WeekIcon.GetIcon(weekNumber); WeekIcon.CleanupIcon(ref prevIcon); }
private void UpdateIcon(int weekNumber, ref NotifyIcon notifyIcon, int iconResolution) { Log.LogCaller(); try { string weekDayPrefix = string.Empty; string longDateString = DateTime.Now.ToLongDateString(); const string SWEDISH_LONG_DATE_PREFIX_STRING = "den "; if (Thread.CurrentThread.CurrentUICulture.Name == Resources.Swedish || longDateString.StartsWith(SWEDISH_LONG_DATE_PREFIX_STRING)) { weekDayPrefix = Message.SWEDISH_DAY_OF_WEEK_PREFIX[(int)DateTime.Now.DayOfWeek]; } notifyIcon.Text = $"{Resources.Week} {weekNumber}\r\n{weekDayPrefix}{longDateString}"; System.Drawing.Icon prevIcon = notifyIcon.Icon; notifyIcon.Icon = WeekIcon.GetIcon(weekNumber, iconResolution); WeekIcon.CleanupIcon(ref prevIcon); } finally { if (_latestWeek != weekNumber) { if (Settings.SettingIsValue(Resources.DisplayWeekChangedNotification, "True")) { DisplayUserInfoBalloonTip(notifyIcon.Text); } _latestWeek = weekNumber; } } }