Exemple #1
0
        /// <summary>
        /// Loads html from the resource
        /// </summary>
        public void LoadResource(Type baseType, String resource)
        {
            #region Arguments checking
            if (baseType == null)
            {
                throw new ArgumentNullException("baseType");
            }

            if (String.IsNullOrEmpty(resource))
            {
                throw new ArgumentNullException("resource");
            }
            #endregion

            var resourceName = ResProtocol.ProtocolPrefix +
                               baseType.AssemblyQualifiedName +
                               ResProtocol.PathSeparator + resource;

            var text = SciterFactory.ResolveBinResource(resourceName, ResourceType.Html);

            if (text == null)
            {
                throw new FileNotFoundException(String.Format("Resource {0} not found", resourceName));
            }

            SciterHostApi.SciterLoadHtml(Handle, text, resourceName);
        }
Exemple #2
0
        /// <summary>
        /// Controls should route all window events throgh this method.
        /// </summary>
        private IntPtr ProcessMessage(IntPtr wnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
        {
            if (msg == User32.WM_DESTROY)
            {
                Host.ProcessDestroyed(EventArgs.Empty);
            }

            handled = false;
            return(SciterHostApi.SciterProcND(wnd, msg, wparam, lparam, ref handled));
        }
Exemple #3
0
        /// <summary>
        /// Loads html from file
        /// </summary>
        public void LoadResource(String resourceName)
        {
            var text = SciterFactory.ResolveBinResource(resourceName, ResourceType.Html);

            if (text == null)
            {
                throw new FileNotFoundException(String.Format("Resource {0} not found", resourceName));
            }

            SciterHostApi.SciterLoadHtml(Handle, text, resourceName);
        }
Exemple #4
0
        /// <summary>
        /// Loads Html text in the sciter window
        /// </summary>
        public void LoadFile(string file)
        {
            #region Arguments checking
            if (String.IsNullOrEmpty(file))
            {
                throw new ArgumentNullException("file");
            }
            #endregion

            SciterHostApi.SciterLoadFile(Handle, file);
        }
Exemple #5
0
        /// <summary>
        /// Loads Html text in the sciter window
        /// </summary>
        public void LoadHtml(string baseUri, string html)
        {
            #region Arguments checking
            if (String.IsNullOrEmpty(html))
            {
                throw new ArgumentNullException("html");
            }
            #endregion

            SciterHostApi.SciterLoadHtml(Handle, html, baseUri);
        }
Exemple #6
0
        /// <summary>
        /// Calls script function
        /// </summary>
        public object Call(string functionName, params object[] args)
        {
            #region Arguments checking
            if (String.IsNullOrEmpty(functionName))
            {
                throw new ArgumentNullException("functionName");
            }
            #endregion

            return(SciterHostApi.SciterCall(Handle, functionName, args));
        }
Exemple #7
0
        /// <summary>
        /// Performs sciter initialization
        /// </summary>
        private void InitializeSciter()
        {
            Hook.HandleDestroyed += delegate
            {
                HandleInternal = IntPtr.Zero;
                Hook           = null;
            };

            // Processing WM_CREATE through sciter
            bool handled = false;

            SciterHostApi.SciterProcND(Handle, User32.WM_CREATE, IntPtr.Zero, IntPtr.Zero, ref handled);
            SciterHostApi.SciterSetCallback(Handle, Host);
        }