/// <summary> /// Attempts to extract the "current" view for the given gadget. /// </summary> /// <param name="context"></param> /// <param name="spec"></param> /// <returns></returns> private View GetView(GadgetContext context, GadgetSpec spec) { String viewName = context.getView(); View view = spec.getView(viewName); if (view == null) { JsonObject views = containerConfig.GetJsonObject(context.getContainer(), "gadgets.features/views"); foreach (DictionaryEntry v in views) { JsonArray aliases = ((JsonObject)v.Value)["aliases"] as JsonArray; if (aliases != null && view == null) { for (int i = 0, j = aliases.Length; i < j; ++i) { if (viewName == aliases.GetString(i)) { view = spec.getView(v.Key.ToString()); if (view != null) { break; } } } } } } if (view == null) { view = spec.getView(GadgetSpec.DEFAULT_VIEW); } return(view); }