Пример #1
0
        /// <summary>
        /// 設定を動作に反映し、保存します。
        /// </summary>
        private void ApplyAndSaveSettings()
        {
            if (SettingsWrapper == null)
            {
                throw new InvalidOperationException(String.Format(IS_NULL_MESSAGE, nameof(SettingsWrapper)));
            }

            SetAlignmentFromRadioButton(out VerticalAlignment verticalAlignment, out HorizontalAlignment horizontalAlignment);
            SettingsWrapper.VerticalAlignment      = (int)verticalAlignment;
            SettingsWrapper.HorizontalAlignment    = (int)horizontalAlignment;
            SettingsWrapper.VerticalMarginNumber   = Double.Parse(VerticalMarginString);
            SettingsWrapper.HorizontalMarginNumber = Double.Parse(HorizontalMarginString);
            SettingsWrapper.IsPercentVertical      = VerticalMarginPercent;
            SettingsWrapper.IsPercentHorizontal    = HorizontalMarginPercent;
            SettingsWrapper.CustumHolidaysString   = CustomHolidaysParser.Serialize(CustomHolidaysDictionary);

            // 反映し終えたら、設定は無変更状態。
            SettingIsChanged = false;

            // 設定の保存
            SettingsWrapper.Save();
        }
Пример #2
0
        /// <summary>
        /// 設定をロードします。
        /// </summary>
        private void LoadSettings()
        {
            if (SettingsWrapper == null)
            {
                throw new InvalidOperationException(String.Format(IS_NULL_MESSAGE, nameof(SettingsWrapper)));
            }

            // Properties.Settings からの読み出し
            SetAlignmentToRadioButton(
                (VerticalAlignment)SettingsWrapper.VerticalAlignment,
                (HorizontalAlignment)SettingsWrapper.HorizontalAlignment);
            VerticalMarginString    = SettingsWrapper.VerticalMarginNumber.ToString();
            HorizontalMarginString  = SettingsWrapper.HorizontalMarginNumber.ToString();
            VerticalMarginPercent   = SettingsWrapper.IsPercentVertical;
            VerticalMarginPixel     = !SettingsWrapper.IsPercentVertical;
            HorizontalMarginPercent = SettingsWrapper.IsPercentHorizontal;
            HorizontalMarginPixel   = !SettingsWrapper.IsPercentHorizontal;
            CustomHolidaysParser.Deserialize(SettingsWrapper.CustumHolidaysString, CustomHolidaysDictionary);

            // ロードし終えたら、設定は無変更状態。
            SettingIsChanged = false;
        }