/// <summary> /// Tries to update the current time zone within Windows System Settings and displays a notification of the result /// </summary> /// <param name="timeZoneName">String display name of the new timezone to be set</param> /// <returns>True if the operation is successful, otherwise false</returns> public bool UpdateTimeZone(string timeZoneName) { _resultsText = SystemSettingsUpdateErrorText; try { if (TimeZoneSettings.CanChangeTimeZone) { TimeZoneSettings.ChangeTimeZoneByDisplayName(timeZoneName); if (timeZoneName == TimeZoneSettings.CurrentTimeZoneDisplayName) { _updateSuccess = true; _resultsText = string.Format(TimeZoneUpdateSuccessText, timeZoneName); } } } catch (Exception ex) { LogService.Write(ex.ToString(), LoggingLevel.Error); } finally { PageService?.ShowNotification(_resultsText, 2000); } return(_updateSuccess); }
public void SetUp() { _actionKeyword = "&"; _timeZoneList = JsonHelper.ReadAllPossibleTimeZones(); _timeZoneSettings = new TimeZoneSettings { ShowTimeNames = true, ShowTimeZoneNames = true, }; }
public static void ChangeTimeZone(string timeZone) { if (!TimeZoneSettings.CanChangeTimeZone) { return; } if (!TimeZoneSettings.SupportedTimeZoneDisplayNames.Contains(timeZone)) { throw new ArgumentException("timeZone"); } TimeZoneSettings.ChangeTimeZoneByDisplayName(timeZone); // "Workaround" to flush TimeZoneInfo cache. Yes, this really works. TimeZoneInfo.ConvertTime(DateTime.MinValue, TimeZoneInfo.Local); }
/// <summary> /// Initializes a new instance of the <see cref="Main"/> class. /// </summary> public Main() { _assemblyName = Assembly.GetExecutingAssembly().GetName().Name ?? GetTranslatedPluginTitle(); _defaultIconPath = "Images/timeZone.light.png"; _timeZoneSettings = new TimeZoneSettings(); }
protected virtual bool TryFindOutlookTimeZone(MailboxSession mailboxSession, out byte[] blob) { return(TimeZoneSettings.TryFindOutlookTimeZone(mailboxSession, out blob)); }
protected virtual bool TryFindOwaTimeZone(MailboxSession mailboxSession, out ExTimeZone timeZone) { return(TimeZoneSettings.TryFindOwaTimeZone(mailboxSession, out timeZone)); }