Esempio n. 1
0
        protected void Application_Start()
        {
            //Register areas
            AreaRegistration.RegisterAllAreas();

            //Set license
            License license = new License();

            license.SetLicense(@".\..\..\licenses\GroupDocs.Comparison.lic");

            //Register filters
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            //Create comparison settings
            var comparisonSettings = new ComparisonWidgetSettings
            {
                //Set root storage path
                RootStoragePath = Server.MapPath("~/App_Data/"),
                //Set comparison behavior
                ComparisonBehavior =
                {
                    StyleChangeDetection = true,
                    GenerateSummaryPage  = true
                },
                //Set license for Viewer
                LicensePath = @".\..\..\licenses\GroupDocs.Viewer.lic"
            };

            //Initiate comparison widget
            ComparisonWidget.Init(comparisonSettings);
            //Register routes
            RouteConfig.RegisterRoutes(RouteTable.Routes, comparisonSettings);
            //Bundle scripts
            BundleConfigurator.Configure(comparisonSettings);
        }
Esempio n. 2
0
        /// <summary>
        /// Set true if need to use widget in ASP.NET WebForms project
        /// </summary>
        /// <param name="useHttpHandlers">True by default</param>
        /// <returns></returns>
        public override string ToString()
        {
            var result = new StringBuilder();

            result.Append(Styles.Render(BundleTable.Bundles.ResolveBundleUrl(BundleConfigurator.AddPrefix("~/comparison/styles", false))));

            //Add comparison css scripts
            result.Append(base.ToString());
            return(result.ToString());
        }
Esempio n. 3
0
        public override string ToString()
        {
            var applicationPath = _applicationPathFinder.GetApplicationPath();

            var result = new StringBuilder();

            var embeddeScriptsTemplate = String.Format("<script type='text/javascript' src='{0}{1}/{{0}}'></script>", applicationPath, _settings.EmbeddedResourceUrl);

            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/jquery-1.9.1.min.js");
            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/jquery-ui-1.10.3.min.js");
            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/knockout-3.2.0.js");

            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/turn.min.js");
            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/modernizr.2.6.2.Transform2d.min.js");
            result.AppendFormat(embeddeScriptsTemplate, "scripts/lib/installableViewer.js");

            result.AppendLine("<script type='text/javascript'> $.ui.groupdocsViewer.prototype.applicationPath = 'http://*****:*****@"
                define('comparison-settings', function () {{ 
                    var sessionId = '',
                        sourceFileId = '',
                        targetFileId = '',
                        resultFileId = '{0}',
                        thumbsImageBase64Encoded = '{2}',
                        mode = 'embed';

                    return {{
                        sessionId: sessionId,
                        sourceFileId: sourceFileId,
                        targetFileId: targetFileId,
                        resultFileId: resultFileId,
                        thumbsImageBase64Encoded: thumbsImageBase64Encoded,
                        mode: mode
                    }};
                }});";

            result.AppendLine(String.Format(settings, "", "", ""));

            result.AppendLine("</script>");

            result.AppendFormat(Scripts.Render(String.Format("~/{0}/comparison/core", _settings.AppClientFilesPrefix)).ToString());
            result.AppendFormat(embeddeScriptsTemplate, "scripts/comparison2/core/main.js");
            result.AppendFormat(embeddeScriptsTemplate, "scripts/comparison2/redline.js");

            result.Append(helper.GenerateClientCode());

            return(result.ToString());
        }