Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
//
// AddingNewEventArgs.cs
//
// Author: Duncan Mak (duncan@novell.com)
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.ComponentModel {
public class AddingNewEventArgs : EventArgs
{
object obj;
public AddingNewEventArgs ()
: this (null)
{
}
public AddingNewEventArgs (object newObject)
{
this.obj = newObject;
}
public object NewObject {
get { return obj; }
set { obj = value; }
}
}
}

View File

@@ -0,0 +1,34 @@
//
// AddingNewEventHandler.cs
//
// Author: Duncan Mak (duncan@novell.com)
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.ComponentModel {
public delegate void AddingNewEventHandler (object sender, AddingNewEventArgs e);
}

View File

@@ -0,0 +1,120 @@
//
// System.ComponentModel.AmbientValueAttribute
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.All)]
public sealed class AmbientValueAttribute : Attribute
{
private object AmbientValue;
public AmbientValueAttribute (bool value)
{
AmbientValue = value;
}
public AmbientValueAttribute (byte value)
{
AmbientValue = value;
}
public AmbientValueAttribute (char value)
{
AmbientValue = value;
}
public AmbientValueAttribute (double value)
{
AmbientValue = value;
}
public AmbientValueAttribute (short value)
{
AmbientValue = value;
}
public AmbientValueAttribute (int value)
{
AmbientValue = value;
}
public AmbientValueAttribute (long value)
{
AmbientValue = value;
}
public AmbientValueAttribute (object value)
{
AmbientValue = value;
}
public AmbientValueAttribute (float value)
{
AmbientValue = value;
}
public AmbientValueAttribute (string value)
{
AmbientValue = value;
}
public AmbientValueAttribute (Type type, string value)
{
try {
AmbientValue = Convert.ChangeType (value, type);
} catch {
AmbientValue = null;
}
}
public object Value {
get { return AmbientValue; }
}
public override bool Equals (object obj)
{
if (!(obj is AmbientValueAttribute))
return false;
if (obj == this)
return true;
return ((AmbientValueAttribute) obj).Value == AmbientValue;
}
public override int GetHashCode()
{
return AmbientValue.GetHashCode ();
}
}
}

View File

@@ -0,0 +1,128 @@
//
// System.ComponentModel.ArrayConverter
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
namespace System.ComponentModel
{
public class ArrayConverter : CollectionConverter
{
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value,
Type destinationType)
{
if (destinationType == null)
throw new ArgumentNullException ("destinationType");
if (destinationType == typeof (string) && (value is Array))
return value.GetType ().Name + " Array";
return base.ConvertTo (context, culture, value, destinationType);
}
public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
object value, Attribute[] attributes)
{
if (value == null)
throw new NullReferenceException ();
PropertyDescriptorCollection col = new PropertyDescriptorCollection (null);
if (value is Array) {
Array array = (Array)value;
for (int i = 0; i < array.Length; i ++) {
col.Add (new ArrayPropertyDescriptor (i, array.GetType()));
}
}
return col;
}
public override bool GetPropertiesSupported (ITypeDescriptorContext context)
{
return true;
}
internal class ArrayPropertyDescriptor : PropertyDescriptor
{
int index;
Type array_type;
public ArrayPropertyDescriptor (int index, Type array_type)
: base (String.Format ("[{0}]", index), null)
{
this.index = index;
this.array_type = array_type;
}
public override Type ComponentType {
get { return array_type; }
}
public override Type PropertyType {
get { return array_type.GetElementType(); }
}
public override bool IsReadOnly {
get { return false; }
}
public override object GetValue (object component)
{
if (component == null)
return null;
return ((Array)component).GetValue (index);
}
public override void SetValue (object component, object value)
{
if (component == null)
return;
((Array)component).SetValue (value, index);
}
public override void ResetValue (object component)
{
}
public override bool CanResetValue (object component)
{
return false;
}
public override bool ShouldSerializeValue (object component)
{
return false;
}
}
}
}

View File

