Ejemplo n.º 1
0
 internal ClientScriptLoaderHelper(ComparisonWidgetSettings settings, ClientHelper helper)
 {
     _applicationPathFinder = new ApplicationPathFinder();
     _settings = settings;
     //Set ClientHelper
     this.helper = helper;
 }
Ejemplo n.º 2
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);
        }
        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);
        }
        /// <summary>
        /// Initialize Comparison widget
        /// </summary>
        /// <param name="widgetSettings">Comparison widgetSettings</param>
        public static void Init(ComparisonWidgetSettings widgetSettings)
        {
            //Check settings
            if (widgetSettings == null)
            {
                throw new ArgumentNullException("widgetSettings", @"GroupdocsComparison widgetSettings parameter is null");
            }

            if (!IsInitialized)
            {
                //Set settings
                Settings = widgetSettings;

                if (!IsWebApplicationContext())
                {
                    return;
                }

                //Set base url
                if (string.IsNullOrEmpty(Settings.BaseUrl))
                {
                    Settings.BaseUrl = HttpRuntime.AppDomainAppVirtualPath;
                }
            }
        }
 internal ClientScriptLoaderHelper(ComparisonWidgetSettings settings, ClientHelper helper)
 {
     _applicationPathFinder = new ApplicationPathFinder();
     _settings = settings;
     //Set ClientHelper
     this.helper = helper;
 }
 internal ClientHelper(ComparisonWidgetSettings settings, string targetElementSelector)
 {
     //Create comparison service
     _service = new ComparisonService(settings);
     //Set comparison settings
     _settings = settings;
     _targetElementSelector = targetElementSelector;
 }
 internal ClientHelper(ComparisonWidgetSettings settings, string targetElementSelector)
 {
     //Create comparison service
     _service = new ComparisonService(settings);
     //Set comparison settings
     _settings = settings;
     _targetElementSelector = targetElementSelector;
 }
        /// <summary>
        /// Instantiate a comparison service
        /// </summary>
        public ComparisonService(ComparisonWidgetSettings settings)
        {
            //Set new context name
            _contextName = Guid.NewGuid().ToString();
            //Set settings
            _settings = settings;

            //Set Viewer license
            if (!String.IsNullOrEmpty(settings.LicensePath))
            {
                License lic = new License();
                lic.SetLicense(settings.LicensePath);
            }
        }
        /// <summary>
        /// Instantiate a comparison service
        /// </summary>
        public ComparisonService(ComparisonWidgetSettings settings)
        {
            //Set new context name
            _contextName = Guid.NewGuid().ToString();
            //Set settings
            _settings = settings;

            //Set Viewer license
            if (!String.IsNullOrEmpty(settings.LicensePath))
            {
                License lic = new License();
                lic.SetLicense(settings.LicensePath);
            }
        }
        public static void RegisterRoutes(RouteCollection routes, ComparisonWidgetSettings settings)
        {
            //Add route "{resource}.axd/{*pathInfo}" to ignore
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            //Init Viewer routes
            routes.MapRoute(
                name: "document-viewer",
                url: "document-viewer/{action}/{id}",
                defaults: new { controller = "Viewer", action = "Index", id = UrlParameter.Optional }
                );
            //Init Comparison routes
            routes.MapRoute(null, settings.ClientFilesPrefix + "/embedded/{*path}", new { controller = "Comparison", action = "GetResource" });

            routes.MapRoute(null, settings.ClientFilesPrefix + "/comparison2/updatechanges", new { controller = "Comparison", action = "ApplyChanges" });
            routes.MapRoute(null, settings.ClientFilesPrefix + "/comparison2/getchanges", new { controller = "Comparison", action = "GetChanges" });

            //Add default route for Home controller
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        }
        public static void RegisterRoutes(RouteCollection routes, ComparisonWidgetSettings settings)
        {
            //Add route "{resource}.axd/{*pathInfo}" to ignore
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            //Init Viewer routes
            routes.MapRoute(
                name: "document-viewer",
                url: "document-viewer/{action}/{id}",
                defaults: new { controller = "Viewer", action = "Index", id = UrlParameter.Optional }
            );
            //Init Comparison routes
            routes.MapRoute(null, settings.ClientFilesPrefix + "/embedded/{*path}", new { controller = "Comparison", action = "GetResource" });

            routes.MapRoute(null, settings.ClientFilesPrefix + "/comparison2/updatechanges", new { controller = "Comparison", action = "ApplyChanges" });
            routes.MapRoute(null, settings.ClientFilesPrefix + "/comparison2/getchanges", new { controller = "Comparison", action = "GetChanges" });

            //Add default route for Home controller
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
Ejemplo n.º 12
0
 internal ClientStylesLoaderHelper(ComparisonWidgetSettings settings)
 {
     //Set comparison settings
     _settings = settings;
 }
        /// <summary>
        /// Initialize Comparison widget
        /// </summary>
        /// <param name="widgetSettings">Comparison widgetSettings</param>
        public static void Init(ComparisonWidgetSettings widgetSettings)
        {
            //Check settings
            if (widgetSettings == null)
            {
                throw new ArgumentNullException("widgetSettings", @"GroupdocsComparison widgetSettings parameter is null");
            }

            if (!IsInitialized)
            {
                //Set settings
                Settings = widgetSettings;

                if (!IsWebApplicationContext()) return;

                //Set base url
                if (string.IsNullOrEmpty(Settings.BaseUrl))
                {
                    Settings.BaseUrl = HttpRuntime.AppDomainAppVirtualPath;
                }
            }
        }
 internal ClientStylesLoaderHelper(ComparisonWidgetSettings settings)
 {
     //Set comparison settings
     _settings = settings;
 }