Files
2026-06-04 11:42:34 +02:00

186 lines
7.6 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace System.ComponentModel
{
/// <summary>Provides the base implementation for the <see cref="T:System.ComponentModel.IComponent" /> interface and enables object sharing between applications.</summary>
// Token: 0x02000064 RID: 100
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DesignerCategory("Component")]
[ComVisible(true)]
public class Component : MarshalByRefObject, IDisposable, IComponent
{
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Component" /> class. </summary>
// Token: 0x060003BD RID: 957 RVA: 0x0000B740 File Offset: 0x00009940
public Component()
{
this.event_handlers = null;
}
/// <summary>Occurs when the component is disposed by a call to the <see cref="M:System.ComponentModel.Component.Dispose" /> method. </summary>
// Token: 0x14000013 RID: 19
// (add) Token: 0x060003BE RID: 958 RVA: 0x0000B75C File Offset: 0x0000995C
// (remove) Token: 0x060003BF RID: 959 RVA: 0x0000B770 File Offset: 0x00009970
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler Disposed
{
add
{
this.Events.AddHandler(this.disposedEvent, value);
}
remove
{
this.Events.RemoveHandler(this.disposedEvent, value);
}
}
/// <summary>Gets a value indicating whether the component can raise an event.</summary>
/// <returns>true if the component can raise events; otherwise, false. The default is true.</returns>
// Token: 0x17000108 RID: 264
// (get) Token: 0x060003C0 RID: 960 RVA: 0x0000B784 File Offset: 0x00009984
protected virtual bool CanRaiseEvents
{
get
{
return false;
}
}
/// <summary>Gets or sets the <see cref="T:System.ComponentModel.ISite" /> of the <see cref="T:System.ComponentModel.Component" />.</summary>
/// <returns>The <see cref="T:System.ComponentModel.ISite" /> associated with the <see cref="T:System.ComponentModel.Component" />, or null if the <see cref="T:System.ComponentModel.Component" /> is not encapsulated in an <see cref="T:System.ComponentModel.IContainer" />, the <see cref="T:System.ComponentModel.Component" /> does not have an <see cref="T:System.ComponentModel.ISite" /> associated with it, or the <see cref="T:System.ComponentModel.Component" /> is removed from its <see cref="T:System.ComponentModel.IContainer" />.</returns>
// Token: 0x17000109 RID: 265
// (get) Token: 0x060003C1 RID: 961 RVA: 0x0000B788 File Offset: 0x00009988
// (set) Token: 0x060003C2 RID: 962 RVA: 0x0000B790 File Offset: 0x00009990
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public virtual ISite Site
{
get
{
return this.mySite;
}
set
{
this.mySite = value;
}
}
/// <summary>Gets the <see cref="T:System.ComponentModel.IContainer" /> that contains the <see cref="T:System.ComponentModel.Component" />.</summary>
/// <returns>The <see cref="T:System.ComponentModel.IContainer" /> that contains the <see cref="T:System.ComponentModel.Component" />, if any, or null if the <see cref="T:System.ComponentModel.Component" /> is not encapsulated in an <see cref="T:System.ComponentModel.IContainer" />.</returns>
// Token: 0x1700010A RID: 266
// (get) Token: 0x060003C3 RID: 963 RVA: 0x0000B79C File Offset: 0x0000999C
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IContainer Container
{
get
{
if (this.mySite == null)
{
return null;
}
return this.mySite.Container;
}
}
/// <summary>Gets a value that indicates whether the <see cref="T:System.ComponentModel.Component" /> is currently in design mode.</summary>
/// <returns>true if the <see cref="T:System.ComponentModel.Component" /> is in design mode; otherwise, false.</returns>
// Token: 0x1700010B RID: 267
// (get) Token: 0x060003C4 RID: 964 RVA: 0x0000B7B8 File Offset: 0x000099B8
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
protected bool DesignMode
{
get
{
return this.mySite != null && this.mySite.DesignMode;
}
}
/// <summary>Gets the list of event handlers that are attached to this <see cref="T:System.ComponentModel.Component" />.</summary>
/// <returns>An <see cref="T:System.ComponentModel.EventHandlerList" /> that provides the delegates for this component.</returns>
// Token: 0x1700010C RID: 268
// (get) Token: 0x060003C5 RID: 965 RVA: 0x0000B7D4 File Offset: 0x000099D4
protected EventHandlerList Events
{
get
{
if (this.event_handlers == null)
{
this.event_handlers = new EventHandlerList();
}
return this.event_handlers;
}
}
/// <summary>Releases unmanaged resources and performs other cleanup operations before the <see cref="T:System.ComponentModel.Component" /> is reclaimed by garbage collection.</summary>
// Token: 0x060003C6 RID: 966 RVA: 0x0000B7F4 File Offset: 0x000099F4
~Component()
{
this.Dispose(false);
}
/// <summary>Releases all resources used by the <see cref="T:System.ComponentModel.Component" />.</summary>
// Token: 0x060003C7 RID: 967 RVA: 0x0000B830 File Offset: 0x00009A30
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Component" /> and optionally releases the managed resources.</summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
// Token: 0x060003C8 RID: 968 RVA: 0x0000B840 File Offset: 0x00009A40
protected virtual void Dispose(bool release_all)
{
if (release_all)
{
if (this.mySite != null && this.mySite.Container != null)
{
this.mySite.Container.Remove(this);
}
EventHandler eventHandler = (EventHandler)this.Events[this.disposedEvent];
if (eventHandler != null)
{
eventHandler(this, EventArgs.Empty);
}
}
}
/// <summary>Returns an object that represents a service provided by the <see cref="T:System.ComponentModel.Component" /> or by its <see cref="T:System.ComponentModel.Container" />.</summary>
/// <returns>An <see cref="T:System.Object" /> that represents a service provided by the <see cref="T:System.ComponentModel.Component" />, or null if the <see cref="T:System.ComponentModel.Component" /> does not provide the specified service.</returns>
/// <param name="service">A service provided by the <see cref="T:System.ComponentModel.Component" />. </param>
// Token: 0x060003C9 RID: 969 RVA: 0x0000B8A8 File Offset: 0x00009AA8
protected virtual object GetService(Type service)
{
if (this.mySite != null)
{
return this.mySite.GetService(service);
}
return null;
}
/// <summary>Returns a <see cref="T:System.String" /> containing the name of the <see cref="T:System.ComponentModel.Component" />, if any. This method should not be overridden.</summary>
/// <returns>A <see cref="T:System.String" /> containing the name of the <see cref="T:System.ComponentModel.Component" />, if any, or null if the <see cref="T:System.ComponentModel.Component" /> is unnamed.</returns>
// Token: 0x060003CA RID: 970 RVA: 0x0000B8C4 File Offset: 0x00009AC4
public override string ToString()
{
if (this.mySite == null)
{
return base.GetType().ToString();
}
return string.Format("{0} [{1}]", this.mySite.Name, base.GetType().ToString());
}
// Token: 0x04000142 RID: 322
private EventHandlerList event_handlers;
// Token: 0x04000143 RID: 323
private ISite mySite;
// Token: 0x04000144 RID: 324
private object disposedEvent = new object();
}
}