/// <summary> /// Initializes a new instance of the <see cref="RockBlockNotificationManager"/> class. /// </summary> /// <param name="block">The block.</param> /// <param name="notificationControl">The notification control.</param> /// <param name="detailContainerControl">The detail container control.</param> /// <exception cref="System.ArgumentNullException"> /// block /// or /// detailContainerControl /// or /// notificationControl /// </exception> /// <exception cref="System.Exception">NotificationControl cannot be a child of DetailContainerControl.</exception> public RockBlockNotificationManager(RockBlock block, NotificationBox notificationControl, Control detailContainerControl) { Block = block; if (Block == null) { throw new ArgumentNullException("block"); } DetailContainerControl = detailContainerControl; if (DetailContainerControl == null) { throw new ArgumentNullException("detailContainerControl"); } NotificationControl = notificationControl; if (NotificationControl == null) { throw new ArgumentNullException("notificationControl"); } // Verify that the notification control is not a child of the detail container. // This would cause the notification to be hidden when the content is disallowed. var invalidParent = notificationControl.FindFirstParentWhere(x => x.ID == detailContainerControl.ID); if (invalidParent != null) { throw new Exception("NotificationControl cannot be a child of DetailContainerControl."); } // Set the initial state of the controls. this.Clear(); }