/// <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(); } }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { AppleOrientationLock orientationLock = (AppleOrientationLock)value; switch (orientationLock) { case AppleOrientationLock.None: return(Resources.Fb2epubSettings.Applev2BookOrientationLockOff); case AppleOrientationLock.LandscapeOnly: return(Resources.Fb2epubSettings.Applev2BookOrientationLockLandscapeOnly); case AppleOrientationLock.PortraitOnly: return(Resources.Fb2epubSettings.Applev2BookOrientationLockPortraitOnly); } } return(base.ConvertTo(context, culture, value, destinationType)); }
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(); } }