コード例 #1
0
ファイル: SystemSettingsVM.cs プロジェクト: nunanas21/CIS-109
        /// <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);
        }
コード例 #2
0
 public void SetUp()
 {
     _actionKeyword    = "&";
     _timeZoneList     = JsonHelper.ReadAllPossibleTimeZones();
     _timeZoneSettings = new TimeZoneSettings
     {
         ShowTimeNames     = true,
         ShowTimeZoneNames = true,
     };
 }
コード例 #3
0
ファイル: LanguageManager.cs プロジェクト: yapakipe/samples
        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);
        }
コード例 #4
0
 /// <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();
 }
コード例 #5
0
 protected virtual bool TryFindOutlookTimeZone(MailboxSession mailboxSession, out byte[] blob)
 {
     return(TimeZoneSettings.TryFindOutlookTimeZone(mailboxSession, out blob));
 }
コード例 #6
0
 protected virtual bool TryFindOwaTimeZone(MailboxSession mailboxSession, out ExTimeZone timeZone)
 {
     return(TimeZoneSettings.TryFindOwaTimeZone(mailboxSession, out timeZone));
 }