Exemplo n.º 1
0
        public override void Initialize(OptimusMiniSettingsList currentSettings)
        {
            _Timezones = new TimezoneItem[5];

            for (int i = 0; i < 5; i++)
            {
                string lTimezone = currentSettings["Timezone" + i.ToString()];
                string lLabel    = currentSettings["Label" + i.ToString()];

                if (lTimezone != "" && TimeZoneInformation.ContainsTimeZone(lTimezone))
                {
                    TimezoneItem lItem = new TimezoneItem(TimeZoneInformation.GetTimeZone(lTimezone), lLabel);
                    _Timezones[i] = lItem;
                }
                else
                {
                    _Timezones[i] = null;
                }
            }

            RequestNextUpdate(new TimeSpan(0, 0, 0));
        }
Exemplo n.º 2
0
        public WorldTimeConfig(OptimusMiniSettingsList currentSettings)
        {
            InitializeComponent();

            _Settings = currentSettings;
            _Items    = new List <TimezoneItem>();


            // ----- Fill select box with all timezones
            foreach (TimeZoneInformation lTimezone in TimeZoneInformation.TimeZones)
            {
                selectTimezone.Items.Add(lTimezone.DisplayName);
            }
            selectTimezone.SelectedIndex = 0;


            // ----- Add stored timezones
            for (int i = 0; i < 5; i++)
            {
                string lTimezone = _Settings["Timezone" + i.ToString()];
                if (TimeZoneInformation.ContainsTimeZone(lTimezone))
                {
                    TimezoneItem lItem = new TimezoneItem(TimeZoneInformation.GetTimeZone(lTimezone), _Settings["Label" + i.ToString()]);
                    _Items.Add(lItem);
                    listTimezones.Items.Add(string.Format("{0}: {1}", lItem.Label, lItem.Timezone.DisplayName));
                }
            }
            if (_Items.Count > 0)
            {
                listTimezones.Items[0].Selected = true;
            }


            // ----- Update controls
            UpdateActions();
        }