protected virtual void AddChild(object child) { ThicknessKeyFrame keyFrame = child as ThicknessKeyFrame; if (keyFrame != null) { KeyFrames.Add(keyFrame); } else { throw new ArgumentException(SR.Get(SRID.Animation_ChildMustBeKeyFrame), "child"); } }
protected virtual void AddText(string childText) { throw new InvalidOperationException(SR.Get(SRID.Animation_NoTextChildren)); }
/// <summary> /// Return an object that should be set on the targetObject's targetProperty /// for this markup extension. For a StaticExtension this is a static field /// or property value. /// </summary> /// <param name="serviceProvider">Object that can provide services for the markup extension.</param> /// <returns> /// The object to set on this property. /// </returns> public override object ProvideValue(IServiceProvider serviceProvider) { if (Member == null) { throw new InvalidOperationException(SR.Get(SRID.MarkupExtensionStaticMember)); } object value; if (MemberType != null) { value = SystemResourceKey.GetSystemResourceKey(MemberType.Name + "." + Member); if (value != null) { return(value); } } else { value = SystemResourceKey.GetSystemResourceKey(Member); if (value != null) { return(value); } // Validate the _member int dotIndex = Member.IndexOf('.'); if (dotIndex < 0) { throw new ArgumentException(SR.Get(SRID.MarkupExtensionBadStatic, Member)); } // Pull out the type substring (this will include any XML prefix, e.g. "av:Button") string typeString = Member.Substring(0, dotIndex); if (typeString == string.Empty) { throw new ArgumentException(SR.Get(SRID.MarkupExtensionBadStatic, Member)); } // Get the IXamlTypeResolver from the service provider if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } IXamlTypeResolver xamlTypeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver; if (xamlTypeResolver == null) { throw new ArgumentException(SR.Get(SRID.MarkupExtensionNoContext, GetType().Name, "IXamlTypeResolver")); } // Use the type resolver to get a Type instance MemberType = xamlTypeResolver.Resolve(typeString); // Get the member name substring Member = Member.Substring(dotIndex + 1, Member.Length - dotIndex - 1); } value = CommandConverter.GetKnownControlCommand(MemberType, Member); if (value != null) { return(value); } return(base.ProvideValue(serviceProvider)); }
/// <summary> /// Gets the data format with the Windows Clipboard numeric ID and name for the specified data format. /// </summary> /// <remarks> /// Callers must have UnmanagedCode permission to call this API. /// </remarks> public static DataFormat GetDataFormat(string format) { if (format == null) { throw new ArgumentNullException("format"); } if (format == string.Empty) { throw new ArgumentException(SR.Get(SRID.DataObject_EmptyFormatNotAllowed)); } // Ensures the predefined Win32 data formats into our format list. EnsurePredefined(); // Lock the data format list to obtains the mutual-exclusion. lock (_formatListlock) { int formatId; int index; // It is much faster to do a case sensitive search here. So do // the case sensitive compare first, then the expensive one. // for (int n = 0; n < _formatList.Count; n++) { DataFormat formatItem; formatItem = (DataFormat)_formatList[n]; if (formatItem.Name.Equals(format)) { return(formatItem); } } for (int n = 0; n < _formatList.Count; n++) { DataFormat formatItem; formatItem = (DataFormat)_formatList[n]; if (String.Compare(formatItem.Name, format, StringComparison.OrdinalIgnoreCase) == 0) { return(formatItem); } } // Reigster the this format string. formatId = UnsafeNativeMethods.RegisterClipboardFormat(format); if (formatId == 0) { throw new System.ComponentModel.Win32Exception(); } index = _formatList.Add(new DataFormat(format, formatId)); return((DataFormat)_formatList[index]); } }