@@ -0,0 +1,67 @@
//
// System.Web.Services.Protocols.AsyncCompletedEventArgs.cs
//
// Author:
// Lluis Sanchez (lluis@novell.com)
//
// Copyright (C) Novell, Inc., 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel
{
public class AsyncCompletedEventArgs : EventArgs
{
Exception _error;
bool _cancelled;
object _userState;
public AsyncCompletedEventArgs (Exception error, bool cancelled, object userState)
{
_error = error;
_cancelled = cancelled;
_userState = userState;
}
protected void RaiseExceptionIfNecessary()
{
if (_error != null)
throw new System.Reflection.TargetInvocationException (_error);
else if (_cancelled)
throw new InvalidOperationException ("The operation was cancelled");
}
public bool Cancelled {
get { return _cancelled; }
}
public Exception Error {
get { return _error; }
}
public object UserState {
get { return _userState; }
}
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Web.Services.Protocols.AsyncCompletedEventHandler.cs
//
// Author:
// Lluis Sanchez (lluis@novell.com)
//
// Copyright (C) Novell, Inc., 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel
{
public delegate void AsyncCompletedEventHandler (
object sender,
AsyncCompletedEventArgs e
);
}

View File

@@ -0,0 +1,97 @@
//
// AsyncOperation.cs
//
// Authors:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading;
namespace System.ComponentModel
{
public sealed class AsyncOperation
{
internal AsyncOperation (SynchronizationContext ctx,
object state)
{
this.ctx = ctx;
this.state = state;
ctx.OperationStarted ();
}
~AsyncOperation ()
{
if (!done && ctx != null)
ctx.OperationCompleted ();
}
SynchronizationContext ctx;
object state;
bool done;
public SynchronizationContext SynchronizationContext {
get { return ctx; }
}
public object UserSuppliedState {
get { return state; }
}
public void OperationCompleted ()
{
if (done)
throw new InvalidOperationException ("This task is already completed. Multiple call to OperationCompleted is not allowed.");
ctx.OperationCompleted ();
done = true;
}
public void Post (SendOrPostCallback d, object arg)
{
if (d == null)
throw new ArgumentNullException ("d");
if (done)
throw new InvalidOperationException ("This task is already completed. Multiple call to Post is not allowed.");
ctx.Post (d, arg);
}
public void PostOperationCompleted (
SendOrPostCallback d, object arg)
{
if (d == null)
throw new ArgumentNullException ("d");
if (done)
throw new InvalidOperationException ("This task is already completed. Multiple call to PostOperationCompleted is not allowed.");
Post (d, arg);
OperationCompleted ();
}
}
}

View File

@@ -0,0 +1,59 @@
//
// AsyncOperationManager.cs
//
// Authors:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Security.Permissions;
using System.Threading;
namespace System.ComponentModel
{
public static class AsyncOperationManager
{
static AsyncOperationManager ()
{
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static SynchronizationContext SynchronizationContext {
get {
if (SynchronizationContext.Current == null)
SynchronizationContext.SetSynchronizationContext (new SynchronizationContext ());
return SynchronizationContext.Current;
}
[SecurityPermission (SecurityAction.LinkDemand)]
set { SynchronizationContext.SetSynchronizationContext (value); }
}
public static AsyncOperation CreateOperation (object userSuppliedState)
{
return new AsyncOperation (
SynchronizationContext, userSuppliedState);
}
}
}

View File

@@ -0,0 +1,211 @@
//
// System.ComponentModel.AttributeCollection.cs
//
// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc. (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
namespace System.ComponentModel
{
[ComVisible (true)]
public class AttributeCollection : ICollection
{
private ArrayList attrList = new ArrayList ();
public static readonly AttributeCollection Empty = new AttributeCollection ((ArrayList)null);
internal AttributeCollection (ArrayList attributes)
{
if (attributes != null)
attrList = attributes;
}
public AttributeCollection (params Attribute[] attributes)
{
if (attributes != null)
for (int i = 0; i < attributes.Length; i++)
attrList.Add (attributes[i]);
}
#if NET_4_0
protected AttributeCollection ()
{
}
#endif
public static AttributeCollection FromExisting (AttributeCollection existing, params Attribute [] newAttributes)
{
if (existing == null)
throw new ArgumentNullException ("existing");
AttributeCollection ret = new AttributeCollection ();
ret.attrList.AddRange (existing.attrList);
if (newAttributes != null)
ret.attrList.AddRange (newAttributes);
return ret;
}
public bool Contains (Attribute attr)
{
Attribute at = this [attr.GetType ()];
if (at != null)
return attr.Equals (at);
else
return false;
}
public bool Contains (Attribute [] attributes)
{
if (attributes == null)
return true;
foreach (Attribute attr in attributes)
if (!Contains (attr))
return false;
return true;
}
public void CopyTo (Array array, int index)
{
attrList.CopyTo (array, index);
}
IEnumerator IEnumerable.GetEnumerator () {
return GetEnumerator ();
}
public IEnumerator GetEnumerator ()
{
return attrList.GetEnumerator ();
}
public bool Matches (Attribute attr)
{
foreach (Attribute a in attrList)
if (a.Match (attr))
return true;
return false;
}
public bool Matches (Attribute [] attributes)
{
foreach (Attribute a in attributes)
if (!(Matches (a)))
return false;
return true;
}
protected Attribute GetDefaultAttribute (Type attributeType)
{
Attribute attr = null;
BindingFlags bf = BindingFlags.Public | BindingFlags.Static;
FieldInfo def = attributeType.GetField ("Default", bf);
if (def == null) {
ConstructorInfo constructorInfo = attributeType.GetConstructor (Type.EmptyTypes);
if (constructorInfo != null)
attr = constructorInfo.Invoke (null) as Attribute;
if (attr != null && !attr.IsDefaultAttribute ())
attr = null;
} else {
attr = (Attribute) def.GetValue (null);
}
return attr;
}
bool ICollection.IsSynchronized {
get {
return attrList.IsSynchronized;
}
}
object ICollection.SyncRoot {
get {
return attrList.SyncRoot;
}
}
int ICollection.Count {
get {
return Count;
}
}
public int Count {
get {
return attrList != null ? attrList.Count : 0;
}
}
public virtual Attribute this[Type type] {
get {
Attribute attr = null;
if (attrList != null) {
foreach (Attribute a in attrList) {
if (type.IsAssignableFrom (a.GetType ())) {
attr = a;
break;
}
}
}
if (attr == null)
attr = GetDefaultAttribute (type);
return attr;
}
}
public virtual Attribute this[int index] {
get {
return (Attribute) attrList [index];
}
}
#if NET_4_0
Attribute [] attributes_arr;
// MSDN doesn't mention it, but this property is returning the same instance always.
protected virtual Attribute [] Attributes {
get {
if (attrList == null || attrList.Count == 0)
return null;
if (attributes_arr == null)
attributes_arr = (Attribute[]) attrList.ToArray (typeof (Attribute));
return attributes_arr;
}
}
#endif
}
}

View File

@@ -0,0 +1,58 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
namespace System.ComponentModel
{
[AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class AttributeProviderAttribute : Attribute
{
string type_name;
string property_name;
public AttributeProviderAttribute (Type type)
{
type_name = type.AssemblyQualifiedName;
}
public AttributeProviderAttribute (string typeName, string propertyName)
{
type_name = typeName;
property_name = propertyName;
}
public AttributeProviderAttribute (string typeName)
{
type_name = typeName;
}
public string PropertyName {
get { return property_name; }
}
public string TypeName {
get { return type_name; }
}
}
}

View File

@@ -0,0 +1,188 @@
//
// BackgroundWorker.cs
//
// Authors:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Generic;
using System.Threading;
namespace System.ComponentModel
{
#if !NET_2_1
[DefaultEvent ("DoWork")]
public class BackgroundWorker : Component
#else
public class BackgroundWorker
#endif
{
public BackgroundWorker ()
{
}
AsyncOperation async;
bool cancel_pending, report_progress = false, support_cancel = false, complete = false;
public event DoWorkEventHandler DoWork;
public event ProgressChangedEventHandler ProgressChanged;
public event RunWorkerCompletedEventHandler RunWorkerCompleted;
#if !NET_2_1
[Browsable (false)]
#endif
public bool CancellationPending {
get { return cancel_pending; }
}
#if !NET_2_1
[Browsable (false)]
#endif
public bool IsBusy {
get { return async != null; }
}
[DefaultValue (false)]
public bool WorkerReportsProgress {
get { return report_progress; }
set { report_progress = value; }
}
[DefaultValue (false)]
public bool WorkerSupportsCancellation {
get { return support_cancel; }
set { support_cancel = value; }
}
public void CancelAsync ()
{
if (!support_cancel)
throw new InvalidOperationException ("This background worker does not support cancellation.");
if (!IsBusy)
return;
cancel_pending = true;
}
public void ReportProgress (int percentProgress)
{
ReportProgress (percentProgress, null);
}
public void ReportProgress (int percentProgress, object userState)
{
if (!WorkerReportsProgress)
throw new InvalidOperationException ("This background worker does not report progress.");
if (complete)
throw new InvalidOperationException ("The background worker has ended.");
ProgressChangedEventArgs pcea = new ProgressChangedEventArgs (percentProgress, userState);
if (async == null) {
// we can report progress before a call to RunWorkerAsync - but we do it sync
OnProgressChanged (pcea);
} else {
async.Post (delegate (object o) {
ProgressChangedEventArgs e = o as ProgressChangedEventArgs;
OnProgressChanged (e);
}, pcea);
}
}
public void RunWorkerAsync ()
{
RunWorkerAsync (null);
}
delegate void ProcessWorkerEventHandler (object argument, AsyncOperation async, SendOrPostCallback callback);
void ProcessWorker (object argument, AsyncOperation async, SendOrPostCallback callback)
{
// do worker
Exception error = null;
DoWorkEventArgs e = new DoWorkEventArgs (argument);
try {
OnDoWork (e);
} catch (Exception ex) {
error = ex;
e.Cancel = false;
}
callback (new object [] {
new RunWorkerCompletedEventArgs (
e.Result, error, e.Cancel),
async});
}
void CompleteWorker (object state)
{
object [] args = (object []) state;
RunWorkerCompletedEventArgs e =
args [0] as RunWorkerCompletedEventArgs;
AsyncOperation async = args [1] as AsyncOperation;
SendOrPostCallback callback = delegate (object darg) {
this.async = null;
complete = true;
OnRunWorkerCompleted (darg as RunWorkerCompletedEventArgs);
};
async.PostOperationCompleted (callback, e);
cancel_pending = false;
}
public void RunWorkerAsync (object argument)
{
if (IsBusy)
throw new InvalidOperationException ("The background worker is busy.");
async = AsyncOperationManager.CreateOperation (this);
complete = false;
ProcessWorkerEventHandler handler =
new ProcessWorkerEventHandler (ProcessWorker);
handler.BeginInvoke (argument, async, CompleteWorker, null, null);
}
protected virtual void OnDoWork (DoWorkEventArgs e)
{
if (DoWork != null)
DoWork (this, e);
}
protected virtual void OnProgressChanged (ProgressChangedEventArgs e)
{
if (ProgressChanged != null)
ProgressChanged (this, e);
}
protected virtual void OnRunWorkerCompleted (RunWorkerCompletedEventArgs e)
{
if (RunWorkerCompleted != null)
RunWorkerCompleted (this, e);
}
}
}

View File

@@ -0,0 +1,120 @@
//
// System.ComponentModel.BaseNumberConverter.cs
//
// Authors:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002/2003 Ximian, Inc (http://www.ximian.com)
// (C) 2003 Andreas Nahr
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Globalization;
namespace System.ComponentModel
{
public abstract class BaseNumberConverter : TypeConverter
{
internal Type InnerType;
protected BaseNumberConverter()
{
}
internal abstract bool SupportHex {
get;
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof (string) || base.CanConvertFrom (context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type t)
{
return t.IsPrimitive || base.CanConvertTo (context, t);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (culture == null)
culture = CultureInfo.CurrentCulture;
string text = value as string;
if (text != null) {
try {
if (SupportHex) {
if (text.Length >= 1 && text[0] == '#') {
return ConvertFromString (text.Substring (1), 16);
}
if (text.StartsWith ("0x") || text.StartsWith ("0X")) {
return ConvertFromString (text, 16);
}
}
NumberFormatInfo numberFormatInfo = (NumberFormatInfo) culture.GetFormat(typeof(NumberFormatInfo));
return ConvertFromString (text, numberFormatInfo);
} catch (Exception e) {
// LAMESPEC MS wraps the actual exception in an Exception
throw new Exception (value.ToString() + " is not a valid "
+ "value for " + InnerType.Name + ".", e);
}
}
return base.ConvertFrom (context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture,
object value, Type destinationType)
{
if (value == null)
throw new ArgumentNullException ("value");
if (culture == null)
culture = CultureInfo.CurrentCulture;
if (destinationType == typeof (string) && value is IConvertible)
return ((IConvertible) value).ToType (destinationType, culture);
if (destinationType.IsPrimitive)
return Convert.ChangeType (value, destinationType, culture);
return base.ConvertTo (context, culture, value, destinationType);
}
internal abstract string ConvertToString (object value, NumberFormatInfo format);
internal abstract object ConvertFromString (string value, NumberFormatInfo format);
internal virtual object ConvertFromString (string value, int fromBase)
{
if (SupportHex) {
throw new NotImplementedException ();
} else {
throw new InvalidOperationException ();
}
}
}
}

View File

@@ -0,0 +1,118 @@
//
// System.ComponentModel.BindableAttribute.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// Copyright (C) Tim Coleman, 2002
// (C) 2003 Andreas Nahr
//
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel {
[AttributeUsage (AttributeTargets.All)]
public sealed class BindableAttribute : Attribute {
#region Fields
//BindableSupport flags;
private bool bindable;
private BindingDirection direction = BindingDirection.OneWay;
#endregion // Fields
public static readonly BindableAttribute No = new BindableAttribute (BindableSupport.No);
public static readonly BindableAttribute Yes = new BindableAttribute (BindableSupport.Yes);
public static readonly BindableAttribute Default = new BindableAttribute (BindableSupport.Default);
#region Constructors
public BindableAttribute (BindableSupport flags)
{
//this.flags = flags;
if (flags == BindableSupport.No)
this.bindable = false;
if (flags == BindableSupport.Yes || flags == BindableSupport.Default)
this.bindable = true;
}
public BindableAttribute (bool bindable)
{
this.bindable = bindable;
}
public BindableAttribute (bool bindable, BindingDirection direction)
{
this.bindable = bindable;
this.direction = direction;
}
public BindableAttribute (BindableSupport flags, BindingDirection direction): this (flags)
{
this.direction = direction;
}
public BindingDirection Direction {
get { return direction; }
}
#endregion // Constructors
#region Properties
public bool Bindable {
get { return bindable; }
}
#endregion // Properties
#region Methods
public override bool Equals (object obj)
{
if (!(obj is BindableAttribute))
return false;
if (obj == this)
return true;
return ((BindableAttribute) obj).Bindable == bindable;
}
public override int GetHashCode ()
{
return bindable.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
return bindable == BindableAttribute.Default.Bindable;
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,38 @@
//
// System.ComponentModel.BindableSupport.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel
{
public enum BindableSupport {
No,
Yes,
Default
}
}

View File

@@ -0,0 +1,38 @@
//
// System.ComponentModel.BindingDirection.cs
//
// Author:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel
{
public enum BindingDirection {
OneWay,
TwoWay
}
}

View File

@@ -0,0 +1,386 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2007 Novell, Inc.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
namespace System.ComponentModel {
[SerializableAttribute]
public class BindingList<T> : Collection<T>,
IBindingList, IList, ICollection,
IEnumerable, ICancelAddNew, IRaiseItemChangedEvents
{
bool allow_edit = true;
bool allow_remove = true;
bool allow_new;
bool allow_new_set;
bool raise_list_changed_events = true;
bool type_has_default_ctor;
bool type_raises_item_changed_events;
bool add_pending;
int pending_add_index;
void CheckType ()
{
ConstructorInfo ci = typeof (T).GetConstructor (Type.EmptyTypes);
type_has_default_ctor = (ci != null);
type_raises_item_changed_events = typeof (INotifyPropertyChanged).IsAssignableFrom (typeof (T));
}
public BindingList (IList<T> list) : base(list)
{
CheckType ();
}
public BindingList () : base ()
{
CheckType ();
}
public bool AllowEdit {
get { return allow_edit; }
set {
if (allow_edit != value) {
allow_edit = value;
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.Reset, -1 /* XXX */));
}
}
}
public bool AllowNew {
get {
/* if the user explicitly it, return that value */
if (allow_new_set)
return allow_new;
/* if the list type has a default constructor we allow new */
if (type_has_default_ctor)
return true;
/* if the user adds a delegate, we return true even if
the type doesn't have a default ctor */
if (AddingNew != null)
return true;
return false;
}
set {
// this funky check (using AllowNew
// instead of allow_new allows us to
// keep the logic for the 3 cases in
// one place (the getter) instead of
// spreading them around the file (in
// the ctor, in the AddingNew add
// handler, etc.
if (AllowNew != value) {
allow_new_set = true;
allow_new = value;
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.Reset, -1 /* XXX */));
}
}
}
public bool AllowRemove {
get { return allow_remove; }
set {
if (allow_remove != value) {
allow_remove = value;
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.Reset, -1 /* XXX */));
}
}
}
protected virtual bool IsSortedCore {
get { return false; }
}
public bool RaiseListChangedEvents {
get { return raise_list_changed_events; }
set { raise_list_changed_events = value; }
}
protected virtual ListSortDirection SortDirectionCore {
get { return ListSortDirection.Ascending; }
}
protected virtual PropertyDescriptor SortPropertyCore {
get { return null; }
}
protected virtual bool SupportsChangeNotificationCore {
get { return true; }
}
protected virtual bool SupportsSearchingCore {
get { return false; }
}
protected virtual bool SupportsSortingCore {
get { return false; }
}
public event AddingNewEventHandler AddingNew;
public event ListChangedEventHandler ListChanged;
public T AddNew ()
{
return (T)AddNewCore ();
}
protected virtual object AddNewCore ()
{
if (!AllowNew)
throw new InvalidOperationException ();
AddingNewEventArgs args = new AddingNewEventArgs ();
OnAddingNew (args);
T new_obj = (T)args.NewObject;
if (new_obj == null) {
if (!type_has_default_ctor)
throw new InvalidOperationException ();
new_obj = (T)Activator.CreateInstance (typeof (T));
}
Add (new_obj);
pending_add_index = IndexOf (new_obj);
add_pending = true;
return new_obj;
}
protected virtual void ApplySortCore (PropertyDescriptor prop, ListSortDirection direction)
{
throw new NotSupportedException ();
}
public virtual void CancelNew (int itemIndex)
{
if (!add_pending)
return;
if (itemIndex != pending_add_index)
return;
add_pending = false;
base.RemoveItem (itemIndex);
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemDeleted, itemIndex));
}
protected override void ClearItems ()
{
EndNew (pending_add_index);
if (type_raises_item_changed_events) {
foreach ( T item in base.Items ) {
(item as INotifyPropertyChanged).PropertyChanged -= Item_PropertyChanged;
}
}
base.ClearItems ();
OnListChanged (new ListChangedEventArgs (ListChangedType.Reset, -1));
}
public virtual void EndNew (int itemIndex)
{
if (!add_pending)
return;
if (itemIndex != pending_add_index)
return;
add_pending = false;
}
protected virtual int FindCore (PropertyDescriptor prop, object key)
{
throw new NotSupportedException ();
}
protected override void InsertItem (int index, T item)
{
EndNew (pending_add_index);
base.InsertItem (index, item);
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemAdded, index));
if (item != null && type_raises_item_changed_events)
(item as INotifyPropertyChanged).PropertyChanged += Item_PropertyChanged;
}
void Item_PropertyChanged (object item, PropertyChangedEventArgs args)
{
var property_info = item.GetType ().GetProperty (args.PropertyName);
if (property_info != null) {
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemChanged, base.IndexOf ((T) item),
new ReflectionPropertyDescriptor (property_info)) );
} else {
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemChanged, base.IndexOf ((T) item)) );
}
}
protected virtual void OnAddingNew (AddingNewEventArgs e)
{
if (AddingNew != null)
AddingNew (this, e);
}
protected virtual void OnListChanged (ListChangedEventArgs e)
{
if (ListChanged != null)
ListChanged (this, e);
}
protected override void RemoveItem (int index)
{
if (!AllowRemove)
throw new NotSupportedException ();
EndNew (pending_add_index);
if (type_raises_item_changed_events) {
(base[index] as INotifyPropertyChanged).PropertyChanged -= Item_PropertyChanged;
}
base.RemoveItem (index);
if (raise_list_changed_events)
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemDeleted, index));
}
protected virtual void RemoveSortCore ()
{
throw new NotSupportedException ();
}
public void ResetBindings ()
{
OnListChanged (new ListChangedEventArgs (ListChangedType.Reset, -1));
}
public void ResetItem (int position)
{
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemChanged, position));
}
protected override void SetItem (int index, T item)
{
if (type_raises_item_changed_events) {
(base[index] as INotifyPropertyChanged).PropertyChanged -= Item_PropertyChanged;
(item as INotifyPropertyChanged).PropertyChanged += Item_PropertyChanged;
}
base.SetItem (index, item);
OnListChanged (new ListChangedEventArgs (ListChangedType.ItemChanged, index));
}
void IBindingList.AddIndex (PropertyDescriptor index)
{
/* no implementation by default */
}
object IBindingList.AddNew ()
{
return AddNew ();
}
void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction)
{
ApplySortCore (property, direction);
}
int IBindingList.Find (PropertyDescriptor property, object key)
{
return FindCore (property, key);
}
void IBindingList.RemoveIndex (PropertyDescriptor property)
{
/* no implementation by default */
}
void IBindingList.RemoveSort ()
{
RemoveSortCore ();
}
bool IBindingList.IsSorted {
get { return IsSortedCore; }
}
ListSortDirection IBindingList.SortDirection {
get { return SortDirectionCore; }
}
PropertyDescriptor IBindingList.SortProperty {
get { return SortPropertyCore; }
}
bool IBindingList.AllowEdit {
get { return AllowEdit; }
}
bool IBindingList.AllowNew {
get { return AllowNew; }
}
bool IBindingList.AllowRemove {
get { return AllowRemove; }
}
bool IBindingList.SupportsChangeNotification {
get { return SupportsChangeNotificationCore; }
}
bool IBindingList.SupportsSearching {
get { return SupportsSearchingCore; }
}
bool IBindingList.SupportsSorting {
get { return SupportsSortingCore; }
}
bool IRaiseItemChangedEvents.RaisesItemChangedEvents {
get { return type_raises_item_changed_events; }
}
}
}

