예제 #1
0
        public ClientTansport(string url, string query, bool fileupload)
        {
            Url          = url + "?" + query;
            Descriptor   = new MyTransportDescriptor <TType>();
            Worker.Tick += new System.Action <Timer>(Worker_Tick);

            if (fileupload)
            {
                IHTMLElement template = Native.Document.getElementById(Helper.FormTemplateID);

                if (template == null)
                {
                    throw new System.Exception("form template not found");
                }

                Form        = (IHTMLForm)template.cloneNode(false);
                Form.action = Url;
                Form.appendChild(new IHTMLElement());
                FormHiddenChild.style.display = IStyle.DisplayEnum.none;

                Descriptor.Callback = Expando.GetUniqueID("callback");
                Expando.ExportCallback <string>(Descriptor.Callback, Callback);
                ResetCallbackFrame();
            }
            else
            {
                Request = new IXMLHttpRequest();
            }
        }