DockPaneCollection.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:DockPaneCollection.cs
  5. * 2.功能描述:类文件
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/09/01 1.00 新建
  9. *******************************************************************************/
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. namespace Dongke.IBOSS.PRD.Basics.DockPanel
  13. {
  14. /// <summary>
  15. /// 类文件
  16. /// </summary>
  17. public class DockPaneCollection : ReadOnlyCollection<DockPane>
  18. {
  19. internal DockPaneCollection()
  20. : base(new List<DockPane>())
  21. {
  22. }
  23. internal int Add(DockPane pane)
  24. {
  25. if (Items.Contains(pane))
  26. return Items.IndexOf(pane);
  27. Items.Add(pane);
  28. return Count - 1;
  29. }
  30. internal void AddAt(DockPane pane, int index)
  31. {
  32. if (index < 0 || index > Items.Count - 1)
  33. return;
  34. if (Contains(pane))
  35. return;
  36. Items.Insert(index, pane);
  37. }
  38. internal void Dispose()
  39. {
  40. for (int i = Count - 1; i >= 0; i--)
  41. this[i].Close();
  42. }
  43. internal void Remove(DockPane pane)
  44. {
  45. Items.Remove(pane);
  46. }
  47. }
  48. }