/// <summary> /// Gets additional feature /// </summary> /// <typeparam name="T">Feature type</typeparam> /// <param name="obj">Object</param> /// <returns>Feature</returns> public override object GetAdditionalFeature <T>(T obj) { if (!typeof(T).Equals(typeof(IUrlConsumer))) { return(null); } IUrlConsumer c = obj as IUrlConsumer; UserControls.UserControlUrl uc = new UserControls.UserControlUrl(); if (c is IUrlProvider) { uc.Set(c as IUrlProvider); } uc.Set(c); return(uc); }
/// <summary> /// Sets url provider for control /// </summary> /// <param name="control">Control</param> /// <param name="provider">Provider</param> public static void Set(this Control control, IUrlConsumer consumer) { if (control is IUrlProvider) { string urlc = (consumer as IAssociatedObject).GetUrl(); if (urlc != null) { if (control is IConstantUrl) { (control as IConstantUrl).ConstantUrl = urlc; } } (control as IUrlProvider).Change += (string url) => { consumer.Url = url; }; } foreach (Control c in control.Controls) { c.Set(consumer); } }