public HtmlTemplatesContainerConfiguration_Tests()
        {
            container     = new TinyIoCContainer();
            configuration = new HtmlTemplatesContainerConfiguration(type => new Type[0]);
            configuration.Configure(container);

            fileSearch = (FileSearch)container.Resolve <IFileSearch>(HostBase.FileSearchComponentName(typeof(HtmlTemplateBundle)));
        }
Esempio n. 2
0
        public StylesheetsContainerConfiguration_Tests()
        {
            container = new TinyIoCContainer();
            container.Register <IStylesheetMinifier, MicrosoftStylesheetMinifier>();
            container.Register(typeof(IUrlModifier), Mock.Of <IUrlModifier>());
            container.Register <IUrlGenerator>((c, x) => new UrlGenerator(c.Resolve <IUrlModifier>(), "cassette.axd/"));

            configuration = new StylesheetsContainerConfiguration(type => new Type[0]);
            configuration.Configure(container);

            fileSearch = (FileSearch)container.Resolve <IFileSearch>(HostBase.FileSearchComponentName(typeof(StylesheetBundle)));
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Window"/> class.
        /// </summary>
        /// <param name="application">
        /// The application.
        /// </param>
        /// <param name="hostConfig">
        /// The host config.
        /// </param>
        public Window(HostBase application, ChromelyConfiguration hostConfig)
            : base(hostConfig)
        {
            _hostConfig      = hostConfig;
            Browser          = new CefGlueBrowser(this, hostConfig, new CefBrowserSettings());
            Browser.Created += OnBrowserCreated;
            _application     = application;

            // Set event handler
            Browser.SetEventHandlers();

            ShowWindow();
        }
Esempio n. 4
0
        public ScriptBundleContainerModuleWithFileSearchModifierTests()
        {
            container = new TinyIoCContainer();
            container.Register <IJavaScriptMinifier, MicrosoftJavaScriptMinifier>();
            container.Register <IUrlGenerator, UrlGenerator>();
            container.Register(typeof(IUrlModifier), Mock.Of <IUrlModifier>());

            var modifier = new Mock <IFileSearchModifier <ScriptBundle> >();

            modifier
            .Setup(m => m.Modify(It.IsAny <FileSearch>()))
            .Callback <FileSearch>(fs => fs.Pattern += ";*.other");

            container.Register(typeof(IFileSearchModifier <ScriptBundle>), modifier.Object);

            configuration = new ScriptContainerConfiguration(type => new Type[0]);
            configuration.Configure(container);

            fileSearch = (FileSearch)container.Resolve <IFileSearch>(HostBase.FileSearchComponentName(typeof(ScriptBundle)));
        }
 protected virtual IProgressChannel StartProgressChannelCore(HostBase host, string name)
 {
     Contracts.AssertNonEmpty(name);
     Contracts.AssertValueOrNull(host);
     return(new ProgressReporting.ProgressChannel(this, ProgressTracker, name));
 }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Window"/> class.
        /// </summary>
        /// <param name="application">
        /// The application.
        /// </param>
        /// <param name="hostConfig">
        /// The host config.
        /// </param>
        public Window(HostBase application, CefConfiguration hostConfig)
            : base(new XDisplay(IntPtr.Zero), new Rectangle(0, 0, application.HostConfig.HostWidth, application.HostConfig.HostHeight))
        {
            CefGlueClient.window = this;
            this.Name            = application.HostConfig.HostTitle;

            this.mHostConfig  = hostConfig;
            this.mApplication = application;
            this.PropertyNotifyHandlerEvent += (xevent, window) =>
            {
                var attr = this.GetAttributes();
                if (attr.x + attr.width > 0 && attr.y + attr.height > 0 && this.mBrowserWindowHandle != IntPtr.Zero)
                {
                    ResizeEx(this.mBrowserWindowHandle, new Size(attr.x + attr.width, attr.y + attr.height));
                }
            };

            #region Browser
            this.mCore = new CefGlueBrowser(this, new CefBrowserSettings(), this.mHostConfig.StartUrl);
            var windowInfo = CefWindowInfo.Create();
            switch (CefRuntime.Platform)
            {
            case CefRuntimePlatform.Linux:
                windowInfo.SetAsChild(Handle, new CefRectangle(0, 0, 0, 0));
                break;

            case CefRuntimePlatform.MacOSX:
            default:
                break;
            }
            this.mCore.Create(windowInfo);

            this.mCore.AddressChanged += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.BeforeClose += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.BeforePopup += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.BrowserCreated += (s, args) =>
            {
                this.mBrowserWindowHandle = this.mCore.Browser.GetHost().GetWindowHandle();
            };
            this.mCore.ConsoleMessage += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { Log.Trace(e.Source, e.Line, e.Message); });
            };
            this.mCore.LoadEnd += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.LoadError += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.LoadingStateChange += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.LoadStarted += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.PluginCrashed += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.RenderProcessTerminated += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => {
                    if (this.mCore != null)
                    {
                        Log.Critial("Render Process Terminated: reloading page");
                        if (this.mCore.Browser != null)
                        {
                            this.mCore.Browser.Reload();
                        }
                    }
                });
            };
            this.mCore.StatusMessage += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.PluginCrashed += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            this.mCore.TitleChanged += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => {
                    if (!string.IsNullOrEmpty(e.Title))
                    {
                        Name = e.Title;
                    }
                });
            };
            this.mCore.Tooltip += (s, e) =>
            {
                Gtk.Application.Invoke((_s, _e) => { });
            };
            #endregion

            //if (File.Exists(Path.Combine(application.HostConfig.HostIconFile)))
            //    this.Icon = System.Drawing.Icon.FromHandle((new Bitmap(Path.Combine(application.HostConfig.HostIconFile))).GetHicon());
            //
            //this.BackColor = Color.FromArgb(32, 31, 41);


            this.Show();
        }