Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / PropertyManager.cs / 1305376 / PropertyManager.cs
namespace System.Windows.Forms { using System; using System.Windows.Forms; using System.Diagnostics.CodeAnalysis; using System.ComponentModel; using System.Collections; ////// /// public class PropertyManager : BindingManagerBase { // PropertyManager class // private object dataSource; private string propName; private PropertyDescriptor propInfo; private bool bound; ///[To be supplied.] ////// /// public override Object Current { get { return this.dataSource; } } private void PropertyChanged(object sender, EventArgs ea) { EndCurrentEdit(); OnCurrentChanged(EventArgs.Empty); } internal override void SetDataSource(Object dataSource) { if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) { propInfo.RemoveValueChanged(this.dataSource, new EventHandler(PropertyChanged)); propInfo = null; } this.dataSource = dataSource; if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) { propInfo = TypeDescriptor.GetProperties(dataSource).Find(propName, true); if (propInfo == null) throw new ArgumentException(SR.GetString(SR.PropertyManagerPropDoesNotExist, propName, dataSource.ToString())); propInfo.AddValueChanged(dataSource, new EventHandler(PropertyChanged)); } } ///[To be supplied.] ////// /// public PropertyManager() {} [ SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors") // If the constructor does not set the dataSource // it would be a breaking change. ] internal PropertyManager(Object dataSource) : base(dataSource){} [ SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors") // If the constructor does not set the dataSource // it would be a breaking change. ] internal PropertyManager(Object dataSource, string propName) : base() { this.propName = propName; this.SetDataSource(dataSource); } internal override PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors) { if (dataSource == null) { return new PropertyDescriptorCollection(null); } else { // Revert to Everett logic return TypeDescriptor.GetProperties(dataSource); } } internal override Type BindType { get { return dataSource.GetType(); } } internal override String GetListName() { return TypeDescriptor.GetClassName(dataSource) + "." + propName; } ///[To be supplied.] ///public override void SuspendBinding() { EndCurrentEdit(); if (bound) { try { bound = false; UpdateIsBinding(); } catch { bound = true; UpdateIsBinding(); throw; } } } /// public override void ResumeBinding() { OnCurrentChanged(new EventArgs()); if (!bound) { try { bound = true; UpdateIsBinding(); } catch { bound = false; UpdateIsBinding(); throw; } } } /// /// /// protected internal override String GetListName(ArrayList listAccessors) { return ""; } ///[To be supplied.] ////// /// public override void CancelCurrentEdit() { IEditableObject obj = this.Current as IEditableObject; if (obj != null) obj.CancelEdit(); PushData(); } ///[To be supplied.] ////// /// public override void EndCurrentEdit() { bool success; PullData(out success); if (success) { IEditableObject obj = this.Current as IEditableObject; if (obj != null) obj.EndEdit(); } } ///[To be supplied.] ////// /// protected override void UpdateIsBinding() { for (int i = 0; i < this.Bindings.Count; i++) this.Bindings[i].UpdateIsBinding(); } ///[To be supplied.] ////// /// internal protected override void OnCurrentChanged(EventArgs ea) { PushData(); if (this.onCurrentChangedHandler != null) this.onCurrentChangedHandler(this, ea); if (this.onCurrentItemChangedHandler != null) this.onCurrentItemChangedHandler(this, ea); } ///[To be supplied.] ////// /// internal protected override void OnCurrentItemChanged(EventArgs ea) { PushData(); if (this.onCurrentItemChangedHandler != null) this.onCurrentItemChangedHandler(this, ea); } internal override object DataSource { get { return this.dataSource; } } internal override bool IsBinding { get { return (dataSource != null); } } // no op on the propertyManager ///[To be supplied.] ////// /// public override int Position { get { return 0; } set { } } ///[To be supplied.] ///public override int Count { get { return 1; } } // no-op on the propertyManager /// /// /// public override void AddNew() { throw new NotSupportedException(SR.GetString(SR.DataBindingAddNewNotSupportedOnPropertyManager)); } // no-op on the propertyManager ///[To be supplied.] ////// /// public override void RemoveAt(int index) { throw new NotSupportedException(SR.GetString(SR.DataBindingRemoveAtNotSupportedOnPropertyManager)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Windows.Forms { using System; using System.Windows.Forms; using System.Diagnostics.CodeAnalysis; using System.ComponentModel; using System.Collections; ///[To be supplied.] ////// /// public class PropertyManager : BindingManagerBase { // PropertyManager class // private object dataSource; private string propName; private PropertyDescriptor propInfo; private bool bound; ///[To be supplied.] ////// /// public override Object Current { get { return this.dataSource; } } private void PropertyChanged(object sender, EventArgs ea) { EndCurrentEdit(); OnCurrentChanged(EventArgs.Empty); } internal override void SetDataSource(Object dataSource) { if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) { propInfo.RemoveValueChanged(this.dataSource, new EventHandler(PropertyChanged)); propInfo = null; } this.dataSource = dataSource; if (this.dataSource != null && !String.IsNullOrEmpty(this.propName)) { propInfo = TypeDescriptor.GetProperties(dataSource).Find(propName, true); if (propInfo == null) throw new ArgumentException(SR.GetString(SR.PropertyManagerPropDoesNotExist, propName, dataSource.ToString())); propInfo.AddValueChanged(dataSource, new EventHandler(PropertyChanged)); } } ///[To be supplied.] ////// /// public PropertyManager() {} [ SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors") // If the constructor does not set the dataSource // it would be a breaking change. ] internal PropertyManager(Object dataSource) : base(dataSource){} [ SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors") // If the constructor does not set the dataSource // it would be a breaking change. ] internal PropertyManager(Object dataSource, string propName) : base() { this.propName = propName; this.SetDataSource(dataSource); } internal override PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors) { if (dataSource == null) { return new PropertyDescriptorCollection(null); } else { // Revert to Everett logic return TypeDescriptor.GetProperties(dataSource); } } internal override Type BindType { get { return dataSource.GetType(); } } internal override String GetListName() { return TypeDescriptor.GetClassName(dataSource) + "." + propName; } ///[To be supplied.] ///public override void SuspendBinding() { EndCurrentEdit(); if (bound) { try { bound = false; UpdateIsBinding(); } catch { bound = true; UpdateIsBinding(); throw; } } } /// public override void ResumeBinding() { OnCurrentChanged(new EventArgs()); if (!bound) { try { bound = true; UpdateIsBinding(); } catch { bound = false; UpdateIsBinding(); throw; } } } /// /// /// protected internal override String GetListName(ArrayList listAccessors) { return ""; } ///[To be supplied.] ////// /// public override void CancelCurrentEdit() { IEditableObject obj = this.Current as IEditableObject; if (obj != null) obj.CancelEdit(); PushData(); } ///[To be supplied.] ////// /// public override void EndCurrentEdit() { bool success; PullData(out success); if (success) { IEditableObject obj = this.Current as IEditableObject; if (obj != null) obj.EndEdit(); } } ///[To be supplied.] ////// /// protected override void UpdateIsBinding() { for (int i = 0; i < this.Bindings.Count; i++) this.Bindings[i].UpdateIsBinding(); } ///[To be supplied.] ////// /// internal protected override void OnCurrentChanged(EventArgs ea) { PushData(); if (this.onCurrentChangedHandler != null) this.onCurrentChangedHandler(this, ea); if (this.onCurrentItemChangedHandler != null) this.onCurrentItemChangedHandler(this, ea); } ///[To be supplied.] ////// /// internal protected override void OnCurrentItemChanged(EventArgs ea) { PushData(); if (this.onCurrentItemChangedHandler != null) this.onCurrentItemChangedHandler(this, ea); } internal override object DataSource { get { return this.dataSource; } } internal override bool IsBinding { get { return (dataSource != null); } } // no op on the propertyManager ///[To be supplied.] ////// /// public override int Position { get { return 0; } set { } } ///[To be supplied.] ///public override int Count { get { return 1; } } // no-op on the propertyManager /// /// /// public override void AddNew() { throw new NotSupportedException(SR.GetString(SR.DataBindingAddNewNotSupportedOnPropertyManager)); } // no-op on the propertyManager ///[To be supplied.] ////// /// public override void RemoveAt(int index) { throw new NotSupportedException(SR.GetString(SR.DataBindingRemoveAtNotSupportedOnPropertyManager)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SQLBytesStorage.cs
- ReadOnlyState.cs
- DynamicEndpoint.cs
- MethodBuilderInstantiation.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- FixedSOMTable.cs
- DynamicValueConverter.cs
- PeerContact.cs
- StatementContext.cs
- XmlSchemaImport.cs
- SchemaElementDecl.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- SmtpDigestAuthenticationModule.cs
- MethodBody.cs
- GlobalItem.cs
- Int64Animation.cs
- PkcsMisc.cs
- CalendarDateRange.cs
- IsolatedStoragePermission.cs
- HttpException.cs
- KeySpline.cs
- ConfigXmlSignificantWhitespace.cs
- GridViewUpdatedEventArgs.cs
- SqlUdtInfo.cs
- Char.cs
- View.cs
- URLAttribute.cs
- TypeSystem.cs
- Point3DIndependentAnimationStorage.cs
- PageCodeDomTreeGenerator.cs
- BreakRecordTable.cs
- MenuAutomationPeer.cs
- TraceUtils.cs
- LicenseProviderAttribute.cs
- SoapHeaderAttribute.cs
- DataGridViewTopLeftHeaderCell.cs
- ExternalFile.cs
- DNS.cs
- Suspend.cs
- OracleBoolean.cs
- FtpRequestCacheValidator.cs
- EntityDataSource.cs
- SchemaImporterExtensionsSection.cs
- QilInvokeLateBound.cs
- _emptywebproxy.cs
- TimeSpanMinutesConverter.cs
- QilLiteral.cs
- XmlNodeChangedEventArgs.cs
- ControlBuilderAttribute.cs
- WindowsRichEdit.cs
- Operator.cs
- DetailsViewActionList.cs
- EdmSchemaAttribute.cs
- ReservationCollection.cs
- BinaryParser.cs
- XhtmlMobileTextWriter.cs
- WizardForm.cs
- HtmlShimManager.cs
- MarkupCompilePass2.cs
- ReflectionUtil.cs
- ListViewDesigner.cs
- BitmapSourceSafeMILHandle.cs
- DynamicRenderer.cs
- CollectionView.cs
- GraphicsContext.cs
- QueryContinueDragEventArgs.cs
- PropertyEmitterBase.cs
- SymbolDocumentInfo.cs
- ClickablePoint.cs
- WebMessageEncodingElement.cs
- DBConnection.cs
- TextFormatterContext.cs
- QilName.cs
- DodSequenceMerge.cs
- CheckBoxStandardAdapter.cs
- AutoResizedEvent.cs
- DrawingBrush.cs
- BaseCAMarshaler.cs
- webclient.cs
- DataServiceCollectionOfT.cs
- DbExpressionBuilder.cs
- SafeNativeMethods.cs
- WsrmTraceRecord.cs
- GridView.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Helpers.cs
- PathFigureCollection.cs
- HashMembershipCondition.cs
- BindingElementCollection.cs
- CustomErrorsSectionWrapper.cs
- ArrayWithOffset.cs
- LazyInitializer.cs
- TypedRowHandler.cs
- DoubleAnimationUsingKeyFrames.cs
- DefaultAssemblyResolver.cs
- MenuBindingsEditor.cs
- ReaderWriterLock.cs
- RtfToXamlLexer.cs
- DataStreamFromComStream.cs