View File

@@ -0,0 +1,75 @@
//
// System.ComponentModel.BooleanConverter
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
namespace System.ComponentModel
{
public class BooleanConverter : TypeConverter
{
public BooleanConverter()
{
}
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof (string))
return true;
return base.CanConvertFrom (context, sourceType);
}
public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value is string)
return bool.Parse ((string) value);
else
return base.ConvertFrom (context, culture, value);
}
public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
{
return new StandardValuesCollection (new bool[2] {true, false} );
}
public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
{
return true;
}
}
}

View File

@@ -0,0 +1,74 @@
//
// System.ComponentModel.BrowsableAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
// (C) 2003 Andreas Nahr
//
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.ComponentModel {
[AttributeUsage (AttributeTargets.All)]
public sealed class BrowsableAttribute : Attribute
{
private bool browsable;
public static readonly BrowsableAttribute Default = new BrowsableAttribute (true);
public static readonly BrowsableAttribute No = new BrowsableAttribute (false);
public static readonly BrowsableAttribute Yes = new BrowsableAttribute (true);
public BrowsableAttribute (bool browsable)
{
this.browsable = browsable;
}
public bool Browsable {
get { return browsable; }
}
public override bool Equals (object obj)
{
if (!(obj is BrowsableAttribute))
return false;
if (obj == this)
return true;
return ((BrowsableAttribute) obj).Browsable == browsable;
}
public override int GetHashCode ()
{
return browsable.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
return browsable == BrowsableAttribute.Default.Browsable;
}
}
}

View File

@@ -0,0 +1,62 @@
//
// System.ComponentModel.ByteConverter
//
// Authors:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Andreas Nahr
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
namespace System.ComponentModel
{
public class ByteConverter : BaseNumberConverter
{
public ByteConverter()
{
InnerType = typeof (Byte);
}
internal override bool SupportHex {
get { return true; }
}
internal override string ConvertToString (object value, NumberFormatInfo format)
{
return ((byte) value).ToString ("G", format);
}
internal override object ConvertFromString (string value, NumberFormatInfo format)
{
return byte.Parse (value, NumberStyles.Integer, format);
}
internal override object ConvertFromString (string value, int fromBase)
{
return Convert.ToByte (value, fromBase);
}
}
}

View File

@@ -0,0 +1,59 @@
//------------------------------------------------------------------------------
//
// System.ComponentModel.CancelEventArgs.
//
// Author: Asier Llano Palacios, asierllano@infonegocio.com
//
//------------------------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.ComponentModel {
public class CancelEventArgs : EventArgs
{
private bool cancel;
public CancelEventArgs() {
cancel = false;
}
public CancelEventArgs( bool cancel )
{
this.cancel = cancel;
}
public bool Cancel {
get {
return cancel;
}
set {
cancel = value;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More