Dev2.Webs.RootWebSite.ShowSaveDialog C# (CSharp) Method

ShowSaveDialog() static private method

static private ShowSaveDialog ( IContextualResourceModel resourceModel, WebsiteCallbackHandler callbackHandler, string type, string title, string resourceId = null ) : void
resourceModel IContextualResourceModel
callbackHandler WebsiteCallbackHandler
type string
title string
resourceId string
return void
        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;
            }
        }