PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/mcs/class/System.Web/System.Web.UI.WebControls/WizardStepCollection.cs

https://bitbucket.org/danipen/mono
C# | 173 lines | 116 code | 29 blank | 28 comment | 10 complexity | 5237bfc86bb0545db887857a4c710133 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. //
  2. // System.Web.UI.WebControls.WizardStepCollection
  3. //
  4. // Authors:
  5. // Lluis Sanchez Gual (lluis@novell.com)
  6. //
  7. // (C) 2005 Novell, Inc. (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System;
  31. using System.Collections;
  32. namespace System.Web.UI.WebControls
  33. {
  34. public sealed class WizardStepCollection : IList, ICollection, IEnumerable
  35. {
  36. ArrayList list = new ArrayList ();
  37. Wizard wizard;
  38. internal WizardStepCollection (Wizard wizard)
  39. {
  40. this.wizard = wizard;
  41. }
  42. public int Count {
  43. get { return list.Count; }
  44. }
  45. public bool IsReadOnly {
  46. get { return false; }
  47. }
  48. public bool IsSynchronized {
  49. get { return false; }
  50. }
  51. public WizardStepBase this [int index] {
  52. get { return (WizardStepBase) list [index]; }
  53. }
  54. public object SyncRoot {
  55. get { return this; }
  56. }
  57. public void Add (WizardStepBase wizardStep)
  58. {
  59. if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
  60. wizardStep.SetWizard (wizard);
  61. list.Add (wizardStep);
  62. wizard.UpdateViews ();
  63. }
  64. public void AddAt (int index, WizardStepBase wizardStep)
  65. {
  66. if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
  67. wizardStep.SetWizard (wizard);
  68. list.Insert (index, wizardStep);
  69. wizard.UpdateViews ();
  70. }
  71. public void Clear ()
  72. {
  73. list.Clear ();
  74. wizard.UpdateViews ();
  75. }
  76. public bool Contains (WizardStepBase wizardStep)
  77. {
  78. if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
  79. return list.Contains (wizardStep);
  80. }
  81. public void CopyTo (WizardStepBase[] array, int index)
  82. {
  83. list.CopyTo (array, index);
  84. }
  85. public IEnumerator GetEnumerator ()
  86. {
  87. return list.GetEnumerator ();
  88. }
  89. public int IndexOf (WizardStepBase wizardStep)
  90. {
  91. if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
  92. return list.IndexOf (wizardStep);
  93. }
  94. public void Insert (int index, WizardStepBase wizardStep)
  95. {
  96. AddAt (index, wizardStep);
  97. }
  98. public void Remove (WizardStepBase wizardStep)
  99. {
  100. if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
  101. list.Remove (wizardStep);
  102. wizard.UpdateViews ();
  103. }
  104. public void RemoveAt (int index)
  105. {
  106. list.RemoveAt (index);
  107. wizard.UpdateViews ();
  108. }
  109. bool IList.IsFixedSize {
  110. get { return false; }
  111. }
  112. object IList.this [int index] {
  113. get { return list [index]; }
  114. set { list [index] = value; }
  115. }
  116. int IList.Add (object ob)
  117. {
  118. int res = list.Add ((WizardStepBase)ob);
  119. wizard.UpdateViews ();
  120. return res;
  121. }
  122. bool IList.Contains (object ob)
  123. {
  124. return Contains ((WizardStepBase)ob);
  125. }
  126. int IList.IndexOf (object ob)
  127. {
  128. return IndexOf ((WizardStepBase)ob);
  129. }
  130. void IList.Insert (int index, object ob)
  131. {
  132. AddAt (index, (WizardStepBase)ob);
  133. }
  134. void IList.Remove (object ob)
  135. {
  136. Remove ((WizardStepBase)ob);
  137. }
  138. void ICollection.CopyTo (Array array, int index)
  139. {
  140. list.CopyTo (array, index);
  141. }
  142. }
  143. }
  144. #endif