Example #1
0
        private void demoListViewRefresh_Load(object sender, EventArgs e)
        {
            //配合LocalHtml使用,生成文件
            var localHtmlPath = Path.Combine(MobileResourceManager.DefaultWebStaticPath, "demo.html");

            if (File.Exists(localHtmlPath) == false)
            {
                using (FileStream stream = File.Create(localHtmlPath))
                {
                    string demoHtml = "<Html><Head></Head><Body>Hello LocalHtml</Body></Html>";
                    byte[] demoData = System.Text.Encoding.UTF8.GetBytes(demoHtml);
                    stream.Write(demoData, 0, demoData.Length);
                    stream.Close();
                }
            }

            //配合Dynamic使用
            if (MobileServer.IsRegisterHttpHandler("dynamic") == false)
            {
                MobileServer.RegisterHttpHandler("dynamic", new DynamicHttpContentHandler());
            }
        }
 static demoCustomHttpResource()
 {
     //在此处,注册的为url地址
     MobileServer.RegisterHttpHandler(resourceUrl, new HttpCustomHttpResourceHandler());
 }