public void ActivateSmartPart(ISmartPartView smartPart) { if (smartPart is UserControl) { hostPanel.Controls.Clear(); hostPanel.Controls.Add((UserControl)smartPart); smartPart.Dock = DockStyle.Fill; SmartPartAcivatedEventArgs ea = new SmartPartAcivatedEventArgs(); ea.SmartPartName = smartPart.SmartPartName; ea.SmartPartIcon = smartPart.SmartPartIcon; ea.HostName = this.HostName; ea.SmartPart = smartPart; onSmartPartAcivated(ea); } else { throw new ArgumentException(string.Format(Resources.SmartPartHost_ActivateSmartPartError, smartPart.GetType())); } }