Esempio n. 1
0
        public static void PlayerEventListener(XdkPlayerEvent evt)
        {
            try
            {
                HtmlElement log = HtmlElement.GetById("log");
                PrependToLog(log, BuildMessage(evt));
                JsString src_img_play = "";
                switch (evt.type)
                {
                case XdkPlayerEventType.PlayerStationStart:
                case XdkPlayerEventType.PlayerShoutcastStart:
                    src_img_play = "images/Pause.png";
                    boolPlaying  = true;
                    break;

                case XdkPlayerEventType.PlayerStationStop:
                case XdkPlayerEventType.PlayerShoutcastStop:
                    src_img_play = "images/Play.png";
                    boolPlaying  = false;
                    break;

                case XdkPlayerEventType.PlayerStationPause:
                case XdkPlayerEventType.PlayerShoutcastPause:
                    src_img_play = "images/Play.png";
                    boolPaused   = true;
                    break;
                }
                HtmlImageElement.GetById("play").src = src_img_play;
            }
            catch (JsError e)
            {
                Alert("something bad happened in playerEventListener: " + e.message);
            }
        }
Esempio n. 2
0
        public void Init(CameraOptions objOptions)
        {
            Xdk.OnCameraPictureAdd    += OnCamera;
            Xdk.OnCameraPictureBusy   += OnCamera;
            Xdk.OnCameraPictureCancel += OnCamera;

            console.Log("camera object wrapper initialized");

            if (objOptions.inject != null)
            {
                //inject a div to display an image and a camera button
                HtmlDivElement cameraDiv = new HtmlDivElement();
                cameraDiv.id = "cameradiv";
                document.body.AppendChild(cameraDiv);

                HtmlImageElement imgLarge = new HtmlImageElement();
                imgLarge.id            = "largeImage";
                imgLarge.style.display = "none";
                Element.GetById("cameradiv").AppendChild(imgLarge);

                HtmlButtonElement btnCapture = new HtmlButtonElement();
                btnCapture.id        = "btnPicture";
                btnCapture.innerText = "Take Picture";
                Xdk.multitouch.Add(btnCapture, TouchEventType.TouchStart, CapturePhoto);
                Element.GetById("cameradiv").AppendChild(btnCapture);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Gets a suitable image candidate for the provided image element.
        /// </summary>
        /// <param name="img">The element to use.</param>
        /// <returns>The possibly valid URL to the right candidate.</returns>
        public static Url GetImageCandidate(this HtmlImageElement img)
        {
            var owner   = img.Owner;
            var srcset  = new SourceSet(owner);
            var options = owner.Options;
            var sources = img.GetSources();

            while (sources.Count > 0)
            {
                var source = sources.Pop();
                var type   = source.Type;

                if (!String.IsNullOrEmpty(type) && options.GetResourceService <IImageInfo>(type) == null)
                {
                    continue;
                }

                foreach (var candidate in srcset.GetCandidates(source.SourceSet, source.Sizes))
                {
                    return(new Url(img.BaseUrl, candidate));
                }
            }

            foreach (var candidate in srcset.GetCandidates(img.SourceSet, img.Sizes))
            {
                return(new Url(img.BaseUrl, candidate));
            }

            return(Url.Create(img.Source));
        }
Esempio n. 4
0
        public void ImageProperties()
        {
            var image = new HtmlImageElement
            {
                Height = "1",
                Width  = "2"
            };

            Assert.Equal("1", image.Height);
            Assert.Equal("2", image.Width);
        }
Esempio n. 5
0
        public HtmlElement GetPrimaryPresentationNode(DomElement hostNode)
        {
            if (_pnode != null)
            {
                return(_pnode);
            }
            //---------------------------------
            var ownerdoc = (HtmlDocument)hostNode.OwnerDocument;

            _pnode = ownerdoc.CreateHtmlDiv();
            //---------------------------------
            //bar part
            _pnode.AddHtmlDivElement(node_bar =>
            {
                _nodeBar = node_bar;
                node_bar.AddHtmlImageElement(node_icon =>
                {
                    _nodeIcon = node_icon;
                    SetupNodeIconBehaviour(node_icon);
                });
                node_bar.AddHtmlSpanElement(node_span =>
                {
                    _nodeSpan = node_span;
                    if (NodeText != null)
                    {
                        node_span.AddTextContent(NodeText);
                    }
                });
            });
            //---------------------------------
            //content part
            //indent
            _pnode.AddHtmlDivElement(node_body =>
            {
                _nodeBody = node_body;
                node_body.SetStyleAttribute("padding-left:17px");
                node_body.AddHtmlDivElement(node_content =>
                {
                    _nodeContent = node_content;
                    if (_childNodes != null)
                    {
                        _nodeContent.SetStyleAttribute("padding-left:0px");
                        int j = _childNodes.Count;
                        for (int i = 0; i < j; ++i)
                        {
                            var childnode = _childNodes[i].GetPrimaryPresentationNode(_nodeContent);
                            node_content.AddChild(childnode);
                        }
                    }
                });
            });
            return(_pnode);
        }
Esempio n. 6
0
        public static void Initialize()
        {
            PrepareTheBody();

            CreateCanvasElement();

            WindowRenderSize = new Rectangle(0, 0, HtmlContext.window.innerWidth, HtmlContext.window.innerHeight);

            _playerImage     = new HtmlImageElement();
            _playerImage.src = "images/orc.png";
            HtmlContext.document.body.appendChild(_playerImage);

            _characterRenderers = new List <CanvasCharacterRenderer>();

            Resize();
        }
Esempio n. 7
0
 public void ShowPictureList()
 {
     JsArray<JsString> arrPictureList = Xdk.camera.GetPictureList();
     if (arrPictureList.length > 1)
     {
         Xdk.camera.DeletePicture(arrPictureList[0]);
         arrPictureList = Xdk.camera.GetPictureList();
     }
     Element.GetById("largeImage").style.display = "none";
     for (var x = 0; x < arrPictureList.length; x++)
     {
         // create image 
         HtmlImageElement newImage = new HtmlImageElement();
         newImage.src = Xdk.camera.GetPictureUrl(arrPictureList[x]);
         newImage.style.width = "100px";
         newImage.style.height = "100px";
         newImage.id = HtmlImageElement.GetById("img_" + arrPictureList[x]).id;
         document.body.AppendChild(newImage);
     }
 }
Esempio n. 8
0
 public static void PlayButton()
 {
     if (boolPlaying)
     {
         if (boolPaused == false)
         {
             Xdk.player.Pause();
             HtmlImageElement.GetById("play").src = "images/Play.png";
         }
         else
         {
             Xdk.player.Play();
             HtmlImageElement.GetById("play").src = "images/Pause.png";
         }
     }
     else
     {
         //start playing
         Music();
     }
 }
Esempio n. 9
0
        public static void UpdateOrientation(int orientation)
        {
            HtmlImageElement bg     = HtmlImageElement.GetById("bg");
            HtmlImageElement note   = HtmlImageElement.GetById("note");
            HtmlElement      orient = HtmlElement.GetById("orient");

            if (orientation == 0 || orientation == 180)
            {
                bg.src         = "app_bg_port.jpg";
                note.src       = "note_port.png";
                note.style.top = "134px";
            }
            else
            {
                bg.src         = "app_bg_ls.jpg";
                note.src       = "note_ls.png";
                note.style.top = "102px";
            }
            orient.innerHTML = orientation.As <JsString>();
            HtmlElement.GetById("body").style.visibility = "visible";
        }
Esempio n. 10
0
        public void ShowPictureList()
        {
            JsArray <JsString> arrPictureList = Xdk.camera.GetPictureList();

            if (arrPictureList.length > 1)
            {
                Xdk.camera.DeletePicture(arrPictureList[0]);
                arrPictureList = Xdk.camera.GetPictureList();
            }
            Element.GetById("largeImage").style.display = "none";
            for (var x = 0; x < arrPictureList.length; x++)
            {
                // create image
                HtmlImageElement newImage = new HtmlImageElement();
                newImage.src          = Xdk.camera.GetPictureUrl(arrPictureList[x]);
                newImage.style.width  = "100px";
                newImage.style.height = "100px";
                newImage.id           = HtmlImageElement.GetById("img_" + arrPictureList[x]).id;
                document.body.AppendChild(newImage);
            }
        }
Esempio n. 11
0
        public void OnCamera(XdkCameraEvent evt)
        {
            switch (evt.type)
            {
            case XdkCameraEventType.CameraPictureAdd:
                if (evt.success == true)
                {
                    // create image
                    HtmlImageElement largeImage = HtmlImageElement.GetById("largeImage");

                    //show the filename in the console
                    console.Log(evt.filename);

                    //save the image
                    largeImage.src           = Xdk.camera.GetPictureUrl(evt.filename);
                    largeImage.style.width   = "480px";
                    largeImage.style.display = "block";
                }
                else
                {
                    if (evt.message != undefined)
                    {
                        Alert(evt.message);
                    }
                    else
                    {
                        Alert("error taking picture");
                    }
                }
                break;

            case XdkCameraEventType.CameraPictureBusy:
                console.Log("busy");
                break;

            case XdkCameraEventType.CameraPictureCancel:
                console.Log("canceled");
                break;
            }
        }
Esempio n. 12
0
        public static void SetHeightAndWidth()
        {
            HtmlElement      width  = HtmlElement.GetById("width");
            HtmlElement      height = HtmlElement.GetById("height");
            HtmlElement      data   = HtmlElement.GetById("data");
            HtmlElement      note   = HtmlElement.GetById("note");
            HtmlImageElement bg     = HtmlImageElement.GetById("bg");

            width.innerHTML  = window.innerWidth.As <JsString>();
            height.innerHTML = window.innerHeight.As <JsString>();
            data.style.top   = ((window.innerWidth) / 3) + "px";
            note.style.left  = ((window.innerWidth) / 4) + "px";

            //app_bg_ls.jpg is 1446x748, app_bg_ls.jpg is 768x1306
            //check if src ends with 'app_bg_ls.jpg'
            if (new JsRegExp("app_bg_ls.jpg$").Test(bg.src))
            {
                bg.style.left = (((1446 - window.innerWidth) / 2) * -1) + "px";
            }
            else
            {
                bg.style.left = (((768 - window.innerWidth) / 2) * -1) + "px";
            }
        }
 public void DrawImage(HtmlImageElement image, double dx, double dy, double dw, double dh) { }
Esempio n. 14
0
 public void SetDragImage(HtmlImageElement image, int x, int y) { }
Esempio n. 15
0
        public void Init(CameraOptions objOptions)
        {

            Xdk.OnCameraPictureAdd += OnCamera;
            Xdk.OnCameraPictureBusy += OnCamera;
            Xdk.OnCameraPictureCancel += OnCamera;

            console.Log("camera object wrapper initialized");

            if (objOptions.inject != null)
            {
                //inject a div to display an image and a camera button
                HtmlDivElement cameraDiv = new HtmlDivElement();
                cameraDiv.id = "cameradiv";
                document.body.AppendChild(cameraDiv);

                HtmlImageElement imgLarge = new HtmlImageElement();
                imgLarge.id = "largeImage";
                imgLarge.style.display = "none";
                Element.GetById("cameradiv").AppendChild(imgLarge);

                HtmlButtonElement btnCapture = new HtmlButtonElement();
                btnCapture.id = "btnPicture";
                btnCapture.innerText = "Take Picture";
                Xdk.multitouch.Add(btnCapture, TouchEventType.TouchStart, CapturePhoto);
                Element.GetById("cameradiv").AppendChild(btnCapture);
            }
        }
Esempio n. 16
0
 public void DrawImage(HtmlImageElement image, double dx, double dy, double dw, double dh)
 {
 }
Esempio n. 17
0
 public CanvasPattern CreatePattern(HtmlImageElement image, JsString repetitionType)
 {
     return(default(CanvasPattern));
 }
 public CanvasPattern CreatePattern(HtmlImageElement image, JsString repetitionType) { return default(CanvasPattern); }
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) { }
Esempio n. 20
0
        //
        public DomElement GetPresentationDomNode(DomElement hostNode)
        {
            if (_pnode != null)
            {
                return(_pnode);
            }
            //-----------------------------------
            var doc = (HtmlDocument)hostNode.OwnerDocument;

            _pnode = doc.CreateHtmlDiv();
            _pnode.AddHtmlImageElement(item_icon =>
            {
                _menuIcon = item_icon;
                _menuIcon.AttachMouseDownEvent(e =>
                {
                    //****
                    this.MaintainParentOpenState();
                    if (this.IsOpened)
                    {
                        this.Close();
                    }
                    else
                    {
                        this.Open();
                    }
                    e.StopPropagation();
                });
                _menuIcon.AttachMouseUpEvent(e =>
                {
                    this.UnmaintenanceParentOpenState();
                    e.StopPropagation();
                });
                _menuIcon.AttachEvent(UI.UIEventName.MouseLostFocus, e =>
                {
                    if (!this.MaintainOpenState)
                    {
                        this.CloseRecursiveUp();
                    }
                });
            });
            _pnode.AddHtmlSpanElement(content =>
            {
                if (MenuItemText != null)
                {
                    _pnode.AddTextContent(this.MenuItemText);
                }
            });
            //--------------------------------------------------------
            //create simple menu item box

            if (_childItems != null)
            {
                _floatPart = new MenuBox(200, 200);
                int j = _childItems.Count;
                for (int i = 0; i < j; ++i)
                {
                    _floatPart.AddChildBox(_childItems[i]);
                }
            }
            return(_pnode);
        }
 public void TexSubImage2D(int target, int level, int xoffset, int yoffset, int format, int type, HtmlImageElement image)
 {
 }
Esempio n. 22
0
 public void DrawImageFromRect(HtmlImageElement image)
 {
 }
Esempio n. 23
0
 public void TexSubImage2D(int target, int level, int xoffset, int yoffset, int format, int type, HtmlImageElement image) { }
Esempio n. 24
0
 public void TexImage2D(int target, int level, int internalformat, int format, int type, HtmlImageElement image) { }
Esempio n. 25
0
 public void SetDragImage(HtmlImageElement image, int x, int y)
 {
 }
 public void DrawImageFromRect(HtmlImageElement image) { }
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw) { }
 public void TexImage2D(int target, int level, int internalformat, int format, int type, HtmlImageElement image)
 {
 }
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh, JsString compositeOperation) { }
Esempio n. 30
0
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
 {
 }
Esempio n. 31
0
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw)
 {
 }
Esempio n. 32
0
 public void DrawImageFromRect(HtmlImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh, JsString compositeOperation)
 {
 }