예제 #1
0
파일: Application.cs 프로젝트: zggl/tchapp
        /// <summary>
        /// 启动web解析和渲染
        /// </summary>
        /// <param name="url">初始url,tch默认内部域名为:tchapp.localhost,eg:http://tchapp.localhost/ui/index.html or ui/index.html or /ui/index.html</param>
        /// <param name="start_position">窗口是启动位置,参看枚举:TchAppStartPosition</param>
        /// <param name="width">窗口初始宽度</param>
        /// <param name="height">窗口初始高度</param>
        /// <param name="border_width">窗口边框大小</param>
        /// <param name="x">窗口初始x坐标</param>
        /// <param name="y">窗口初始y坐标</param>
        /// <returns>无措返回0</returns>
        public int Run(string url, int width = 800, int height = 600, TchAppStartPosition start_position = TchAppStartPosition.CenterScreen, int x = 0, int y = 0)
        {
            TchAppStartSettings start_settings = new TchAppStartSettings();

            start_settings.Url           = url;
            start_settings.StartPosition = start_position;
            start_settings.X             = x;
            start_settings.Y             = y;
            start_settings.Width         = width;
            start_settings.Height        = height;
            int exit_code = Run(start_settings);

            return(exit_code);
        }
예제 #2
0
        public int Run(TchAppStartSettings start_settings)
        {
            string url = start_settings.Url;
            Uri    result;

            if (!Uri.TryCreate(url, UriKind.Absolute, out result))
            {
                if (!Uri.TryCreate($"http://{this.TchAppDomainName}/{url}", UriKind.Absolute, out result))
                {
                    if (!Uri.TryCreate($"http://{this.TchAppDomainName}{url}", UriKind.Absolute, out result))
                    {
                        throw new ArgumentException($"[{url}] is bad url.");
                    }
                }
            }
            start_settings.Url = result.AbsoluteUri;
            int exit_code = TchStart(start_settings);

            return(exit_code);
        }
예제 #3
0
 extern static int TchStart(TchAppStartSettings start_settings);