static void ShowSaveDialog(IContextualResourceModel resourceModel, WebsiteCallbackHandler callbackHandler, string type, string title, string resourceId = null) { if(resourceModel == null) { throw new ArgumentNullException("resourceModel"); } IEnvironmentModel environment = resourceModel.Environment; if(environment == null) { // ReSharper disable NotResolvedInText throw new ArgumentNullException("environment"); } EnvironmentRepository.Instance.ActiveEnvironment = environment; const string PageName = "dialogs/savedialog"; const double Width = 604; const double Height = 450; var workspaceId = GlobalConstants.ServerWorkspaceID; const string LeftTitle = "Save"; string rightTitle = environment.Name + " (" + environment.Connection.AppServerUri + ")"; var envirDisplayName = FullyEncodeServerDetails(environment.Connection); if (resourceModel.Category == null) { resourceModel.Category = ""; } var selectedPath = resourceModel.Category.Contains("Unassigned") || string.IsNullOrEmpty(resourceModel.Category) ? "" : resourceModel.Category; var lastIndexOf = selectedPath.LastIndexOf("\\", StringComparison.Ordinal); if(lastIndexOf != -1) { selectedPath = selectedPath.Substring(0, lastIndexOf); } selectedPath = selectedPath.Replace("\\", "\\\\"); var relativeUriString = string.Format("{0}?wid={1}&rid={2}&type={3}&title={4}&envir={5}&category={6}", PageName, workspaceId, resourceId, type, title, envirDisplayName, selectedPath); if(!IsTestMode) { // this must be a property ;) environment.ShowWebPageDialog(SiteName, relativeUriString, callbackHandler, Width, Height, LeftTitle, rightTitle); } else { // TODO : return the relativeUriString generated ;) CallBackHandler = callbackHandler; TestModeRelativeUri = relativeUriString; } }
public static void ShowFileChooser(IEnvironmentModel environment, FileChooserMessage fileChooserMessage) { VerifyArgument.IsNotNull("environment", environment); const string PageName = "dialogs/filechooser"; const double Width = 704; const double Height = 517; const string LeftTitle = "Choose File(s)"; var environmentConnection = environment.Connection; if(environmentConnection != null) { string rightTitle = environment.Name + " (" + environmentConnection.AppServerUri + ")"; var pageHandler = new FileChooserCallbackHandler(fileChooserMessage); var envirDisplayName = FullyEncodeServerDetails(environmentConnection); var relativeUriString = string.Format("{0}?envir={1}", PageName, envirDisplayName); if(!IsTestMode) { environment.ShowWebPageDialog(SiteName, relativeUriString, pageHandler, Width, Height, LeftTitle, rightTitle); } else { CallBackHandler = pageHandler; TestModeRelativeUri = relativeUriString; } } }
public string GetIntellisenseResults(string searchTerm, int caretPosition) { return(WebsiteCallbackHandler.GetJsonIntellisenseResults(searchTerm, caretPosition)); }