Example #1
0
            /// <summary>
            /// Adds an item to the control. Ensures it is a <see cref="MultiPanelPage" />.
            /// </summary>
            /// <param name="value">The <see cref="T:System.Windows.Forms.Control" /> to add to the control collection.</param>
            /// <exception cref="System.ArgumentException">Tried to add a MultiPanelPage control to the MultiPanelPage.ControlCollection.;value</exception>
            /// <exception cref="System.ArgumentNullException">value</exception>
            public override void Add(Control value)
            {
                value.ThrowIfNull(nameof(value), "Tried to add a null value to the MultiPanelPage.ControlCollection.");

                MultiPanelPage p = value as MultiPanelPage;

                if (p != null)
                {
                    throw new ArgumentException("Tried to add a MultiPanelPage control to the MultiPanelPage.ControlCollection.",
                                                "value");
                }

                base.Add(value);
            }
Example #2
0
            /// <summary>
            /// Constructor.
            /// </summary>
            /// <param name="owner">A <see cref="T:System.Windows.Forms.Control" /> representing the control that owns the control collection.</param>
            /// <exception cref="System.ArgumentException">Tried to create a MultiPanelPage.ControlCollection with a non-MultiPanelPage owner.;owner</exception>
            /// <exception cref="System.ArgumentNullException">owner</exception>
            public PageControlCollection(Control owner)
                : base(owner)
            {
                // Should not happen
                owner.ThrowIfNull(nameof(owner), "Tried to create a MultiPanelPage.ControlCollection with a null owner.");

                // Should not happen
                MultiPanelPage c = owner as MultiPanelPage;

                if (c == null)
                {
                    throw new ArgumentException(
                              @"Tried to create a MultiPanelPage.ControlCollection with a non-MultiPanelPage owner.", nameof(owner));
                }
            }
Example #3
0
            /// <summary>
            /// Adds a page.
            /// </summary>
            /// <param name="value">The <see cref="T:System.Windows.Forms.Control" /> to add to the control collection.</param>
            /// <exception cref="System.ArgumentNullException">value</exception>
            /// <exception cref="System.ArgumentException">Tried to add a non-MultiPanelPage control to the MultiPanelPagesCollection;value</exception>
            public override void Add(Control value)
            {
                value.ThrowIfNull(nameof(value), "Tried to add a null value to the MultiPanelPagesCollection.");

                MultiPanelPage p = value as MultiPanelPage;

                if (p == null)
                {
                    throw new ArgumentException("Tried to add a non-MultiPanelPage control to the MultiPanelPagesCollection",
                                                "value");
                }

                p.SendToBack();
                base.Add(p);
            }
Example #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="oldPage"></param>
 /// <param name="newPage"></param>
 public MultiPanelSelectionChangeEventArgs(MultiPanelPage oldPage, MultiPanelPage newPage)
 {
     OldPage = oldPage;
     NewPage = newPage;
 }
Example #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="oldPage"></param>
 /// <param name="newPage"></param>
 public MultiPanelSelectionChangeEventArgs(MultiPanelPage oldPage, MultiPanelPage newPage)
 {
     OldPage = oldPage;
     NewPage = newPage;
 }