예제 #1
0
        private void DownloadNow()
        {
            // Import the file now, and ensure StyleSheet.ownerNode is set.

            string url = href;

            if (ParentSheet != null && ParentSheet.Location != null)
            {
                // Make relative now:
                url = (new Dom.Location(url, ParentSheet.Location)).absoluteNoHash;
            }

            // Create a style sheet:
            ImportedSheet           = new Css.StyleSheet(ParentSheet.ownerNode);
            ImportedSheet.ownerRule = this;

            // Priority is at least that of its parent:
            ImportedSheet.Priority = ParentSheet == null? 1 : ParentSheet.Priority;

            // Load the file now:
            DataPackage package = new DataPackage(url, ParentSheet.document.basepath);

            package.onload = delegate(UIEvent e){
                // Load it now:
                ImportedSheet.ParseCss(package.responseText);

                // Redraw:
                ParentSheet.document.RequestLayout();
            };

            // Get now:
            package.send();
        }