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); } }
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"; }
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); } }
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(); } }
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; } }
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"; } }