Example #1
0
        public void DisplayValue(System.TimeZone value)
        {
            EnsureInitialised();

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (value == System.TimeZone.CurrentTimeZone)
            {
                radCurrent.Checked = true;
            }
            else
            {
                LinkMeType.TimeZone typeTz = value as LinkMeType.TimeZone;
                if (typeTz == null)
                {
                    throw new ArgumentException("Unsupported type of TimeZone object: "
                                                + value.GetType().FullName, "value");
                }

                if (typeTz.Equals(LinkMeType.TimeZone.UTC))
                {
                    radUtc.Checked = true;
                }
                else
                {
                    radSpecified.Checked = true;

                    bool found = false;
                    for (int index = 0; index < cboTimeZone.Items.Count; index++)
                    {
                        if (typeTz.StandardName == (string)cboTimeZone.Items[index])
                        {
                            found = true;
                            cboTimeZone.SelectedIndex = index;
                            break;
                        }
                    }

                    if (!found)
                    {
                        cboTimeZone.Items.Insert(0, value.StandardName);
                        cboTimeZone.SelectedIndex = 0;
                    }
                }
            }

            m_original = value;
            SetButtonEnabled(DialogResult.OK, false);
        }
Example #2
0
        protected override void WriteAllSettings(XmlWriter writer)
        {
            // Message Reader

            StartSection(writer, SectionMessageReader);
            WriteSetting(writer, SettingRemoveWhenReading, XmlConvert.ToString(RemoveWhenReading));
            WriteSetting(writer, SettingMaxCountToAutoStart, XmlConvert.ToString(MaxCountToAutoStart));
            EndSection(writer);

            // Visual

            StartSection(writer, SectionVisual);
            WriteSetting(writer, SettingMainWindow, MainWindow);
            WriteSetting(writer, SettingLogWindow, LogWindow);
            WriteSetting(writer, SettingDetailsWindow, DetailsWindow);
            WriteSetting(writer, SettingExceptionWindow, ExceptionWindow);
            WriteSetting(writer, SettingGenericEditorWindow, GenericEditorWindow);
            WriteSetting(writer, SettingLogColumnWidths, LogColumnWidths);
            WriteSetting(writer, SettingLogSplitterRatio, XmlConvert.ToString(LogSplitRatio));
            WriteSetting(writer, SettingDetailsSplitterRatioTop, XmlConvert.ToString(DetailsSplitterRatioTop));
            WriteSetting(writer, SettingDetailsSplitterRatioBottom, XmlConvert.ToString(DetailsSplitterRatioBottom));
            WriteSetting(writer, SettingDetailColumnWidths, DetailColumnWidths);
            WriteSetting(writer, SettingParameterColumnWidths, ParameterColumnWidths);
            EndSection(writer);

            // View

            StartSection(writer, SectionView);
            WriteSetting(writer, SettingPreviewPane, XmlConvert.ToString(PreviewPane));
            WriteSetting(writer, SettingStatusBar, XmlConvert.ToString(StatusBar));
            WriteSetting(writer, SettingAutoScrollMessages, XmlConvert.ToString(AutoScrollMessages));

            // Write the standard name of the time zone or "(CurrentTimeZone)" for the current time zone.

            System.TimeZone timeZone = DisplayTimeZone;
            if (timeZone == null || timeZone == System.TimeZone.CurrentTimeZone)
            {
                WriteSetting(writer, SettingDisplayTimeZone, CurrentTimeZoneName);
            }
            else
            {
                Debug.Assert(timeZone is LinkMeType.TimeZone, "Unexpected type of TimeZone: " + timeZone.GetType().FullName);
                WriteSetting(writer, SettingDisplayTimeZone, ((LinkMeType.TimeZone)timeZone).StandardName);
            }

            EndSection(writer);

            // Recently used

            StartSection(writer, SectionRecentlyUsed);
            WriteSetting(writer, SettingMaxRecentlyUsed, XmlConvert.ToString(MaxRecentlyUsed));
            WriteSetting(writer, SettingRecentlyUsedList, RecentlyUsedList);
            WriteSetting(writer, SettingLastActive, LastActive);
            EndSection(writer);
        }