private static Dialog CreateDialog(string baseURI, string dialogType, string parameterName, MethodInfo method, OslcDialog dialogAttribute, string[] resourceShapes, Dictionary <string, object> pathParameterValues) { string title = dialogAttribute.title; string label = dialogAttribute.label; string dialogURI = dialogAttribute.uri; string hintWidth = dialogAttribute.hintWidth; string hintHeight = dialogAttribute.hintHeight; string[] resourceTypes = dialogAttribute.resourceTypes; string[] usages = dialogAttribute.usages; string uri = ""; string typeName = method.DeclaringType.Name; //controller names must end with Controller int pos = typeName.IndexOf("Controller"); string controllerName = typeName.Substring(0, pos); if (dialogURI.Length > 0) { // TODO: Do we chop off everything after the port and then append the dialog URI? // For now just assume that the dialog URI builds on top of the baseURI. uri = ResolvePathParameters(baseURI, dialogURI, pathParameterValues); } else { throw new OslcCoreInvalidAttributeException(typeof(OslcDialog), typeof(OslcDialog)); } Dialog dialog = null; dialog = new Dialog(title, new Uri(uri)); if ((label != null) && (label.Length > 0)) { dialog.SetLabel(label); } if ((hintWidth != null) && (hintWidth.Length > 0)) { dialog.SetHintWidth(hintWidth); } if ((hintHeight != null) && (hintHeight.Length > 0)) { dialog.SetHintHeight(hintHeight); } foreach (string resourceType in resourceTypes) { dialog.AddResourceType(new Uri(resourceType)); } foreach (string usage in usages) { dialog.AddUsage(new Uri(usage)); } return(dialog); }
private static Dialog CreateSelectionDialog(string baseURI, MethodInfo method, OslcDialog dialogAttribute, string[] resourceShapes, Dictionary <string, object> pathParameterValues) { return(CreateDialog(baseURI, "Selection", "queryBase", method, dialogAttribute, resourceShapes, pathParameterValues)); }