/// <summary> /// This is kind of a hack to work around the issue in Silverlight where you don't know when /// all the controls have been loaded in a page (so you can *then* make a call to the server). /// All the XAML pages are parsed when the application is loaded to extract the expanz controls, /// and here we'll register them *before* they are actually loaded so that requests can be made /// to the server, and then these entries will be updated with the actual control references /// when the controls are actually loaded. /// </summary> internal void RegisterUnloadedControls(List <ExpanzControlDetails> expanzControls) { var controlsToRegister = expanzControls.Where(x => x.IsDataControl); foreach (ExpanzControlDetails controlDetails in controlsToRegister) { if (controlDetails.DataId != null && !DataControls.ContainsKey(controlDetails.DataId)) { DataControls.Add(controlDetails.DataId, controlDetails); // Add temporary dummy entry } } controlsToRegister = expanzControls.Where(x => x.IsMediaControl); foreach (ExpanzControlDetails controlDetails in controlsToRegister) { if (controlDetails.DataId != null && !DataControls.ContainsKey(controlDetails.DataId)) { MediaControls.Add(controlDetails.DataId, controlDetails); // Add temporary dummy entry } } }