예제 #1
0
        public void setUTCDateTime(DateTime dt, int pos)
        {
            GPTimeZone tz = getTimeZone(travellingTimezoneIndex);

            if (tz != null)
            {
                dt = dt.AddHours(tz.getOffsetHours());

                setDateTime(dt, pos);
            }
        }
예제 #2
0
        public DateTime getUTCDateTime(int pos)
        {
            DateTime   dt = getDateTime(pos);
            GPTimeZone tz = getTimeZone(travellingTimezoneIndex);

            if (tz != null)
            {
                double offset = tz.getOffsetHours();

                dt = dt.AddHours(-offset);
            }
            return(dt);
        }
예제 #3
0
        private void UpdateTimeZoneLabel(int i)
        {
            GPTimeZone tz    = getTimeZone(travellingTimezoneIndex);
            Label      label = ((i == 0) ? labelTimezone : labelTimezone2);

            if (tz != null)
            {
                label.Text = string.Format("Timezone: {0}", tz.getFullName());
                DateTime minDate = minimumUtcTime.AddHours(tz.getOffsetHours());
            }
            else
            {
                label.Text = string.Format("Timezone: {0}", "+00:00 UTC");
            }
        }
예제 #4
0
        private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox8.SelectedIndex < 0 || comboBox8.SelectedIndex >= comboBox8.Items.Count)
            {
                return;
            }

            GPTimeZone tzone = GPTimeZoneList.sharedTimeZones().GetTimezoneByName(comboBox8.SelectedItem as string);

            if (tzone == null)
            {
                label8.Text = "-";
                return;
            }

            if (tzone.Transitions.Count == 0)
            {
                label8.Text = "-";
                return;
            }

            /*GPTimestamp ts = new GPTimestamp(DateTime.Now);
             * GPTimeZone.Transition trans = tzone.GetNextTransition(ts);
             * if (trans == null)
             * {
             *  label8.Text = "-";
             *  return;
             * }
             *
             * DateTime dt = trans.getDateTime();
             * label8.Text = dt.ToLongDateString() + " - " + dt.ToShortTimeString();*/

            if (comboBox1.SelectedItem != null && comboBox8.SelectedItem != null && tabControl1.SelectedIndex == 1)
            {
                OnSelectedLocationChanged(this, e);
            }
            ModifyNameOfCity();
        }