Exemple #1
0
        // A dynamic script call handler. Any call in TIScript to function 'view.Host_HelloWorld()' with invoke this method
        // Notice that signature of these handlers is always the same
        // (Hint: install OmniCode snippets which adds the 'ssh' snippet to C# editor so you can easily declare 'Siter Handler' methods)
        // (see: https://github.com/MISoftware/OmniCode-Snippets)
        public bool Host_HelloSciter(SciterElement el, SciterValue[] args, out SciterValue result)
        {
            var stackFrame = new StackTrace(true).GetFrame(0);            //.GetFileName();

            result = SciterValue.Create($"<h2>Hello Sciter from C#!</h2><code>Method: {stackFrame.GetMethod().Name}<br/>File: <a href=\"{new Uri(stackFrame.GetFileName()).AbsoluteUri}\">{Path.GetFileName(stackFrame.GetFileName())}</a><br/>Line: {stackFrame.GetFileLineNumber()}<br/>Column: {stackFrame.GetFileColumnNumber()}</code>");
            return(true);
        }
        private static SciterCore.Interop.SciterValue.VALUE GetValueOrDefault(this SciterValue value)
        {
            if (value != null)
            {
                return(value.ToVALUE());
            }

            Sciter.SciterApi.ValueInit(out var @default);
            return(@default);
        }