コード例 #1
0
ファイル: AppleV2Settings.cs プロジェクト: memoarfaa/fb2epub
 /// <summary>
 /// Saves current state to settings
 /// </summary>
 /// <param name="settings"></param>
 public override void SaveToSettings(IConverterSettings settings)
 {
     settings.V2Settings.AppleConverterEPubSettings.Platforms.Clear();
     foreach (var platform in _used.Values)
     {
         var createdSettings = new AppleEPub2PlatformSettings();
         createdSettings.CopyFrom(platform);
         settings.V2Settings.AppleConverterEPubSettings.Platforms.Add(createdSettings);
     }
     base.SaveToSettings(settings);
 }
コード例 #2
0
ファイル: AppleV2Settings.cs プロジェクト: memoarfaa/fb2epub
        /// <summary>
        /// Updated settings values for currently selected platform based on internal state
        /// </summary>
        private void UpdateSelectedPlatformValues()
        {
            AppleEPub2PlatformSettings selectedPlatform = null;

            if (_selectedListBox == SelectedBox.Available)
            {
                if (_available.Count > 0)
                {
                    AppleTargetPlatform selectedKey = (AppleTargetPlatform)listBoxAvailablePlatforms.SelectedItem;
                    if (selectedKey != AppleTargetPlatform.NotSet)
                    {
                        if (_available.ContainsKey(selectedKey))
                        {
                            selectedPlatform = _allPlatformObjects[selectedKey];
                        }
                        else
                        {
                            throw new Exception("the platform selected in Available box is not in available list");
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid platform type selected in the box");
                    }
                }
            }
            else if (_selectedListBox == SelectedBox.Used)
            {
                if (_used.Count > 0)
                {
                    AppleTargetPlatform selectedKey = (AppleTargetPlatform)listBoxUsedPlatforms.SelectedItem;
                    if (selectedKey != AppleTargetPlatform.NotSet)
                    {
                        if (_used.ContainsKey(selectedKey))
                        {
                            selectedPlatform = _allPlatformObjects[selectedKey];
                        }
                        else
                        {
                            throw new Exception("the platform selected in Used box is not in available list");
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid platform type selected in the box");
                    }
                }
            }
            DisplayPlatformSettings(selectedPlatform);
        }
コード例 #3
0
ファイル: AppleV2Settings.cs プロジェクト: memoarfaa/fb2epub
        /// <summary>
        /// Update display of currently selected platform settings based on platform object passed
        /// </summary>
        /// <param name="selectedPlatform"></param>
        private void DisplayPlatformSettings(AppleEPub2PlatformSettings selectedPlatform)
        {
            bool displayEnabled = _selectedListBox == SelectedBox.Used && selectedPlatform != null;

            checkBoxFixedLayout.Enabled     = displayEnabled;
            checkBoxSpreadToOpen.Enabled    = displayEnabled;
            checkBoxUseCustomFonts.Enabled  = displayEnabled;
            comboBoxOrientationLock.Enabled = displayEnabled;
            if (displayEnabled)
            {
                checkBoxFixedLayout.Checked           = selectedPlatform.FixedLayout;
                checkBoxSpreadToOpen.Checked          = selectedPlatform.OpenToSpread;
                checkBoxUseCustomFonts.Checked        = selectedPlatform.UseCustomFonts;
                comboBoxOrientationLock.SelectedIndex = (int)selectedPlatform.OrientationLock;
            }
            else
            {
                checkBoxFixedLayout.Checked           = false;
                checkBoxSpreadToOpen.Checked          = false;
                checkBoxUseCustomFonts.Checked        = false;
                comboBoxOrientationLock.SelectedIndex = -1;
            }
        }