Exemple #1
0
 private void checkBoxSpreadToOpen_CheckedChanged(object sender, EventArgs e)
 {
     if (_selectedListBox == SelectedBox.Used)
     {
         AppleTargetPlatform currentPlatform = GetCurrentPlatform();
         _allPlatformObjects[currentPlatform].OpenToSpread = checkBoxSpreadToOpen.Checked;
     }
 }
Exemple #2
0
 private void checkBoxUseCustomFonts_CheckedChanged(object sender, EventArgs e)
 {
     if (_selectedListBox == SelectedBox.Used)
     {
         AppleTargetPlatform currentPlatform = GetCurrentPlatform();
         _allPlatformObjects[currentPlatform].UseCustomFonts = checkBoxUseCustomFonts.Checked;
     }
 }
Exemple #3
0
        private void buttonMoveLeft_Click(object sender, EventArgs e)
        {
            SuspendLayout();
            AppleTargetPlatform platformToMove = (AppleTargetPlatform)listBoxUsedPlatforms.SelectedItem;

            _used.Remove(platformToMove);
            _available.Add(platformToMove, _allPlatformObjects[platformToMove]);
            listBoxAvailablePlatforms.Focus();
            UpdateListBoxes();
            SelectPlatform(platformToMove);
            ResumeLayout();
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
 private void comboBoxOrientationLock_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (_selectedListBox == SelectedBox.Used)
     {
         AppleTargetPlatform      currentPlatform = GetCurrentPlatform();
         OrientationTypeConverter converter       = new OrientationTypeConverter();
         string value             = (string)comboBoxOrientationLock.SelectedItem;
         var    convertFromString = converter.ConvertFromString(value);
         if (convertFromString != null)
         {
             var orientationLock = (AppleOrientationLock)convertFromString;
             _allPlatformObjects[currentPlatform].OrientationLock = orientationLock;
         }
     }
 }
 /// <summary>
 /// Copies values from another object
 /// </summary>
 /// <param name="otherSettings"></param>
 public void CopyFrom(IAppleEPub2PlatformSettings otherSettings)
 {
     if (otherSettings == null)
     {
         throw new ArgumentNullException("otherSettings");
     }
     if (otherSettings == this)
     {
         return;
     }
     _useCustomFonts  = otherSettings.UseCustomFonts;
     _openToSpread    = otherSettings.OpenToSpread;
     _targetPlatform  = otherSettings.Name;
     _orientationLock = otherSettings.OrientationLock;
     _fixedLayout     = otherSettings.FixedLayout;
 }
        public void ReadXml(XmlReader reader)
        {
            while (!reader.EOF)
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case UseCusomFontsOnAppleDevicesElementName:
                        _useCustomFonts = reader.ReadElementContentAsBoolean();
                        continue;

                    case OpenToSpreadOnAppleDevicesElementName:
                        _openToSpread = reader.ReadElementContentAsBoolean();
                        continue;

                    case PlatformTypeElementName:
                        AppleTargetPlatform target;
                        string elementContent = reader.ReadElementContentAsString();
                        if (!Enum.TryParse(elementContent, true, out target))
                        {
                            throw new InvalidDataException(string.Format("Invalid target platform {0} specified", elementContent));
                        }
                        _targetPlatform = target;
                        continue;

                    case FixedLayoutOnAppleDevicesElementName:
                        _fixedLayout = reader.ReadElementContentAsBoolean();
                        continue;

                    case OrientationLockOnAppleDevicesElementName:
                        AppleOrientationLock orientationLock;
                        elementContent = reader.ReadElementContentAsString();
                        if (!Enum.TryParse(elementContent, true, out orientationLock))
                        {
                            throw new InvalidDataException(string.Format("Invalid orientation lock {0} specified", elementContent));
                        }
                        _orientationLock = orientationLock;
                        continue;
                    }
                }
                reader.Read();
            }
        }
Exemple #8
0
 private void checkBoxFixedLayout_CheckedChanged(object sender, EventArgs e)
 {
     if (_selectedListBox == SelectedBox.Used)
     {
         AppleTargetPlatform currentPlatform = GetCurrentPlatform();
         if (checkBoxFixedLayout.Checked)
         {
             DialogResult result = MessageBox.Show(Resources.Fb2epubSettings.AppleV2Settings_checkBoxFixedLayout_CheckedChanged_Fixed_layout_is_not_fit_for_automatic_convertors,
                                                   Resources.Fb2epubSettings.AppleV2Settings_checkBoxFixedLayout_CheckedChanged_Are_you_sure_,
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
             if (result == DialogResult.No)
             {
                 checkBoxFixedLayout.Checked = false;
                 return;
             }
         }
         _allPlatformObjects[currentPlatform].FixedLayout = checkBoxFixedLayout.Checked;
     }
 }
 private void SelectPlatform(AppleTargetPlatform itemKey)
 {
     DisplayPlatformSettings(_allPlatformObjects[itemKey]);
     UpdateButtons();
 }
Exemple #10
0
 private void SelectPlatform(AppleTargetPlatform itemKey)
 {
     DisplayPlatformSettings(_allPlatformObjects[itemKey]);
     UpdateButtons();
 }
 /// <summary>
 /// Copies values from another object
 /// </summary>
 /// <param name="otherSettings"></param>
 public void CopyFrom(IAppleEPub2PlatformSettings otherSettings)
 {
     if (otherSettings == null)
     {
         throw new ArgumentNullException("otherSettings");
     }
     if (otherSettings == this)
     {
         return;
     }
     _useCustomFonts = otherSettings.UseCustomFonts;
     _openToSpread = otherSettings.OpenToSpread;
     _targetPlatform = otherSettings.Name;
     _orientationLock = otherSettings.OrientationLock;
     _fixedLayout = otherSettings.FixedLayout;
 }
 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF )
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case UseCusomFontsOnAppleDevicesElementName:
                     _useCustomFonts = reader.ReadElementContentAsBoolean();
                     continue;
                 case OpenToSpreadOnAppleDevicesElementName:
                     _openToSpread = reader.ReadElementContentAsBoolean();
                     continue;
                 case PlatformTypeElementName:
                     AppleTargetPlatform target;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out target))
                     {
                         throw new InvalidDataException(string.Format("Invalid target platform {0} specified", elementContent));
                     }
                     _targetPlatform = target;
                     continue;
                 case FixedLayoutOnAppleDevicesElementName:
                     _fixedLayout = reader.ReadElementContentAsBoolean();
                     continue;
                 case OrientationLockOnAppleDevicesElementName:
                     AppleOrientationLock orientationLock;
                     elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out orientationLock))
                     {
                         throw new InvalidDataException(string.Format("Invalid orientation lock {0} specified", elementContent));
                     }
                     _orientationLock = orientationLock;
                     continue;
             }
         }
         reader.Read();
     }            
     
 }