From e19d5f19587c32c08dc2e8b675c21041bac353d0 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Fri, 19 Feb 2016 15:04:09 +1100 Subject: [PATCH 01/11] Add partial contracts to DagaGridView, DataGridViewRowCollection, DataGridViewRow --- .../System.Windows.Forms.BaseCollection.cs | 75 ++ .../System.Windows.Forms.BindingContext.cs | 70 ++ ...System.Windows.Forms.BindingsCollection.cs | 25 + .../System.Windows.Forms.Control.cs | 29 +- ...Windows.Forms.ControlBindingsCollection.cs | 26 + .../System.Windows.Forms.DataGridView.cs | 56 ++ .../System.Windows.Forms.DataGridViewBand.cs | 42 ++ .../System.Windows.Forms.DataGridViewCell.cs | 43 ++ ...indows.Forms.DataGridViewCellCollection.cs | 114 +++ ...System.Windows.Forms.DataGridViewColumn.cs | 43 ++ ...dows.Forms.DataGridViewColumnCollection.cs | 24 + ...ystem.Windows.Forms.DataGridViewElement.cs | 29 + ...Windows.Forms.DataGridViewElementStates.cs | 31 + .../System.Windows.Forms.DataGridViewRow.cs | 48 ++ ...Windows.Forms.DataGridViewRowCollection.cs | 669 ++++++++++++++++++ ...System.Windows.Forms.IBindableComponent.cs | 24 + .../System.Windows.Forms10.csproj | 7 +- 17 files changed, 1342 insertions(+), 13 deletions(-) create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BaseCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingContext.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingsCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ControlBindingsCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridView.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewBand.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCell.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElementStates.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRow.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.IBindableComponent.cs diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BaseCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BaseCollection.cs new file mode 100644 index 00000000..eb32403d --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BaseCollection.cs @@ -0,0 +1,75 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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; +using System.ComponentModel; +using System.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class BaseCollection : MarshalByRefObject, ICollection, IEnumerable + { + public void CopyTo(Array ar, int index) + { + + } + + public IEnumerator GetEnumerator() + { + return default(IEnumerator); + } + + public virtual int Count + { + get + { + return default(int); + } + } + + public bool IsReadOnly + { + get + { + return default(bool); + } + } + + public bool IsSynchronized + { + get + { + return default(bool); + } + } + + protected virtual ArrayList List + { + get + { + return default(ArrayList); + } + } + + public object SyncRoot + { + get + { + return default(object); + } + } + } + + +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingContext.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingContext.cs new file mode 100644 index 00000000..353abebb --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingContext.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace System.Windows.Forms +{ + public class BindingContext : ICollection, IEnumerable + { + public BindingContext() + { + + } + + public bool Contains(object dataSource) + { + return default(bool); + } + + public bool Contains(object dataSource, string dataMember) + { + return default(bool); + } + + protected internal void Remove(object dataSource) + { + + } + + protected virtual void RemoveCore(object dataSource) + { + + } + + void ICollection.CopyTo(Array ar, int index) + { + + } + + IEnumerator IEnumerable.GetEnumerator() + { + return default(IEnumerator); + } + + int ICollection.Count + { + get + { + return default(int); + } + } + + bool ICollection.IsSynchronized + { + get + { + return default(bool); + } + } + + object ICollection.SyncRoot + { + get + { + return default(object); + } + } + } +} diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingsCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingsCollection.cs new file mode 100644 index 00000000..442f07f6 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.BindingsCollection.cs @@ -0,0 +1,25 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.ComponentModel; + +namespace System.Windows.Forms +{ + public class BindingsCollection : BaseCollection + { + internal BindingsCollection() + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs index febaec6b..dcbe7a07 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs @@ -449,17 +449,24 @@ public Control.ControlCollection Controls //// the mouse pointer is over the control. //[AmbientValue("")] //public virtual Cursor Cursor { get; set; } - //// - //// Summary: - //// Gets the data bindings for the control. - //// - //// Returns: - //// A System.Windows.Forms.ControlBindingsCollection that contains the System.Windows.Forms.Binding - //// objects for the control. - //[ParenthesizePropertyName(true)] - //[RefreshProperties(RefreshProperties.All)] - //[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - //public ControlBindingsCollection DataBindings { get; } + // + // Summary: + // Gets the data bindings for the control. + // + // Returns: + // A System.Windows.Forms.ControlBindingsCollection that contains the System.Windows.Forms.Binding + // objects for the control. + [ParenthesizePropertyName(true)] + [RefreshProperties(RefreshProperties.All)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + public ControlBindingsCollection DataBindings + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ControlBindingsCollection); + } + } //// //// Summary: //// Gets the default background color of the control. diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ControlBindingsCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ControlBindingsCollection.cs new file mode 100644 index 00000000..3b509637 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ControlBindingsCollection.cs @@ -0,0 +1,26 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class ControlBindingsCollection : BindingsCollection + { + public ControlBindingsCollection(IBindableComponent control) + { + + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridView.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridView.cs new file mode 100644 index 00000000..819296cd --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridView.cs @@ -0,0 +1,56 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class DataGridView + { + public DataGridView() + { + + } + + protected virtual DataGridViewColumnCollection CreateColumnsInstance() + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewColumnCollection); + } + + protected virtual DataGridViewRowCollection CreateRowsInstance() + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewRowCollection); + } + + public DataGridViewColumnCollection Columns + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewColumnCollection); + } + } + + public DataGridViewRowCollection Rows + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewRowCollection); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewBand.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewBand.cs new file mode 100644 index 00000000..0a25c50c --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewBand.cs @@ -0,0 +1,42 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class DataGridViewBand : DataGridViewElement, ICloneable, IDisposable + { + internal DataGridViewBand() + { + } + + public virtual object Clone() + { + Contract.Ensures(Contract.Result() != null); + Contract.Ensures(Contract.Result() is DataGridViewBand); + return default(object); + } + + public void Dispose() + { + + } + + protected virtual void Dispose(bool disposing) + { + + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCell.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCell.cs new file mode 100644 index 00000000..4d9a5458 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCell.cs @@ -0,0 +1,43 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public abstract class DataGridViewCell : DataGridViewElement, ICloneable, IDisposable + { + protected DataGridViewCell() + { + + } + + public virtual object Clone() + { + Contract.Ensures(Contract.Result() != null); + Contract.Ensures(Contract.Result() is DataGridViewCell); + return default(object); + } + + public void Dispose() + { + + } + + protected virtual void Dispose(bool disposing) + { + + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs new file mode 100644 index 00000000..d639eef6 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs @@ -0,0 +1,114 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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; +using System.ComponentModel; +using System.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class DataGridViewCellCollection : BaseCollection, IList, ICollection, IEnumerable + { + // Fields + private ArrayList items; + private CollectionChangeEventHandler onCollectionChanged; + private DataGridViewRow owner; + + // Events + public event CollectionChangeEventHandler CollectionChanged; + + public DataGridViewCellCollection(DataGridViewRow dataGridViewRow) + { + Contract.Requires(dataGridViewRow != null); + Contract.Ensures(this.items != null); + Contract.Ensures(this.owner != null); + } + + void ICollection.CopyTo(Array array, int index) + { + + } + + IEnumerator IEnumerable.GetEnumerator() + { + return default(IEnumerator); + } + + int IList.Add(object value) + { + return default(int); + } + + void IList.Clear() + { + + } + + bool IList.Contains(object value) + { + return default(bool); + } + + int IList.IndexOf(object value) + { + return default(int); + } + + void IList.Insert(int index, object value) + { + + } + + void IList.Remove(object value) + { + + } + + void IList.RemoveAt(int index) + { + + } + + public DataGridViewCell this[int index] + { + get + { + return default(DataGridViewCell); + } + set + { + } + } + + object IList.this[int index] + { + get + { + return default(object); + } + set + { + } + } + + + bool IList.IsFixedSize + { + get + { + return default(bool); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs new file mode 100644 index 00000000..d6e641a7 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs @@ -0,0 +1,43 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.ComponentModel; + +namespace System.Windows.Forms +{ + public class DataGridViewColumn : DataGridViewBand, IComponent, IDisposable + { + public DataGridViewColumn() : this(null) + { + } + + public DataGridViewColumn(DataGridViewCell cellTemplate) + { + } + + public ISite Site + { + get + { + return default(ISite); + } + set + { + + } + } + + public event EventHandler Disposed; + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs new file mode 100644 index 00000000..2ae7d4ff --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs @@ -0,0 +1,24 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Windows.Forms +{ + public class DataGridViewColumnCollection + { + public DataGridViewColumnCollection(DataGridView dataGridView) + { + + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs new file mode 100644 index 00000000..5f4282f7 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs @@ -0,0 +1,29 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Windows.Forms +{ + public class DataGridViewElement + { + public DataGridViewElement() + { + + } + + internal DataGridViewElement(DataGridViewElement dgveTemplate) + { + + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElementStates.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElementStates.cs new file mode 100644 index 00000000..9fb0b4b7 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElementStates.cs @@ -0,0 +1,31 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Runtime.InteropServices; + +namespace System.Windows.Forms +{ + [Flags, ComVisible(true)] + public enum DataGridViewElementStates + { + Displayed = 1, + Frozen = 2, + None = 0, + ReadOnly = 4, + Resizable = 8, + ResizableSet = 0x10, + Selected = 0x20, + Visible = 0x40 + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRow.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRow.cs new file mode 100644 index 00000000..329d26cb --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRow.cs @@ -0,0 +1,48 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class DataGridViewRow : DataGridViewBand + { + public DataGridViewRow() + { + + } + + public override object Clone() + { + Contract.Ensures(Contract.Result() != null); + Contract.Ensures(Contract.Result() is DataGridViewRow); + return default(object); + } + + protected virtual DataGridViewCellCollection CreateCellsInstance() + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewCellCollection); + } + + public DataGridViewCellCollection Cells + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewCellCollection); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs new file mode 100644 index 00000000..644e9577 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs @@ -0,0 +1,669 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace System.Windows.Forms +{ + public class DataGridViewRowCollection : ICollection, IEnumerable, IList + { + private class RowArrayList : ArrayList + { + // Fields + private DataGridViewRowCollection owner; + private DataGridViewRowCollection.RowComparer rowComparer; + + // Methods + public RowArrayList(DataGridViewRowCollection owner) + { + Contract.Requires(owner != null); + Contract.Ensures(this.owner != null); + } + + private void CustomQuickSort(int left, int right) + { + + } + + public void CustomSort(DataGridViewRowCollection.RowComparer rowComparer) + { + Contract.Requires(rowComparer != null); + Contract.Ensures(this.rowComparer != null); + } + + private object Pivot(int left, int center, int right) + { + return default(object); + } + } + + private class RowComparer + { + // Fields + private bool ascending; + private IComparer customComparer; + private DataGridView dataGridView; + private DataGridViewRowCollection dataGridViewRows; + private DataGridViewColumn dataGridViewSortedColumn; + private static ComparedObjectMax max = new ComparedObjectMax(); + private int sortedColumnIndex; + + // Methods + public RowComparer(DataGridViewRowCollection dataGridViewRows, IComparer customComparer, bool ascending) + { + Contract.Requires(dataGridViewRows != null); + Contract.Ensures(this.dataGridViewRows != null); + Contract.Ensures(this.dataGridView != null); + } + + internal int CompareObjects(object value1, object value2, int rowIndex1, int rowIndex2) + { + return default(int); + } + + internal object GetComparedObject(int rowIndex) + { + return default(object); + } + + // Nested Types + private class ComparedObjectMax + { + } + } + + private class UnsharingRowEnumerator : IEnumerator + { + // Fields + private int current; + private DataGridViewRowCollection owner; + + // Methods + public UnsharingRowEnumerator(DataGridViewRowCollection owner) + { + Contract.Requires(owner != null); + Contract.Ensures(this.owner != null); + Contract.Ensures(this.current == -1); + } + + bool IEnumerator.MoveNext() + { + return default(bool); + } + + void IEnumerator.Reset() + { + Contract.Ensures(this.current == -1); + this.current = -1; + } + + // Properties + object IEnumerator.Current + { + get + { + return default(object); + } + } + } + + public DataGridViewRowCollection(DataGridView dataGridView) + { + Contract.Requires(dataGridView != null); + Contract.Ensures(this.dataGridView != null); + Contract.Ensures(this.rowStates != null); + Contract.Ensures(this.items != null); + } + + public virtual int Add() + { + return default(int); + } + + public virtual int Add(int count) + { + Contract.Requires(count > 0); + return default(int); + } + public virtual int Add(params object[] values) + { + Contract.Requires(values != null); + return default(int); + } + + public virtual int Add(DataGridViewRow dataGridViewRow) + { + Contract.Requires(dataGridViewRow != null); + return default(int); + } + + public virtual int AddCopies(int indexSource, int count) + { + return default(int); + } + + internal int AddCopiesInternal(int indexSource, int count) + { + return default(int); + } + + internal int AddCopiesInternal(int indexSource, int count, DataGridViewElementStates dgvesAdd, DataGridViewElementStates dgvesRemove) + { + Contract.Requires(indexSource >= 0); + Contract.Requires(count > indexSource); + Contract.Requires(count > 0); + return default(int); + } + + private int AddCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElementStates rowTemplateState, int count) + { + Contract.Requires(rowTemplate != null); + return default(int); + } + + public virtual int AddCopy(int indexSource) + { + return default(int); + } + + internal int AddCopyInternal(int indexSource, DataGridViewElementStates dgvesAdd, DataGridViewElementStates dgvesRemove, bool newRow) + { + return default(int); + } + + private int AddDuplicateRow(DataGridViewRow rowTemplate, bool newRow) + { + Contract.Requires(rowTemplate != null); + return default(int); + } + + internal int AddInternal(DataGridViewRow dataGridViewRow) + { + Contract.Requires(dataGridViewRow != null); + return default(int); + } + + internal int AddInternal(bool newRow, object[] values) + { + return default(int); + } + + public virtual void AddRange(params DataGridViewRow[] dataGridViewRows) + { + Contract.Requires(dataGridViewRows != null); + Contract.Requires(Contract.ForAll(dataGridViewRows, (row) => { return row != null; })); + } + + public virtual void Clear() + { + + } + + internal void ClearInternal(bool recreateNewRow) + { + + } + + public virtual bool Contains(DataGridViewRow dataGridViewRow) + { + return default(bool); + } + + public void CopyTo(DataGridViewRow[] array, int index) + { + Contract.Requires(array != null); + } + + internal int DisplayIndexToRowIndex(int visibleRowIndex) + { + return default(int); + } + + public int GetFirstRow(DataGridViewElementStates includeFilter) + { + return default(int); + } + public int GetFirstRow(DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + return default(int); + } + + + public int GetLastRow(DataGridViewElementStates includeFilter) + { + return default(int); + } + + public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter) + { + return default(int); + } + + internal int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, int skipRows) + { + return default(int); + } + + public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + return default(int); + } + + public int GetPreviousRow(int indexStart, DataGridViewElementStates includeFilter) + { + return default(int); + } + + public int GetPreviousRow(int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + return default(int); + } + + public int GetRowCount(DataGridViewElementStates includeFilter) + { + return default(int); + } + + internal int GetRowCount(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex) + { + return default(int); + } + + public int GetRowsHeight(DataGridViewElementStates includeFilter) + { + return default(int); + } + + internal int GetRowsHeight(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex) + { + return default(int); + } + + private bool GetRowsHeightExceedLimit(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex, int heightLimit) + { + return default(bool); + } + + public virtual DataGridViewElementStates GetRowState(int rowIndex) + { + Contract.Requires(rowIndex >= 0); + Contract.Requires(rowIndex < this.items.Count); + return default(DataGridViewElementStates); + } + + public int IndexOf(DataGridViewRow dataGridViewRow) + { + return default(int); + } + + public virtual void Insert(int rowIndex, int count) + { + Contract.Requires(rowIndex >= 0); + Contract.Requires(this.Count >= rowIndex); + Contract.Requires(count > 0); + } + + public virtual void Insert(int rowIndex, params object[] values) + { + Contract.Requires(values != null); + } + + public virtual void Insert(int rowIndex, DataGridViewRow dataGridViewRow) + { + Contract.Requires(rowIndex >= 0); + Contract.Requires(this.Count >= rowIndex); + Contract.Requires(dataGridViewRow != null); + } + + public virtual void InsertCopies(int indexSource, int indexDestination, int count) + { + Contract.Requires(indexSource >= 0); + Contract.Requires(this.Count > indexSource); + Contract.Requires(indexDestination >= 0); + Contract.Requires(this.Count >= indexDestination); + Contract.Requires(count > 0); + } + + private void InsertCopiesPrivate(int indexSource, int indexDestination, int count) + { + Contract.Requires(indexSource >= 0); + Contract.Requires(this.Count > indexSource); + Contract.Requires(indexDestination >= 0); + Contract.Requires(this.Count >= indexDestination); + Contract.Requires(count > 0); + //goes to InsertCopiesPrivate(row, etc) + } + + private void InsertCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElementStates rowTemplateState, int indexDestination, int count) + { + Contract.Requires(rowTemplate != null); + } + + public virtual void InsertCopy(int indexSource, int indexDestination) + { + //goes to InsertCopies(int, int) + } + + private void InsertDuplicateRow(int indexDestination, DataGridViewRow rowTemplate, bool firstInsertion, ref Point newCurrentCell) + { + Contract.Requires(rowTemplate != null); + } + + internal void InsertInternal(int rowIndex, DataGridViewRow dataGridViewRow) + { + Contract.Requires(rowIndex >= 0); + Contract.Requires(this.Count >= rowIndex); + Contract.Requires(dataGridViewRow != null); + } + + internal void InsertInternal(int rowIndex, DataGridViewRow dataGridViewRow, bool force) + { + Contract.Requires(dataGridViewRow != null); + } + + public virtual void InsertRange(int rowIndex, params DataGridViewRow[] dataGridViewRows) + { + Contract.Requires(dataGridViewRows != null); + Contract.Requires(Contract.ForAll(dataGridViewRows, (row) => { return row != null; })); + Contract.Requires(rowIndex >= 0); + Contract.Requires(this.Count >= rowIndex); + } + + internal void InvalidateCachedRowCount(DataGridViewElementStates includeFilter) + { + + } + + internal void InvalidateCachedRowCounts() + { + + } + + internal void InvalidateCachedRowsHeight(DataGridViewElementStates includeFilter) + { + + } + + internal void InvalidateCachedRowsHeights() + { + + } + + protected virtual void OnCollectionChanged(CollectionChangeEventArgs e) + { + + } + + private void OnCollectionChanged(CollectionChangeEventArgs e, int rowIndex, int rowCount) + { + + } + + private void OnCollectionChanged(CollectionChangeEventArgs e, int rowIndex, int rowCount, bool changeIsDeletion, bool changeIsInsertion, bool recreateNewRow, Point newCurrentCell) + { + + } + + private void OnCollectionChanged_PostNotification(CollectionChangeAction cca, int rowIndex, int rowCount, DataGridViewRow dataGridViewRow, bool changeIsDeletion, bool changeIsInsertion, bool recreateNewRow, Point newCurrentCell) + { + + } + + private void OnCollectionChanged_PreNotification(CollectionChangeAction cca, int rowIndex, int rowCount, ref DataGridViewRow dataGridViewRow, bool changeIsInsertion) + { + + } + + public virtual void Remove(DataGridViewRow dataGridViewRow) + { + Contract.Requires(dataGridViewRow != null); + } + + public virtual void RemoveAt(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + internal void RemoveAtInternal(int index, bool force) + { + + } + + private static bool RowHasValueOrToolTipText(DataGridViewRow dataGridViewRow) + { + return default(bool); + } + + internal bool RowIsSharable(int index) + { + return default(bool); + } + + internal void SetRowState(int rowIndex, DataGridViewElementStates state, bool value) + { + + } + + public DataGridViewRow SharedRow(int rowIndex) + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewRow); + } + + internal DataGridViewElementStates SharedRowState(int rowIndex) + { + return default(DataGridViewElementStates); + } + + internal void Sort(IComparer customComparer, bool ascending) + { + + } + + internal void SwapSortedRows(int rowIndex1, int rowIndex2) + { + + } + + void ICollection.CopyTo(Array array, int index) + { + Contract.Requires(array != null); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return default(IEnumerator); + } + + int IList.Add(object value) + { + Contract.Requires(value != null); + Contract.Requires(value is DataGridViewRow); + return default(int); + } + + void IList.Clear() + { + + } + + bool IList.Contains(object value) + { + return default(bool); + } + + int IList.IndexOf(object value) + { + return default(int); + } + + void IList.Insert(int index, object value) + { + Contract.Requires(index >= 0); + Contract.Requires(this.Count >= index); + Contract.Requires(value != null); + Contract.Requires(value is DataGridViewRow); + } + + void IList.Remove(object value) + { + + } + + void IList.RemoveAt(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + private void UnshareRow(int rowIndex) + { + + } + + private void UpdateRowCaches(int rowIndex, ref DataGridViewRow dataGridViewRow, bool adding) + { + + } + + public int Count + { + get + { + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + } + + protected DataGridView DataGridView + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridView); + } + } + + internal bool IsCollectionChangedListenedTo + { + get + { + return default(bool); + } + } + + public DataGridViewRow this[int index] + { + get + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewRow); + } + } + + protected ArrayList List + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ArrayList); + } + } + + internal ArrayList SharedList + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ArrayList); + } + } + + int ICollection.Count + { + get + { + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + } + + bool ICollection.IsSynchronized + { + get + { + return default(bool); + } + } + + object ICollection.SyncRoot + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(object); + } + } + + bool IList.IsFixedSize + { + get + { + return default(bool); + } + } + + bool IList.IsReadOnly + { + get + { + return default(bool); + } + } + + object IList.this[int index] + { + get + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewRow); + } + set + { + throw new NotSupportedException(); + } + } + + public event CollectionChangeEventHandler CollectionChanged; + + private DataGridView dataGridView; + private RowArrayList items; + private CollectionChangeEventHandler onCollectionChanged; + private int rowCountsVisible; + private int rowCountsVisibleFrozen; + private int rowCountsVisibleSelected; + private int rowsHeightVisible; + private int rowsHeightVisibleFrozen; + private List rowStates; + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.IBindableComponent.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.IBindableComponent.cs new file mode 100644 index 00000000..5aea17b9 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.IBindableComponent.cs @@ -0,0 +1,24 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.ComponentModel; + +namespace System.Windows.Forms +{ + public interface IBindableComponent : IComponent, IDisposable + { + BindingContext BindingContext { get; set; } + ControlBindingsCollection DataBindings { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj index 6885f348..fb9e6a90 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj @@ -1,4 +1,4 @@ - + Debug @@ -197,6 +197,9 @@ + + + @@ -302,4 +305,4 @@ --> - + \ No newline at end of file From 398048319a00b8ab2d9de0f9b7ef36e4c21298f8 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Fri, 19 Feb 2016 16:17:37 +1100 Subject: [PATCH 02/11] Finalize DataGridViewCellCollection contracts --- ...indows.Forms.DataGridViewCellCollection.cs | 144 ++++++- ...dows.Forms.DataGridViewColumnCollection.cs | 376 +++++++++++++++++- 2 files changed, 515 insertions(+), 5 deletions(-) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs index d639eef6..f70ee1f2 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs @@ -20,12 +20,10 @@ namespace System.Windows.Forms { public class DataGridViewCellCollection : BaseCollection, IList, ICollection, IEnumerable { - // Fields private ArrayList items; private CollectionChangeEventHandler onCollectionChanged; private DataGridViewRow owner; - // Events public event CollectionChangeEventHandler CollectionChanged; public DataGridViewCellCollection(DataGridViewRow dataGridViewRow) @@ -35,6 +33,84 @@ public DataGridViewCellCollection(DataGridViewRow dataGridViewRow) Contract.Ensures(this.owner != null); } + public virtual int Add(DataGridViewCell dataGridViewCell) + { + Contract.Requires(dataGridViewCell != null); + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + + internal int AddInternal(DataGridViewCell dataGridViewCell) + { + Contract.Requires(dataGridViewCell != null); + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public virtual void AddRange(params DataGridViewCell[] dataGridViewCells) + { + Contract.Requires(dataGridViewCells != null); + Contract.Requires(Contract.ForAll(dataGridViewCells, (cell) => { return cell != null; })); + } + + public virtual void Clear() + { + + } + + public virtual bool Contains(DataGridViewCell dataGridViewCell) + { + return default(bool); + } + + public void CopyTo(DataGridViewCell[] array, int index) + { + Contract.Requires(array != null); + } + + public int IndexOf(DataGridViewCell dataGridViewCell) + { + Contract.Ensures(Contract.Result() >= -1); + return default(int); + } + + public virtual void Insert(int index, DataGridViewCell dataGridViewCell) + { + Contract.Requires(dataGridViewCell != null); + Contract.Requires(index >= 0); + Contract.Requires(index <= this.Count); + } + + internal void InsertInternal(int index, DataGridViewCell dataGridViewCell) + { + Contract.Requires(dataGridViewCell != null); + Contract.Requires(index >= 0); + Contract.Requires(index <= this.Count); + } + + protected void OnCollectionChanged(CollectionChangeEventArgs e) + { + + } + + public virtual void Remove(DataGridViewCell cell) + { + Contract.Requires(cell != null); + } + + public virtual void RemoveAt(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + internal void RemoveAtInternal(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + void ICollection.CopyTo(Array array, int index) { @@ -84,24 +160,63 @@ public DataGridViewCell this[int index] { get { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + Contract.Ensures(Contract.Result() != null); return default(DataGridViewCell); } set { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); } } - object IList.this[int index] + public DataGridViewCell this[string columnName] { get { - return default(object); + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewCell); } set { + } } + protected override ArrayList List + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ArrayList); + } + } + + int ICollection.Count + { + get + { + return default(int); + } + } + + bool ICollection.IsSynchronized + { + get + { + return default(bool); + } + } + + object ICollection.SyncRoot + { + get + { + return default(ICollection); + } + } bool IList.IsFixedSize { @@ -110,5 +225,26 @@ bool IList.IsFixedSize return default(bool); } } + + bool IList.IsReadOnly + { + get + { + return default(bool); + } + } + + object IList.this[int index] + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(object); + } + set + { + } + } + } } \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs index 2ae7d4ff..eee2b5a9 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs @@ -12,13 +12,387 @@ // // 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; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; + namespace System.Windows.Forms { - public class DataGridViewColumnCollection + public class DataGridViewColumnCollection : BaseCollection, IList, ICollection, IEnumerable { + private class ColumnOrderComparer : IComparer + { + // Methods + public int Compare(object x, object y) + { + return default(int); + } + } + + private int columnCountsVisible; + private int columnCountsVisibleSelected; + private static ColumnOrderComparer columnOrderComparer; + private int columnsWidthVisible; + private int columnsWidthVisibleFrozen; + private DataGridView dataGridView; + private ArrayList items; + private ArrayList itemsSorted; + private int lastAccessedSortedIndex; + private CollectionChangeEventHandler onCollectionChanged; + public DataGridViewColumnCollection(DataGridView dataGridView) { + Contract.Requires(dataGridView != null); + Contract.Ensures(items != null); + Contract.Ensures(this.dataGridView != null); + } + internal int ActualDisplayIndexToColumnIndex(int actualDisplayIndex, DataGridViewElementStates includeFilter) + { + return default(int); + } + + public virtual int Add(DataGridViewColumn dataGridViewColumn) + { + Contract.Requires(dataGridViewColumn != null); + return default(int); + } + + public virtual int Add(string columnName, string headerText) + { + return default(int); + } + + public virtual void AddRange(params DataGridViewColumn[] dataGridViewColumns) + { + Contract.Requires(dataGridViewColumns != null); + Contract.Requires(Contract.ForAll(dataGridViewColumns, (column) => { return column != null; })); + } + + public virtual void Clear() + { + } + + internal int ColumnIndexToActualDisplayIndex(int columnIndex, DataGridViewElementStates includeFilter) + { + return default(int); + } + + public virtual bool Contains(string columnName) + { + Contract.Requires(columnName != null); + return default(bool); + } + + public virtual bool Contains(DataGridViewColumn dataGridViewColumn) + { + return default(bool); + } + + public void CopyTo(DataGridViewColumn[] array, int index) + { + Contract.Requires(array != null); + } + + internal bool DisplayInOrder(int columnIndex1, int columnIndex2) + { + return default(bool); + } + internal DataGridViewColumn GetColumnAtDisplayIndex(int displayIndex) + { + return default(DataGridViewColumn); + } + + public int GetColumnCount(DataGridViewElementStates includeFilter) + { + return default(int); + } + + internal int GetColumnCount(DataGridViewElementStates includeFilter, int fromColumnIndex, int toColumnIndex) + { + return default(int); + } + + internal float GetColumnsFillWeight(DataGridViewElementStates includeFilter) + { + return default(float); + } + + private int GetColumnSortedIndex(DataGridViewColumn dataGridViewColumn) + { + return default(int); + } + + public int GetColumnsWidth(DataGridViewElementStates includeFilter) + { + return default(int); + } + + public DataGridViewColumn GetFirstColumn(DataGridViewElementStates includeFilter) + { + return default(DataGridViewColumn); + } + + public DataGridViewColumn GetFirstColumn(DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + return default(DataGridViewColumn); + } + + public DataGridViewColumn GetLastColumn(DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + return default(DataGridViewColumn); + } + + public DataGridViewColumn GetNextColumn(DataGridViewColumn dataGridViewColumnStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + Contract.Requires(dataGridViewColumnStart != null); + return default(DataGridViewColumn); + } + + + public DataGridViewColumn GetPreviousColumn(DataGridViewColumn dataGridViewColumnStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) + { + Contract.Requires(dataGridViewColumnStart != null); + return default(DataGridViewColumn); + } + + public int IndexOf(DataGridViewColumn dataGridViewColumn) + { + return default(int); + } + + public virtual void Insert(int columnIndex, DataGridViewColumn dataGridViewColumn) + { + Contract.Requires(dataGridViewColumn != null); + } + + internal void InvalidateCachedColumnCount(DataGridViewElementStates includeFilter) + { + + } + + internal void InvalidateCachedColumnCounts() + { + + } + + internal void InvalidateCachedColumnsOrder() + { + + } + + internal void InvalidateCachedColumnsWidth(DataGridViewElementStates includeFilter) + { + + } + + internal void InvalidateCachedColumnsWidths() + { + + } + + protected virtual void OnCollectionChanged(CollectionChangeEventArgs e) + { + } + + private void OnCollectionChanged(CollectionChangeEventArgs ccea, bool changeIsInsertion, Point newCurrentCell) + { + Contract.Requires(ccea != null); + } + + private void OnCollectionChanged_PostNotification(CollectionChangeEventArgs ccea, bool changeIsInsertion, Point newCurrentCell) + { + Contract.Requires(ccea != null); + } + + private void OnCollectionChanged_PreNotification(CollectionChangeEventArgs ccea) + { + + } + + public virtual void Remove(string columnName) + { + Contract.Requires(columnName != null); + } + + public virtual void Remove(DataGridViewColumn dataGridViewColumn) + { + Contract.Requires(dataGridViewColumn != null); + } + + public virtual void RemoveAt(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + internal void RemoveAtInternal(int index, bool force) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + void ICollection.CopyTo(Array array, int index) + { + Contract.Requires(array != null); + } + + IEnumerator IEnumerable.GetEnumerator() + { + Contract.Ensures(Contract.Result() != null); + return default(IEnumerator); + } + + int IList.Add(object value) + { + Contract.Requires(value != null); + Contract.Requires(value is DataGridViewColumn); + return default(int); + } + + void IList.Clear() + { + + } + + bool IList.Contains(object value) + { + return default(bool); + } + + int IList.IndexOf(object value) + { + return default(int); + } + + void IList.Insert(int index, object value) + { + Contract.Requires(value != null); + Contract.Requires(value is DataGridViewColumn); + } + + void IList.Remove(object value) + { + Contract.Requires(value != null); + } + + void IList.RemoveAt(int index) + { + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + + private void UpdateColumnCaches(DataGridViewColumn dataGridViewColumn, bool adding) + { + + } + + private void UpdateColumnOrderCache() + { + Contract.Ensures(this.itemsSorted != null); + } + + internal static IComparer ColumnCollectionOrderComparer + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(IComparer); + } + } + + protected DataGridView DataGridView + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridView); + } + } + + public DataGridViewColumn this[string columnName] + { + get + { + Contract.Requires(columnName != null); + return default(DataGridViewColumn); + } + } + + public DataGridViewColumn this[int index] + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewColumn); + } + } + + protected override ArrayList List + { + get + { + Contract.Ensures(Contract.Result() != null); + return this.items; + } + } + + int ICollection.Count + { + get + { + return default(int); + } + } + + bool ICollection.IsSynchronized + { + get + { + return default(bool); + } + } + + object ICollection.SyncRoot + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ICollection); + } + } + + bool IList.IsFixedSize + { + get + { + return default(bool); + } + } + + bool IList.IsReadOnly + { + get + { + return default(bool); + } + } + + object IList.this[int index] + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(DataGridViewColumn); + } + set + { + throw new NotSupportedException(); + } + } + + public event CollectionChangeEventHandler CollectionChanged; } } \ No newline at end of file From f0d875b09d892cc94810889183c9368220d607a2 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Fri, 19 Feb 2016 16:26:48 +1100 Subject: [PATCH 03/11] Finalize DataGridViewColumnCollection contracts --- ...indows.Forms.DataGridViewCellCollection.cs | 2 +- ...dows.Forms.DataGridViewColumnCollection.cs | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs index f70ee1f2..75d3b8f4 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs @@ -56,7 +56,7 @@ public virtual void AddRange(params DataGridViewCell[] dataGridViewCells) public virtual void Clear() { - + Contract.Ensures(this.Count == 0); } public virtual bool Contains(DataGridViewCell dataGridViewCell) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs index eee2b5a9..59fb0c66 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs @@ -55,11 +55,13 @@ internal int ActualDisplayIndexToColumnIndex(int actualDisplayIndex, DataGridVie public virtual int Add(DataGridViewColumn dataGridViewColumn) { Contract.Requires(dataGridViewColumn != null); + Contract.Ensures(Contract.Result() >= 0); return default(int); } public virtual int Add(string columnName, string headerText) { + Contract.Ensures(Contract.Result() >= 0); return default(int); } @@ -71,6 +73,7 @@ public virtual void AddRange(params DataGridViewColumn[] dataGridViewColumns) public virtual void Clear() { + Contract.Ensures(this.Count == 0); } internal int ColumnIndexToActualDisplayIndex(int columnIndex, DataGridViewElementStates includeFilter) @@ -116,11 +119,13 @@ internal int GetColumnCount(DataGridViewElementStates includeFilter, int fromCol internal float GetColumnsFillWeight(DataGridViewElementStates includeFilter) { + Contract.Ensures(Contract.Result() >= 0.0f); return default(float); } private int GetColumnSortedIndex(DataGridViewColumn dataGridViewColumn) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } @@ -159,11 +164,14 @@ public DataGridViewColumn GetPreviousColumn(DataGridViewColumn dataGridViewColum public int IndexOf(DataGridViewColumn dataGridViewColumn) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } public virtual void Insert(int columnIndex, DataGridViewColumn dataGridViewColumn) { + Contract.Requires(columnIndex >= 0); + Contract.Requires(columnIndex <= this.Count); Contract.Requires(dataGridViewColumn != null); } @@ -241,14 +249,11 @@ void ICollection.CopyTo(Array array, int index) IEnumerator IEnumerable.GetEnumerator() { - Contract.Ensures(Contract.Result() != null); return default(IEnumerator); } int IList.Add(object value) { - Contract.Requires(value != null); - Contract.Requires(value is DataGridViewColumn); return default(int); } @@ -269,19 +274,17 @@ int IList.IndexOf(object value) void IList.Insert(int index, object value) { - Contract.Requires(value != null); - Contract.Requires(value is DataGridViewColumn); + } void IList.Remove(object value) { - Contract.Requires(value != null); + } void IList.RemoveAt(int index) { - Contract.Requires(index >= 0); - Contract.Requires(index < this.Count); + } private void UpdateColumnCaches(DataGridViewColumn dataGridViewColumn, bool adding) @@ -359,7 +362,6 @@ object ICollection.SyncRoot { get { - Contract.Ensures(Contract.Result() != null); return default(ICollection); } } From 43b6cb9aa7deb5a89f18ccc045cd73174b8a86e0 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Fri, 19 Feb 2016 16:36:18 +1100 Subject: [PATCH 04/11] finalize DataGridViewRowCollection contracts --- ...Windows.Forms.DataGridViewRowCollection.cs | 67 +++++++++++-------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs index 644e9577..c415a72d 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs @@ -122,6 +122,18 @@ object IEnumerator.Current } } + private DataGridView dataGridView; + private RowArrayList items; + private CollectionChangeEventHandler onCollectionChanged; + private int rowCountsVisible; + private int rowCountsVisibleFrozen; + private int rowCountsVisibleSelected; + private int rowsHeightVisible; + private int rowsHeightVisibleFrozen; + private List rowStates; + + public event CollectionChangeEventHandler CollectionChanged; + public DataGridViewRowCollection(DataGridView dataGridView) { Contract.Requires(dataGridView != null); @@ -132,6 +144,7 @@ public DataGridViewRowCollection(DataGridView dataGridView) public virtual int Add() { + Contract.Ensures(Contract.Result() >= 0); return default(int); } @@ -143,12 +156,14 @@ public virtual int Add(int count) public virtual int Add(params object[] values) { Contract.Requires(values != null); + Contract.Ensures(Contract.Result() >= 0); return default(int); } public virtual int Add(DataGridViewRow dataGridViewRow) { Contract.Requires(dataGridViewRow != null); + Contract.Ensures(Contract.Result() >= 0); return default(int); } @@ -195,11 +210,13 @@ private int AddDuplicateRow(DataGridViewRow rowTemplate, bool newRow) internal int AddInternal(DataGridViewRow dataGridViewRow) { Contract.Requires(dataGridViewRow != null); + Contract.Ensures(Contract.Result() >= 0); return default(int); } internal int AddInternal(bool newRow, object[] values) { + Contract.Ensures(Contract.Result() >= 0); return default(int); } @@ -236,41 +253,52 @@ internal int DisplayIndexToRowIndex(int visibleRowIndex) public int GetFirstRow(DataGridViewElementStates includeFilter) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } public int GetFirstRow(DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } - - public int GetLastRow(DataGridViewElementStates includeFilter) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter) { + Contract.Requires(indexStart >= -1); + Contract.Ensures(Contract.Result() >= -1); return default(int); } internal int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, int skipRows) { + Contract.Requires(indexStart >= -1); + Contract.Ensures(Contract.Result() >= -1); return default(int); } public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) { + Contract.Requires(indexStart >= -1); + Contract.Ensures(Contract.Result() >= -1); return default(int); } public int GetPreviousRow(int indexStart, DataGridViewElementStates includeFilter) { + Contract.Requires(indexStart <= this.Count); + Contract.Ensures(Contract.Result() >= -1); return default(int); } public int GetPreviousRow(int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) { + Contract.Requires(indexStart <= this.Count); + Contract.Ensures(Contract.Result() >= -1); return default(int); } @@ -281,6 +309,7 @@ public int GetRowCount(DataGridViewElementStates includeFilter) internal int GetRowCount(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex) { + Contract.Ensures(Contract.Result() >= 0); return default(int); } @@ -308,6 +337,7 @@ public virtual DataGridViewElementStates GetRowState(int rowIndex) public int IndexOf(DataGridViewRow dataGridViewRow) { + Contract.Ensures(Contract.Result() >= -1); return default(int); } @@ -346,7 +376,6 @@ private void InsertCopiesPrivate(int indexSource, int indexDestination, int coun Contract.Requires(indexDestination >= 0); Contract.Requires(this.Count >= indexDestination); Contract.Requires(count > 0); - //goes to InsertCopiesPrivate(row, etc) } private void InsertCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElementStates rowTemplateState, int indexDestination, int count) @@ -356,7 +385,10 @@ private void InsertCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElemen public virtual void InsertCopy(int indexSource, int indexDestination) { - //goes to InsertCopies(int, int) + Contract.Requires(indexSource >= 0); + Contract.Requires(this.Count > indexSource); + Contract.Requires(indexDestination >= 0); + Contract.Requires(this.Count >= indexDestination); } private void InsertDuplicateRow(int indexDestination, DataGridViewRow rowTemplate, bool firstInsertion, ref Point newCurrentCell) @@ -483,7 +515,7 @@ internal void SwapSortedRows(int rowIndex1, int rowIndex2) void ICollection.CopyTo(Array array, int index) { - Contract.Requires(array != null); + } IEnumerator IEnumerable.GetEnumerator() @@ -493,8 +525,6 @@ IEnumerator IEnumerable.GetEnumerator() int IList.Add(object value) { - Contract.Requires(value != null); - Contract.Requires(value is DataGridViewRow); return default(int); } @@ -515,10 +545,7 @@ int IList.IndexOf(object value) void IList.Insert(int index, object value) { - Contract.Requires(index >= 0); - Contract.Requires(this.Count >= index); - Contract.Requires(value != null); - Contract.Requires(value is DataGridViewRow); + } void IList.Remove(object value) @@ -528,8 +555,7 @@ void IList.Remove(object value) void IList.RemoveAt(int index) { - Contract.Requires(index >= 0); - Contract.Requires(index < this.Count); + } private void UnshareRow(int rowIndex) @@ -601,7 +627,6 @@ int ICollection.Count { get { - Contract.Ensures(Contract.Result() >= 0); return default(int); } } @@ -643,8 +668,6 @@ object IList.this[int index] { get { - Contract.Requires(index >= 0); - Contract.Requires(index < this.Count); Contract.Ensures(Contract.Result() != null); return default(DataGridViewRow); } @@ -653,17 +676,5 @@ object IList.this[int index] throw new NotSupportedException(); } } - - public event CollectionChangeEventHandler CollectionChanged; - - private DataGridView dataGridView; - private RowArrayList items; - private CollectionChangeEventHandler onCollectionChanged; - private int rowCountsVisible; - private int rowCountsVisibleFrozen; - private int rowCountsVisibleSelected; - private int rowsHeightVisible; - private int rowsHeightVisibleFrozen; - private List rowStates; } } \ No newline at end of file From fed99c6c34f8eff6227f9d3490ddffdf7bf625e0 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Mon, 22 Feb 2016 09:34:12 +1100 Subject: [PATCH 05/11] csproj change my mistake! it didn't save --- .../System.Windows.Forms10.csproj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj index fb9e6a90..272ac361 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj @@ -191,6 +191,11 @@ + + + + + @@ -198,7 +203,13 @@ + + + + + + @@ -207,6 +218,7 @@ + From 54aef15a8a685c4a6a5ccc3bedf421974d3488a5 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Mon, 22 Feb 2016 09:53:20 +1100 Subject: [PATCH 06/11] ButtonBase, FlatButtonAppearance, ImageList --- .../System.Windows.Forms.ButtonBase.cs | 40 +++++++++++++++++++ ...stem.Windows.Forms.FlatButtonAppearance.cs | 28 +++++++++++++ .../System.Windows.Forms.ImageList.cs | 9 ++++- .../System.Windows.Forms10.csproj | 2 + 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs create mode 100644 Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs new file mode 100644 index 00000000..dc666d75 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs @@ -0,0 +1,40 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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; +using System.ComponentModel; +using System.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public abstract class ButtonBase : Control + { + public event EventHandler AutoSizeChanged; + public event EventHandler ImeModeChanged; + + protected ButtonBase() + { + + } + + public FlatButtonAppearance FlatAppearance + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(FlatButtonAppearance); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs new file mode 100644 index 00000000..15c45bf7 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs @@ -0,0 +1,28 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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; +using System.ComponentModel; +using System.Diagnostics.Contracts; + +namespace System.Windows.Forms +{ + public class FlatButtonAppearance + { + internal FlatButtonAppearance(ButtonBase owner) + { + Contract.Requires(owner != null); + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ImageList.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ImageList.cs index aa460c4e..65c9ed1a 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ImageList.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ImageList.cs @@ -118,7 +118,14 @@ public ColorDepth ColorDepth // // Returns: // The collection of images. - //public ImageList.ImageCollection Images { get; } + public ImageList.ImageCollection Images + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(ImageCollection); + } + } // diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj index 272ac361..76d59dc1 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms10.csproj @@ -194,6 +194,7 @@ + @@ -214,6 +215,7 @@ + From 6aa548079c219b968b153bce058ad2332dc52f2b Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Mon, 22 Feb 2016 10:28:14 +1100 Subject: [PATCH 07/11] Contracts: DbParameterCollection, SqlCommand, SqlParameter, SqlParameterCollection, SqlDbType --- ...ystem.Data.Common.DbParameterCollection.cs | 54 +++++++-- .../System.Data.SqlClient.SqlCommand.cs | 9 +- .../System.Data.SqlClient.SqlParameter.cs | 25 +++- ...m.Data.SqlClient.SqlParameterCollection.cs | 110 ++++++++++++++++++ .../System.Data/System.Data.SqlDbType.cs | 51 ++++++++ .../System.Data/System.Data10.csproj | 6 +- .../System.Windows.Forms.ButtonBase.cs | 2 - ...stem.Windows.Forms.FlatButtonAppearance.cs | 2 - 8 files changed, 238 insertions(+), 21 deletions(-) create mode 100644 Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs create mode 100644 Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbParameterCollection.cs b/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbParameterCollection.cs index 92e151cd..0baea736 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbParameterCollection.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.Common.DbParameterCollection.cs @@ -12,17 +12,13 @@ // // 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.ComponentModel; -using System.Data; -using System.Reflection; using System.Diagnostics.Contracts; namespace System.Data.Common { // Summary: // The base class for a collection of parameters relevant to a System.Data.Common.DbCommand. + [ContractClass(typeof(DbParameterCollectionContract))] public abstract class DbParameterCollection //: MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable { // Summary: @@ -37,7 +33,7 @@ public abstract class DbParameterCollection //: MarshalByRefObject, IDataParamet // The number of items in the collection. //rowsable(false)] //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - //public abstract int Count { get; } + public abstract int Count { get; } // // Summary: // Specifies whether the collection is a fixed size. @@ -121,7 +117,17 @@ public DbParameter this[int index] // Exceptions: // System.IndexOutOfRangeException: // The specified index does not exist. - //public DbParameter this[string parameterName] { get; set; } + public DbParameter this[string parameterName] + { + get + { + return default(DbParameter); + } + set + { + + } + } // Summary: // Adds a System.Data.Common.DbParameter item with the specified value to the @@ -134,7 +140,7 @@ public DbParameter this[int index] // // Returns: // The index of the System.Data.Common.DbParameter object in the collection. - //public abstract int Add(object value); + public abstract int Add(object value); // // Summary: // Adds an array of items with the specified values to the System.Data.Common.DbParameterCollection. @@ -142,7 +148,7 @@ public DbParameter this[int index] // Parameters: // values: // An array of values of type System.Data.Common.DbParameter to add to the collection. - //public abstract void AddRange(Array values); + public abstract void AddRange(Array values); // // Summary: // Removes all System.Data.Common.DbParameter values from the System.Data.Common.DbParameterCollection. @@ -305,4 +311,34 @@ public DbParameter this[int index] // The new System.Data.Common.DbParameter value. //protected abstract void SetParameter(string parameterName, DbParameter value); } + + [ContractClassFor(typeof(DbParameterCollection))] + abstract class DbParameterCollectionContract : DbParameterCollection + { + private DbParameterCollectionContract() + { + + } + + public override int Add(object value) + { + Contract.Requires(value != null); + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + + public override void AddRange(Array values) + { + Contract.Requires(values != null); + } + + public override int Count + { + get + { + Contract.Ensures(Contract.Result() >= 0); + return default(int); + } + } + } } diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlCommand.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlCommand.cs index 5954dc58..728bbf39 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlCommand.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlCommand.cs @@ -180,7 +180,14 @@ namespace System.Data.SqlClient //[ResCategory("DataCategory_Data")] //[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] //[ResDescription("DbCommand_Parameters")] - //public SqlParameterCollection Parameters { get; } + public SqlParameterCollection Parameters + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameterCollection); + } + } // // Summary: // Gets or sets the System.Data.SqlClient.SqlTransaction within which the System.Data.SqlClient.SqlCommand diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameter.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameter.cs index 47037b02..e417ad49 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameter.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameter.cs @@ -31,7 +31,10 @@ namespace System.Data.SqlClient { // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class. - //public SqlParameter(); + public SqlParameter() + { + + } // // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class @@ -43,7 +46,10 @@ namespace System.Data.SqlClient // // value: // An System.Object that is the value of the System.Data.SqlClient.SqlParameter. - //public SqlParameter(string parameterName, object value); + public SqlParameter(string parameterName, object value) + { + + } // // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class @@ -59,7 +65,10 @@ namespace System.Data.SqlClient // Exceptions: // System.ArgumentException: // The value supplied in the dbType parameter is an invalid back-end data type. - //public SqlParameter(string parameterName, SqlDbType dbType); + public SqlParameter(string parameterName, SqlDbType dbType) + { + + } // // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class @@ -78,7 +87,10 @@ namespace System.Data.SqlClient // Exceptions: // System.ArgumentException: // The value supplied in the dbType parameter is an invalid back-end data type. - //public SqlParameter(string parameterName, SqlDbType dbType, int size); + public SqlParameter(string parameterName, SqlDbType dbType, int size) + { + + } // // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class @@ -101,7 +113,10 @@ namespace System.Data.SqlClient // Exceptions: // System.ArgumentException: // The value supplied in the dbType parameter is an invalid back-end data type. - //public SqlParameter(string parameterName, SqlDbType dbType, int size, string sourceColumn); + public SqlParameter(string parameterName, SqlDbType dbType, int size, string sourceColumn) + { + + } // // Summary: // Initializes a new instance of the System.Data.SqlClient.SqlParameter class diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs new file mode 100644 index 00000000..df6e7568 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs @@ -0,0 +1,110 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Data.Common; +using System.Diagnostics.Contracts; + +namespace System.Data.SqlClient +{ + public sealed class SqlParameterCollection : DbParameterCollection + { + internal SqlParameterCollection() + { + } + public SqlParameter Add(SqlParameter value) + { + Contract.Ensures(value == null || Contract.Result() != null); + return default(SqlParameter); + } + public override int Add(object value) + { + return default(int); + } + + public SqlParameter Add(string parameterName, SqlDbType sqlDbType) + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + + public SqlParameter Add(string parameterName, object value) + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + + public SqlParameter Add(string parameterName, SqlDbType sqlDbType, int size) + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + + public SqlParameter Add(string parameterName, SqlDbType sqlDbType, int size, string sourceColumn) + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + + public void AddRange(SqlParameter[] values) + { + Contract.Requires(values != null); + } + + public override void AddRange(Array values) + { + } + + public SqlParameter AddWithValue(string parameterName, object value) + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + + public override int Count + { + get + { + return default(int); + } + } + + public new SqlParameter this[int index] + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + set + { + Contract.Requires(value != null); + Contract.Requires(index >= 0); + Contract.Requires(index < this.Count); + } + } + + public new SqlParameter this[string parameterName] + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(SqlParameter); + } + set + { + + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs new file mode 100644 index 00000000..098d04b1 --- /dev/null +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs @@ -0,0 +1,51 @@ +// CodeContracts +// +// Copyright (c) Microsoft Corporation +// +// All rights reserved. +// +// MIT License +// +// 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.Data.SqlClient +{ + public enum SqlDbType + { + BigInt = 0, + Binary = 1, + Bit = 2, + Char = 3, + Date = 0x1f, + DateTime = 4, + DateTime2 = 0x21, + DateTimeOffset = 0x22, + Decimal = 5, + Float = 6, + Image = 7, + Int = 8, + Money = 9, + NChar = 10, + NText = 11, + NVarChar = 12, + Real = 13, + SmallDateTime = 15, + SmallInt = 0x10, + SmallMoney = 0x11, + Structured = 30, + Text = 0x12, + Time = 0x20, + Timestamp = 0x13, + TinyInt = 20, + Udt = 0x1d, + UniqueIdentifier = 14, + VarBinary = 0x15, + VarChar = 0x16, + Variant = 0x17, + Xml = 0x19 + } + diff --git a/Microsoft.Research/Contracts/System.Data/System.Data10.csproj b/Microsoft.Research/Contracts/System.Data/System.Data10.csproj index 30131e2f..6e409937 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data10.csproj +++ b/Microsoft.Research/Contracts/System.Data/System.Data10.csproj @@ -1,4 +1,4 @@ - + Debug @@ -222,6 +222,8 @@ + + @@ -299,4 +301,4 @@ --> - + \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs index dc666d75..5e2a1d63 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs @@ -12,8 +12,6 @@ // // 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; -using System.ComponentModel; using System.Diagnostics.Contracts; namespace System.Windows.Forms diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs index 15c45bf7..772dcd72 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs @@ -12,8 +12,6 @@ // // 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; -using System.ComponentModel; using System.Diagnostics.Contracts; namespace System.Windows.Forms From 93a51958027f7d369a175ef2bc917cf0831167ab Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Mon, 22 Feb 2016 11:34:27 +1100 Subject: [PATCH 08/11] Preparing to make pull request --- .../System.Data/System.Data.SqlDbType.cs | 2 +- .../System.Windows.Forms.ButtonBase.cs | 4 ++-- ...indows.Forms.DataGridViewCellCollection.cs | 4 ++-- ...System.Windows.Forms.DataGridViewColumn.cs | 4 ++-- ...dows.Forms.DataGridViewColumnCollection.cs | 16 +++++++------- ...Windows.Forms.DataGridViewRowCollection.cs | 22 +++++++++---------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs index 098d04b1..f43fbdea 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs @@ -48,4 +48,4 @@ public enum SqlDbType Variant = 0x17, Xml = 0x19 } - +} diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs index 5e2a1d63..05024297 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.ButtonBase.cs @@ -18,8 +18,8 @@ namespace System.Windows.Forms { public abstract class ButtonBase : Control { - public event EventHandler AutoSizeChanged; - public event EventHandler ImeModeChanged; + //public event EventHandler AutoSizeChanged; + //public event EventHandler ImeModeChanged; protected ButtonBase() { diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs index 75d3b8f4..2c014bdf 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs @@ -21,10 +21,10 @@ namespace System.Windows.Forms public class DataGridViewCellCollection : BaseCollection, IList, ICollection, IEnumerable { private ArrayList items; - private CollectionChangeEventHandler onCollectionChanged; + //private CollectionChangeEventHandler onCollectionChanged; private DataGridViewRow owner; - public event CollectionChangeEventHandler CollectionChanged; + //public event CollectionChangeEventHandler CollectionChanged; public DataGridViewCellCollection(DataGridViewRow dataGridViewRow) { diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs index d6e641a7..d1ee39e5 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs @@ -16,7 +16,7 @@ namespace System.Windows.Forms { - public class DataGridViewColumn : DataGridViewBand, IComponent, IDisposable + public class DataGridViewColumn : DataGridViewBand//, IComponent, IDisposable { public DataGridViewColumn() : this(null) { @@ -38,6 +38,6 @@ public ISite Site } } - public event EventHandler Disposed; + //public event EventHandler Disposed; } } \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs index 59fb0c66..b10aabc6 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs @@ -30,16 +30,16 @@ public int Compare(object x, object y) } } - private int columnCountsVisible; - private int columnCountsVisibleSelected; - private static ColumnOrderComparer columnOrderComparer; - private int columnsWidthVisible; - private int columnsWidthVisibleFrozen; + //private int columnCountsVisible; + //private int columnCountsVisibleSelected; + //private static ColumnOrderComparer columnOrderComparer; + //private int columnsWidthVisible; + //private int columnsWidthVisibleFrozen; private DataGridView dataGridView; private ArrayList items; private ArrayList itemsSorted; - private int lastAccessedSortedIndex; - private CollectionChangeEventHandler onCollectionChanged; + //private int lastAccessedSortedIndex; + //private CollectionChangeEventHandler onCollectionChanged; public DataGridViewColumnCollection(DataGridView dataGridView) { @@ -395,6 +395,6 @@ object IList.this[int index] } } - public event CollectionChangeEventHandler CollectionChanged; + //public event CollectionChangeEventHandler CollectionChanged; } } \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs index c415a72d..acf7e0d4 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs @@ -55,13 +55,13 @@ private object Pivot(int left, int center, int right) private class RowComparer { // Fields - private bool ascending; - private IComparer customComparer; + //private bool ascending; + //private IComparer customComparer; private DataGridView dataGridView; private DataGridViewRowCollection dataGridViewRows; - private DataGridViewColumn dataGridViewSortedColumn; + //private DataGridViewColumn dataGridViewSortedColumn; private static ComparedObjectMax max = new ComparedObjectMax(); - private int sortedColumnIndex; + //private int sortedColumnIndex; // Methods public RowComparer(DataGridViewRowCollection dataGridViewRows, IComparer customComparer, bool ascending) @@ -124,15 +124,15 @@ object IEnumerator.Current private DataGridView dataGridView; private RowArrayList items; - private CollectionChangeEventHandler onCollectionChanged; - private int rowCountsVisible; - private int rowCountsVisibleFrozen; - private int rowCountsVisibleSelected; - private int rowsHeightVisible; - private int rowsHeightVisibleFrozen; + //private CollectionChangeEventHandler onCollectionChanged; + //private int rowCountsVisible; + //private int rowCountsVisibleFrozen; + //private int rowCountsVisibleSelected; + //private int rowsHeightVisible; + //private int rowsHeightVisibleFrozen; private List rowStates; - public event CollectionChangeEventHandler CollectionChanged; + //public event CollectionChangeEventHandler CollectionChanged; public DataGridViewRowCollection(DataGridView dataGridView) { From 0cdcb39068310b5a68d62c1d9efbdce3a9a0098a Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Tue, 23 Feb 2016 09:37:18 +1100 Subject: [PATCH 09/11] Remove internal/private methods/classes --- ...m.Data.SqlClient.SqlParameterCollection.cs | 2 + .../System.Data/System.Data.SqlDbType.cs | 2 +- .../System.Windows.Forms.Control.cs | 2 +- ...indows.Forms.DataGridViewCellCollection.cs | 26 +- ...System.Windows.Forms.DataGridViewColumn.cs | 12 - ...dows.Forms.DataGridViewColumnCollection.cs | 116 +-------- ...ystem.Windows.Forms.DataGridViewElement.cs | 5 - ...Windows.Forms.DataGridViewRowCollection.cs | 238 +----------------- ...stem.Windows.Forms.FlatButtonAppearance.cs | 4 +- 9 files changed, 17 insertions(+), 390 deletions(-) diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs index df6e7568..4df2a2ef 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlClient.SqlParameterCollection.cs @@ -22,11 +22,13 @@ public sealed class SqlParameterCollection : DbParameterCollection internal SqlParameterCollection() { } + public SqlParameter Add(SqlParameter value) { Contract.Ensures(value == null || Contract.Result() != null); return default(SqlParameter); } + public override int Add(object value) { return default(int); diff --git a/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs index f43fbdea..b38d7a6a 100644 --- a/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs +++ b/Microsoft.Research/Contracts/System.Data/System.Data.SqlDbType.cs @@ -12,7 +12,7 @@ // // 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.Data.SqlClient +namespace System.Data { public enum SqlDbType { diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs index dcbe7a07..cb4f7040 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs @@ -459,7 +459,7 @@ public Control.ControlCollection Controls [ParenthesizePropertyName(true)] [RefreshProperties(RefreshProperties.All)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ControlBindingsCollection DataBindings + public virtual ControlBindingsCollection DataBindings { get { diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs index 2c014bdf..0cedee2e 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewCellCollection.cs @@ -20,17 +20,15 @@ namespace System.Windows.Forms { public class DataGridViewCellCollection : BaseCollection, IList, ICollection, IEnumerable { - private ArrayList items; + //private ArrayList items; //private CollectionChangeEventHandler onCollectionChanged; - private DataGridViewRow owner; + //private DataGridViewRow owner; //public event CollectionChangeEventHandler CollectionChanged; public DataGridViewCellCollection(DataGridViewRow dataGridViewRow) { Contract.Requires(dataGridViewRow != null); - Contract.Ensures(this.items != null); - Contract.Ensures(this.owner != null); } public virtual int Add(DataGridViewCell dataGridViewCell) @@ -40,13 +38,6 @@ public virtual int Add(DataGridViewCell dataGridViewCell) return default(int); } - internal int AddInternal(DataGridViewCell dataGridViewCell) - { - Contract.Requires(dataGridViewCell != null); - Contract.Ensures(Contract.Result() >= 0); - return default(int); - } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public virtual void AddRange(params DataGridViewCell[] dataGridViewCells) { @@ -82,13 +73,6 @@ public virtual void Insert(int index, DataGridViewCell dataGridViewCell) Contract.Requires(index <= this.Count); } - internal void InsertInternal(int index, DataGridViewCell dataGridViewCell) - { - Contract.Requires(dataGridViewCell != null); - Contract.Requires(index >= 0); - Contract.Requires(index <= this.Count); - } - protected void OnCollectionChanged(CollectionChangeEventArgs e) { @@ -105,12 +89,6 @@ public virtual void RemoveAt(int index) Contract.Requires(index < this.Count); } - internal void RemoveAtInternal(int index) - { - Contract.Requires(index >= 0); - Contract.Requires(index < this.Count); - } - void ICollection.CopyTo(Array array, int index) { diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs index d1ee39e5..ff42339f 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumn.cs @@ -26,18 +26,6 @@ public DataGridViewColumn(DataGridViewCell cellTemplate) { } - public ISite Site - { - get - { - return default(ISite); - } - set - { - - } - } - //public event EventHandler Disposed; } } \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs index b10aabc6..228c11a8 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewColumnCollection.cs @@ -21,35 +21,29 @@ namespace System.Windows.Forms { public class DataGridViewColumnCollection : BaseCollection, IList, ICollection, IEnumerable { - private class ColumnOrderComparer : IComparer + /*private class ColumnOrderComparer : IComparer { // Methods public int Compare(object x, object y) { return default(int); } - } + }*/ //private int columnCountsVisible; //private int columnCountsVisibleSelected; //private static ColumnOrderComparer columnOrderComparer; //private int columnsWidthVisible; //private int columnsWidthVisibleFrozen; - private DataGridView dataGridView; - private ArrayList items; - private ArrayList itemsSorted; + //private DataGridView dataGridView; + //private ArrayList items; + //private ArrayList itemsSorted; //private int lastAccessedSortedIndex; //private CollectionChangeEventHandler onCollectionChanged; public DataGridViewColumnCollection(DataGridView dataGridView) { Contract.Requires(dataGridView != null); - Contract.Ensures(items != null); - Contract.Ensures(this.dataGridView != null); - } - internal int ActualDisplayIndexToColumnIndex(int actualDisplayIndex, DataGridViewElementStates includeFilter) - { - return default(int); } public virtual int Add(DataGridViewColumn dataGridViewColumn) @@ -76,11 +70,6 @@ public virtual void Clear() Contract.Ensures(this.Count == 0); } - internal int ColumnIndexToActualDisplayIndex(int columnIndex, DataGridViewElementStates includeFilter) - { - return default(int); - } - public virtual bool Contains(string columnName) { Contract.Requires(columnName != null); @@ -97,38 +86,11 @@ public void CopyTo(DataGridViewColumn[] array, int index) Contract.Requires(array != null); } - internal bool DisplayInOrder(int columnIndex1, int columnIndex2) - { - return default(bool); - } - - internal DataGridViewColumn GetColumnAtDisplayIndex(int displayIndex) - { - return default(DataGridViewColumn); - } - public int GetColumnCount(DataGridViewElementStates includeFilter) { return default(int); } - internal int GetColumnCount(DataGridViewElementStates includeFilter, int fromColumnIndex, int toColumnIndex) - { - return default(int); - } - - internal float GetColumnsFillWeight(DataGridViewElementStates includeFilter) - { - Contract.Ensures(Contract.Result() >= 0.0f); - return default(float); - } - - private int GetColumnSortedIndex(DataGridViewColumn dataGridViewColumn) - { - Contract.Ensures(Contract.Result() >= -1); - return default(int); - } - public int GetColumnsWidth(DataGridViewElementStates includeFilter) { return default(int); @@ -175,51 +137,11 @@ public virtual void Insert(int columnIndex, DataGridViewColumn dataGridViewColum Contract.Requires(dataGridViewColumn != null); } - internal void InvalidateCachedColumnCount(DataGridViewElementStates includeFilter) - { - - } - - internal void InvalidateCachedColumnCounts() - { - - } - - internal void InvalidateCachedColumnsOrder() - { - - } - - internal void InvalidateCachedColumnsWidth(DataGridViewElementStates includeFilter) - { - - } - - internal void InvalidateCachedColumnsWidths() - { - - } - protected virtual void OnCollectionChanged(CollectionChangeEventArgs e) { } - private void OnCollectionChanged(CollectionChangeEventArgs ccea, bool changeIsInsertion, Point newCurrentCell) - { - Contract.Requires(ccea != null); - } - - private void OnCollectionChanged_PostNotification(CollectionChangeEventArgs ccea, bool changeIsInsertion, Point newCurrentCell) - { - Contract.Requires(ccea != null); - } - - private void OnCollectionChanged_PreNotification(CollectionChangeEventArgs ccea) - { - - } - public virtual void Remove(string columnName) { Contract.Requires(columnName != null); @@ -236,12 +158,6 @@ public virtual void RemoveAt(int index) Contract.Requires(index < this.Count); } - internal void RemoveAtInternal(int index, bool force) - { - Contract.Requires(index >= 0); - Contract.Requires(index < this.Count); - } - void ICollection.CopyTo(Array array, int index) { Contract.Requires(array != null); @@ -286,26 +202,6 @@ void IList.RemoveAt(int index) { } - - private void UpdateColumnCaches(DataGridViewColumn dataGridViewColumn, bool adding) - { - - } - - private void UpdateColumnOrderCache() - { - Contract.Ensures(this.itemsSorted != null); - } - - internal static IComparer ColumnCollectionOrderComparer - { - get - { - Contract.Ensures(Contract.Result() != null); - return default(IComparer); - } - } - protected DataGridView DataGridView { get @@ -338,7 +234,7 @@ protected override ArrayList List get { Contract.Ensures(Contract.Result() != null); - return this.items; + return default(ArrayList); } } diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs index 5f4282f7..b91374c0 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewElement.cs @@ -20,10 +20,5 @@ public DataGridViewElement() { } - - internal DataGridViewElement(DataGridViewElement dgveTemplate) - { - - } } } \ No newline at end of file diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs index acf7e0d4..67d00fdd 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.DataGridViewRowCollection.cs @@ -22,7 +22,7 @@ namespace System.Windows.Forms { public class DataGridViewRowCollection : ICollection, IEnumerable, IList { - private class RowArrayList : ArrayList + /*private class RowArrayList : ArrayList { // Fields private DataGridViewRowCollection owner; @@ -35,21 +35,11 @@ public RowArrayList(DataGridViewRowCollection owner) Contract.Ensures(this.owner != null); } - private void CustomQuickSort(int left, int right) - { - - } - public void CustomSort(DataGridViewRowCollection.RowComparer rowComparer) { Contract.Requires(rowComparer != null); Contract.Ensures(this.rowComparer != null); } - - private object Pivot(int left, int center, int right) - { - return default(object); - } } private class RowComparer @@ -71,16 +61,6 @@ public RowComparer(DataGridViewRowCollection dataGridViewRows, IComparer customC Contract.Ensures(this.dataGridView != null); } - internal int CompareObjects(object value1, object value2, int rowIndex1, int rowIndex2) - { - return default(int); - } - - internal object GetComparedObject(int rowIndex) - { - return default(object); - } - // Nested Types private class ComparedObjectMax { @@ -132,14 +112,11 @@ object IEnumerator.Current //private int rowsHeightVisibleFrozen; private List rowStates; - //public event CollectionChangeEventHandler CollectionChanged; + //public event CollectionChangeEventHandler CollectionChanged;*/ public DataGridViewRowCollection(DataGridView dataGridView) { Contract.Requires(dataGridView != null); - Contract.Ensures(this.dataGridView != null); - Contract.Ensures(this.rowStates != null); - Contract.Ensures(this.items != null); } public virtual int Add() @@ -172,54 +149,11 @@ public virtual int AddCopies(int indexSource, int count) return default(int); } - internal int AddCopiesInternal(int indexSource, int count) - { - return default(int); - } - - internal int AddCopiesInternal(int indexSource, int count, DataGridViewElementStates dgvesAdd, DataGridViewElementStates dgvesRemove) - { - Contract.Requires(indexSource >= 0); - Contract.Requires(count > indexSource); - Contract.Requires(count > 0); - return default(int); - } - - private int AddCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElementStates rowTemplateState, int count) - { - Contract.Requires(rowTemplate != null); - return default(int); - } - public virtual int AddCopy(int indexSource) { return default(int); } - internal int AddCopyInternal(int indexSource, DataGridViewElementStates dgvesAdd, DataGridViewElementStates dgvesRemove, bool newRow) - { - return default(int); - } - - private int AddDuplicateRow(DataGridViewRow rowTemplate, bool newRow) - { - Contract.Requires(rowTemplate != null); - return default(int); - } - - internal int AddInternal(DataGridViewRow dataGridViewRow) - { - Contract.Requires(dataGridViewRow != null); - Contract.Ensures(Contract.Result() >= 0); - return default(int); - } - - internal int AddInternal(bool newRow, object[] values) - { - Contract.Ensures(Contract.Result() >= 0); - return default(int); - } - public virtual void AddRange(params DataGridViewRow[] dataGridViewRows) { Contract.Requires(dataGridViewRows != null); @@ -231,11 +165,6 @@ public virtual void Clear() } - internal void ClearInternal(bool recreateNewRow) - { - - } - public virtual bool Contains(DataGridViewRow dataGridViewRow) { return default(bool); @@ -246,11 +175,6 @@ public void CopyTo(DataGridViewRow[] array, int index) Contract.Requires(array != null); } - internal int DisplayIndexToRowIndex(int visibleRowIndex) - { - return default(int); - } - public int GetFirstRow(DataGridViewElementStates includeFilter) { Contract.Ensures(Contract.Result() >= -1); @@ -274,13 +198,6 @@ public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter) return default(int); } - internal int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, int skipRows) - { - Contract.Requires(indexStart >= -1); - Contract.Ensures(Contract.Result() >= -1); - return default(int); - } - public int GetNextRow(int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) { Contract.Requires(indexStart >= -1); @@ -307,31 +224,15 @@ public int GetRowCount(DataGridViewElementStates includeFilter) return default(int); } - internal int GetRowCount(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex) - { - Contract.Ensures(Contract.Result() >= 0); - return default(int); - } - public int GetRowsHeight(DataGridViewElementStates includeFilter) { return default(int); } - internal int GetRowsHeight(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex) - { - return default(int); - } - - private bool GetRowsHeightExceedLimit(DataGridViewElementStates includeFilter, int fromRowIndex, int toRowIndex, int heightLimit) - { - return default(bool); - } - public virtual DataGridViewElementStates GetRowState(int rowIndex) { Contract.Requires(rowIndex >= 0); - Contract.Requires(rowIndex < this.items.Count); + Contract.Requires(rowIndex < this.Count); return default(DataGridViewElementStates); } @@ -369,20 +270,6 @@ public virtual void InsertCopies(int indexSource, int indexDestination, int coun Contract.Requires(count > 0); } - private void InsertCopiesPrivate(int indexSource, int indexDestination, int count) - { - Contract.Requires(indexSource >= 0); - Contract.Requires(this.Count > indexSource); - Contract.Requires(indexDestination >= 0); - Contract.Requires(this.Count >= indexDestination); - Contract.Requires(count > 0); - } - - private void InsertCopiesPrivate(DataGridViewRow rowTemplate, DataGridViewElementStates rowTemplateState, int indexDestination, int count) - { - Contract.Requires(rowTemplate != null); - } - public virtual void InsertCopy(int indexSource, int indexDestination) { Contract.Requires(indexSource >= 0); @@ -391,23 +278,6 @@ public virtual void InsertCopy(int indexSource, int indexDestination) Contract.Requires(this.Count >= indexDestination); } - private void InsertDuplicateRow(int indexDestination, DataGridViewRow rowTemplate, bool firstInsertion, ref Point newCurrentCell) - { - Contract.Requires(rowTemplate != null); - } - - internal void InsertInternal(int rowIndex, DataGridViewRow dataGridViewRow) - { - Contract.Requires(rowIndex >= 0); - Contract.Requires(this.Count >= rowIndex); - Contract.Requires(dataGridViewRow != null); - } - - internal void InsertInternal(int rowIndex, DataGridViewRow dataGridViewRow, bool force) - { - Contract.Requires(dataGridViewRow != null); - } - public virtual void InsertRange(int rowIndex, params DataGridViewRow[] dataGridViewRows) { Contract.Requires(dataGridViewRows != null); @@ -416,51 +286,11 @@ public virtual void InsertRange(int rowIndex, params DataGridViewRow[] dataGridV Contract.Requires(this.Count >= rowIndex); } - internal void InvalidateCachedRowCount(DataGridViewElementStates includeFilter) - { - - } - - internal void InvalidateCachedRowCounts() - { - - } - - internal void InvalidateCachedRowsHeight(DataGridViewElementStates includeFilter) - { - - } - - internal void InvalidateCachedRowsHeights() - { - - } - protected virtual void OnCollectionChanged(CollectionChangeEventArgs e) { } - private void OnCollectionChanged(CollectionChangeEventArgs e, int rowIndex, int rowCount) - { - - } - - private void OnCollectionChanged(CollectionChangeEventArgs e, int rowIndex, int rowCount, bool changeIsDeletion, bool changeIsInsertion, bool recreateNewRow, Point newCurrentCell) - { - - } - - private void OnCollectionChanged_PostNotification(CollectionChangeAction cca, int rowIndex, int rowCount, DataGridViewRow dataGridViewRow, bool changeIsDeletion, bool changeIsInsertion, bool recreateNewRow, Point newCurrentCell) - { - - } - - private void OnCollectionChanged_PreNotification(CollectionChangeAction cca, int rowIndex, int rowCount, ref DataGridViewRow dataGridViewRow, bool changeIsInsertion) - { - - } - public virtual void Remove(DataGridViewRow dataGridViewRow) { Contract.Requires(dataGridViewRow != null); @@ -472,47 +302,12 @@ public virtual void RemoveAt(int index) Contract.Requires(index < this.Count); } - internal void RemoveAtInternal(int index, bool force) - { - - } - - private static bool RowHasValueOrToolTipText(DataGridViewRow dataGridViewRow) - { - return default(bool); - } - - internal bool RowIsSharable(int index) - { - return default(bool); - } - - internal void SetRowState(int rowIndex, DataGridViewElementStates state, bool value) - { - - } - public DataGridViewRow SharedRow(int rowIndex) { Contract.Ensures(Contract.Result() != null); return default(DataGridViewRow); } - internal DataGridViewElementStates SharedRowState(int rowIndex) - { - return default(DataGridViewElementStates); - } - - internal void Sort(IComparer customComparer, bool ascending) - { - - } - - internal void SwapSortedRows(int rowIndex1, int rowIndex2) - { - - } - void ICollection.CopyTo(Array array, int index) { @@ -558,16 +353,6 @@ void IList.RemoveAt(int index) } - private void UnshareRow(int rowIndex) - { - - } - - private void UpdateRowCaches(int rowIndex, ref DataGridViewRow dataGridViewRow, bool adding) - { - - } - public int Count { get @@ -586,14 +371,6 @@ protected DataGridView DataGridView } } - internal bool IsCollectionChangedListenedTo - { - get - { - return default(bool); - } - } - public DataGridViewRow this[int index] { get @@ -614,15 +391,6 @@ protected ArrayList List } } - internal ArrayList SharedList - { - get - { - Contract.Ensures(Contract.Result() != null); - return default(ArrayList); - } - } - int ICollection.Count { get diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs index 772dcd72..30fcb4e1 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.FlatButtonAppearance.cs @@ -18,9 +18,9 @@ namespace System.Windows.Forms { public class FlatButtonAppearance { - internal FlatButtonAppearance(ButtonBase owner) + private FlatButtonAppearance() { - Contract.Requires(owner != null); + } } } \ No newline at end of file From 678add6e55a49f5f9a41fe1853d622e028fc4970 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Wed, 24 Feb 2016 14:59:49 +1100 Subject: [PATCH 10/11] Control - ensure non-null from Text --- .../System.Windows.Forms.Control.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs index cb4f7040..e727e2da 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs @@ -1065,7 +1065,15 @@ public virtual LayoutEngine LayoutEngine //[Bindable(true)] //[Localizable(true)] //[DispId(-517)] - //public virtual string Text { get; set; } + public virtual string Text + { + get + { + Contract.Ensures(Contract.Result() != null); + return default(string); + } + set; + } //// //// Summary: //// Gets or sets the distance, in pixels, between the top edge of the control From 45b9c5d94538d6321da42586bbae24ca1d708cf7 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Wed, 24 Feb 2016 15:00:37 +1100 Subject: [PATCH 11/11] ...and give Text setter a body (oops) --- .../System.Windows.Forms/System.Windows.Forms.Control.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs index e727e2da..e7757a18 100644 --- a/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs +++ b/Microsoft.Research/Contracts/System.Windows.Forms/System.Windows.Forms.Control.cs @@ -1072,7 +1072,10 @@ public virtual string Text Contract.Ensures(Contract.Result() != null); return default(string); } - set; + set + { + + } } //// //// Summary: