/// <summary> /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { try { //user AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); } catch (JsError e) { } try { //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); } catch (JsError e) { } try { //manage power Xdk.device.ManagePower(true, false); } catch (JsError e) { } //hide splash screen Xdk.device.HideSplashScreen(); }
/// <summary> /// This function will add this device to the push messaging system the first time it runs on a device /// </summary> /// <param name="evt"></param> public static void RegisterForMessages(XdkDeviceEvent evt) { //Get the unique identifier of this device JsString myUserID = Xdk.device.uuid; //Register the appMobi.notification.push.enable event Xdk.OnNotificationPushEnable += NotificationsRegistered; //If this device is already registered, just check for new notifications if (Xdk.cache.GetCookie("username").ExactEquals(undefined)) { try { //unremark this code to register this application for push messages JsString chosenUsername = Prompt("Choose a username for push messaging", Xdk.device.uuid); JsString chosenPassword = Prompt("Choose a password for push messaging", "password"); JsString chosenEmail = Prompt("Enter an email address for account confirmation", ""); Xdk.cache.SetCookie("username", chosenUsername); Xdk.cache.SetCookie("password", chosenPassword); Xdk.cache.SetCookie("email", chosenEmail); Xdk.notification.AddPushUser(chosenUsername, chosenPassword, chosenEmail); } catch (JsError e) { Alert("error adding push user: "******"username"), Xdk.cache.GetCookie("password")); } }
/// <summary> /// This function will add this device to the push messaging system the first time it runs on a device /// </summary> /// <param name="evt"></param> public static void RegisterForMessages(XdkDeviceEvent evt) { //Get the unique identifier of this device JsString myUserID = Xdk.device.uuid; //Register the appMobi.notification.push.enable event Xdk.OnNotificationPushEnable += NotificationsRegistered; //If this device is already registered, just check for new notifications if (Xdk.cache.GetCookie("username").ExactEquals(undefined)) { try { //unremark this code to register this application for push messages JsString chosenUsername = Prompt("Choose a username for push messaging", Xdk.device.uuid); JsString chosenPassword = Prompt("Choose a password for push messaging", "password"); JsString chosenEmail = Prompt("Enter an email address for account confirmation", ""); Xdk.cache.SetCookie("username", chosenUsername); Xdk.cache.SetCookie("password", chosenPassword); Xdk.cache.SetCookie("email", chosenEmail); Xdk.notification.AddPushUser(chosenUsername, chosenPassword, chosenEmail); } catch (JsError e) { Alert("error adding push user: "******"username"), Xdk.cache.GetCookie("password")); } }
/// <summary> /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { try { //user AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); } catch (JsError e) { } try { //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); } catch (JsError e) { } try { //manage power Xdk.device.ManagePower(true, false); } catch (JsError e) { } //hide splash screen Xdk.device.HideSplashScreen(); }
/* OVER THE AIR UPDATE CODE */ static void UpdateAvailable(XdkDeviceEvent evt) { if (evt.type == XdkDeviceEventType.DeviceUpdateAvailable) { //there is an update available *while* the application is running - just warn the user WarnUpdateAvailable(evt.updateMessage); } }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi.display.viewport to size the application to the appropriate width regardless of the device used Xdk.display.UseViewport(768, 1024); //once the sizing is done, make the HTML body visible HtmlElement.GetById("bodyTag").style.visibility = "visible"; //use AppMobi.device.setRotateOrientation to rotate the application to a certain orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); //use AppMobi.device.setAutoRotate to lock the rotation Xdk.device.SetAutoRotate(false); //use AppMobi.device.managePower to keep the device from shutting off unexpectedly Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); /* OVER THE AIR UPDATE CODE*/ if (Xdk.cache.GetCookie("applicationVersion") == null) { //this is the initial installation Xdk.cache.SetCookie("applicationVersion", applicationVersion, -1); } else { //the current application version is different from the previous one int previousVersion = ConvertStringToNumber(Xdk.cache.GetCookie("applicationVersion")); if (previousVersion < applicationVersion) { //the previous version is lower than the application version installed with this code Xdk.notification.Alert("Application Updated Successfully"); //save the cookie for the next time the application starts Xdk.cache.SetCookie("applicationVersion", applicationVersion, -1); } } //appMobi.updateAvailable indicates whether or not an over the air update is available or not. if (Xdk.updateAvailable == true) { //there is an application update available at startup DoUpdateAvailable(Xdk.updateMessage); } }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi.display.viewport to size the application to the appropriate width regardless of the device used Xdk.display.UseViewport(768, 1024); //once the sizing is done, make the HTML body visible HtmlElement.GetById("bodyTag").style.visibility = "visible"; //use AppMobi.device.setRotateOrientation to rotate the application to a certain orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); //use AppMobi.device.setAutoRotate to lock the rotation Xdk.device.SetAutoRotate(false); //use AppMobi.device.managePower to keep the device from shutting off unexpectedly Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); /* OVER THE AIR UPDATE CODE*/ if (Xdk.cache.GetCookie("applicationVersion") == null) { //this is the initial installation Xdk.cache.SetCookie("applicationVersion", applicationVersion, -1); } else { //the current application version is different from the previous one int previousVersion = ConvertStringToNumber(Xdk.cache.GetCookie("applicationVersion")); if (previousVersion < applicationVersion) { //the previous version is lower than the application version installed with this code Xdk.notification.Alert("Application Updated Successfully"); //save the cookie for the next time the application starts Xdk.cache.SetCookie("applicationVersion", applicationVersion, -1); } } //appMobi.updateAvailable indicates whether or not an over the air update is available or not. if (Xdk.updateAvailable == true) { //there is an application update available at startup DoUpdateAvailable(Xdk.updateMessage); } }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(768, 1024); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(768, 1024); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); }
public static void DeviceReadyTestForUpdate(XdkDeviceEvent evt) { /* appMobi.updateAvailable indicates whether or not an over the air update is available or not. */ if (Xdk.updateAvailable == true) { //there is an application update available at startup if (Confirm(Xdk.updateMessage) == true) { UpdateApplication(); } else { UpdateApplicationLater(); } } }
public static void BackgroundListener(XdkDeviceEvent evt) { try { HtmlElement log = HtmlElement.GetById("log"); PrependToLog(log, BuildMessage(evt)); if (evt.type == XdkDeviceEventType.DeviceResume) { PrependToLog(log, "lastPlaying: " + Xdk.device.lastPlaying); } } catch (JsError e) { Alert("something bad happened in playerEventListener: " + e.message); } }
public static void DeviceReadyTestForUpdate(XdkDeviceEvent evt) { /* appMobi.updateAvailable indicates whether or not an over the air update is available or not. */ if (Xdk.updateAvailable == true) { //there is an application update available at startup if (Confirm(Xdk.updateMessage) == true) { UpdateApplication(); } else { UpdateApplicationLater(); } } }
/// <summary> /// This event handler captures the event thrown when an update becomes available while an application is running /// </summary> /// <param name="evt"></param> public static void UpdateAvailable(XdkDeviceEvent evt) { /* test to see if the event is appMobi.device.update.available */ if (evt.type == XdkDeviceEventType.DeviceUpdateAvailable) { /* there is an update available *while* the application is running - decide what to do */ if (Confirm(evt.updateMessage) == true) { UpdateApplication(); } else { UpdateApplicationLater(); } } }
/// <summary> /// This event handler captures the event thrown when an update becomes available while an application is running /// </summary> /// <param name="evt"></param> public static void UpdateAvailable(XdkDeviceEvent evt) { /* test to see if the event is appMobi.device.update.available */ if (evt.type == XdkDeviceEventType.DeviceUpdateAvailable) { /* there is an update available *while* the application is running - decide what to do */ if (Confirm(evt.updateMessage) == true) { UpdateApplication(); } else { UpdateApplicationLater(); } } }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void OnDeviceReady(XdkDeviceEvent evt) { UpdateOrientation(Xdk.device.initialOrientation); Xdk.OnDeviceReady -= OnDeviceReady; if (Xdk.device.platform == XdkDevicePlatformType.Android) { Xdk.display.UseViewport(768, 1446); } else { Xdk.display.UseViewport(768, 1024); } SetHeightAndWidth(); HtmlElement.GetById("body").style.visibility = "visible"; //hide splash screen Xdk.device.HideSplashScreen(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// </summary> /// <returns></returns> public static void DeviceReady(XdkDeviceEvent evt) { //user AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //any app-specific initialization InitApp(); //hide splash screen Xdk.device.HideSplashScreen(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// </summary> /// <returns></returns> public static void DeviceReady(XdkDeviceEvent evt) { //user AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //any app-specific initialization InitApp(); //hide splash screen Xdk.device.HideSplashScreen(); }
public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport int landscapewidth = 1360; Xdk.display.UseViewport(portrait_width, landscapewidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); WatchAccel(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { try { //use AppMobi viewport Xdk.display.UseViewport(320, 480); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); } catch (JsError e) { Alert(e.message); } JsString platform_suffix = Xdk.device.platform == XdkDevicePlatformType.Android ? "ANDROID" : ""; arrFonts["ActionManRegular" + platform_suffix] = "Action Man"; arrFonts["KitchenpoliceRegular" + platform_suffix] = "Kitchenpolice"; arrFonts["ComfortaaRegular" + platform_suffix] = "Comfortaa"; arrFonts["ProclamateLightLight" + platform_suffix] = "Proclamate Light"; arrFonts["Furore" + platform_suffix] = "Furore"; arrFonts["Letritista" + platform_suffix] = "Letritista"; arrFonts["AnagramRegular" + platform_suffix] = "Anagram"; arrFonts["CaslonCalligraphicInitialsReg" + platform_suffix] = "Caslon Calligraphic Initials"; arrFonts["DeStencilNFRegular" + platform_suffix] = "DeStencil NF"; arrFonts["KingthingsWroteRegular" + platform_suffix] = "Kingthings Wrote"; arrFonts["KulminoituvaRegular" + platform_suffix] = "Kulminoituva"; arrFonts["NervousRexRegular" + platform_suffix] = "Nervous Rex"; arrFonts["NotethisRegular" + platform_suffix] = "Notethis"; arrFonts["ProFontWindowsRegular" + platform_suffix] = "Pro Font Windows"; arrFonts["RieslingRegular" + platform_suffix] = "Riseling"; arrFonts["UpperEastSideRegular" + platform_suffix] = "Upper East Side"; arrFonts["VeggieburgerRegular" + platform_suffix] = "Veggieburger"; foreach (JsString i in arrFonts) { HtmlElement.GetById("ddFonts").innerHTML += "<option value='" + i + "'>" + arrFonts[i] + "</option>"; } //show splash screen Xdk.device.HideSplashScreen(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void DeviceReady(XdkDeviceEvent evt) { try { //use AppMobi viewport Xdk.display.UseViewport(320, 480); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); } catch (JsError e) { Alert(e.message); } JsString platform_suffix = Xdk.device.platform == XdkDevicePlatformType.Android ? "ANDROID" : ""; arrFonts["ActionManRegular" + platform_suffix] = "Action Man"; arrFonts["KitchenpoliceRegular" + platform_suffix] = "Kitchenpolice"; arrFonts["ComfortaaRegular" + platform_suffix] = "Comfortaa"; arrFonts["ProclamateLightLight" + platform_suffix] = "Proclamate Light"; arrFonts["Furore" + platform_suffix] = "Furore"; arrFonts["Letritista" + platform_suffix] = "Letritista"; arrFonts["AnagramRegular" + platform_suffix] = "Anagram"; arrFonts["CaslonCalligraphicInitialsReg" + platform_suffix] = "Caslon Calligraphic Initials"; arrFonts["DeStencilNFRegular" + platform_suffix] = "DeStencil NF"; arrFonts["KingthingsWroteRegular" + platform_suffix] = "Kingthings Wrote"; arrFonts["KulminoituvaRegular" + platform_suffix] = "Kulminoituva"; arrFonts["NervousRexRegular" + platform_suffix] = "Nervous Rex"; arrFonts["NotethisRegular" + platform_suffix] = "Notethis"; arrFonts["ProFontWindowsRegular" + platform_suffix] = "Pro Font Windows"; arrFonts["RieslingRegular" + platform_suffix] = "Riseling"; arrFonts["UpperEastSideRegular" + platform_suffix] = "Upper East Side"; arrFonts["VeggieburgerRegular" + platform_suffix] = "Veggieburger"; foreach (JsString i in arrFonts) { HtmlElement.GetById("ddFonts").innerHTML += "<option value='" + i + "'>" + arrFonts[i] + "</option>"; } //show splash screen Xdk.device.HideSplashScreen(); }
public static void DeviceReadyListener(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(320, 480); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); SetVolume(100); if (Xdk.device.platform == XdkDevicePlatformType.Android) { //fix the font on Android devices HtmlElement.GetById("log").style.fontFamily = "EurostileANDROID"; HtmlElement.GetById("trackInfo").style.fontFamily = "EurostileANDROID"; HtmlElement.GetById("volume").style.fontFamily = "EurostileANDROID"; } //hide splash screen Xdk.device.HideSplashScreen(); }
public static void BackgroundListener(XdkDeviceEvent evt) { try { HtmlElement log = HtmlElement.GetById("log"); PrependToLog(log, BuildMessage(evt)); if (evt.type == XdkDeviceEventType.DeviceResume) { PrependToLog(log, "lastPlaying: " + Xdk.device.lastPlaying); } } catch (JsError e) { Alert("something bad happened in playerEventListener: " + e.message); } }
public static void OnOrientation(XdkDeviceEvent evt) { HtmlElement.GetById("body").style.visibility = "hidden"; UpdateOrientation(evt.orientation); HtmlElement.GetById("orient").innerHTML = evt.orientation.As<JsString>(); }
/// <summary> /// This event handler is fired once the AppMobi libraries are ready /// AppMobi is ready to roll /// </summary> /// <param name="evt"></param> public static void OnDeviceReady(XdkDeviceEvent evt) { UpdateOrientation(Xdk.device.initialOrientation); Xdk.OnDeviceReady -= OnDeviceReady; if (Xdk.device.platform == XdkDevicePlatformType.Android) { Xdk.display.UseViewport(768, 1446); } else { Xdk.display.UseViewport(768, 1024); } SetHeightAndWidth(); HtmlElement.GetById("body").style.visibility = "visible"; //hide splash screen Xdk.device.HideSplashScreen(); }
//*** Device Ready Code ******************* //This event handler is fired once the AppMobi libraries are ready public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); try { //for playing podcasts Xdk.OnPlayerAudioStop += OnPodcastComplete; Xdk.OnPlayerAudioError += OnPodcastError; } catch (JsError e) { } //hide splash screen Xdk.device.HideSplashScreen(); if (Xdk.device.appmobiVersion != "3.2.4") { Xdk.device.GetRemoteData(podcastRSSURL, GetPost.GET, "", "DataLoaded", "DataFailed"); } else { //********* Use XMLHTTP on an error *************** try { XMLHttpRequest xmlhttp = new XMLHttpRequest(); // instantiate it xmlhttp.OnReadyStateChange += delegate(XMLHttpRequestEvent evt_delegate) { if (xmlhttp.readyState == XMLHttpRequestState.DONE) { if (xmlhttp.status == 200 || xmlhttp.responseText != "") { //XML file read, now parse it DataLoaded(xmlhttp.responseText); } } }; try { xmlhttp.Open(GetPost.GET, podcastRSSURL); // open server interface } catch (JsError err) { Alert("XMLHttpRequest.open() failed.\n" + err.message + " \n URL : " + podcastRSSURL); //Permission Denied return; } xmlhttp.Send(@null as JsString); } catch (JsError err) { Alert("Error initializing XMLHttpRequest.\n" + err); // show error } //*************************************** } }
/* OVER THE AIR UPDATE CODE */ static void UpdateAvailable(XdkDeviceEvent evt) { if (evt.type == XdkDeviceEventType.DeviceUpdateAvailable) { //there is an update available *while* the application is running - just warn the user WarnUpdateAvailable(evt.updateMessage); } }
public static void OnOrientation(XdkDeviceEvent evt) { HtmlElement.GetById("body").style.visibility = "hidden"; UpdateOrientation(evt.orientation); HtmlElement.GetById("orient").innerHTML = evt.orientation.As <JsString>(); }
public static void DeviceReadyListener(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(320, 480); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); SetVolume(100); if (Xdk.device.platform == XdkDevicePlatformType.Android) { //fix the font on Android devices HtmlElement.GetById("log").style.fontFamily = "EurostileANDROID"; HtmlElement.GetById("trackInfo").style.fontFamily = "EurostileANDROID"; HtmlElement.GetById("volume").style.fontFamily = "EurostileANDROID"; } //hide splash screen Xdk.device.HideSplashScreen(); }
public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport int landscapewidth = 1360; Xdk.display.UseViewport(portrait_width, landscapewidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); //hide splash screen Xdk.device.HideSplashScreen(); WatchAccel(); }
//*** Device Ready Code ******************* //This event handler is fired once the AppMobi libraries are ready public static void DeviceReady(XdkDeviceEvent evt) { //use AppMobi viewport Xdk.display.UseViewport(iPortraitWidth, iLandscapeWidth); //lock orientation Xdk.device.SetRotateOrientation(XdkDeviceOrientation.Portrait); Xdk.device.SetAutoRotate(false); //manage power Xdk.device.ManagePower(true, false); try { //for playing podcasts Xdk.OnPlayerAudioStop += OnPodcastComplete; Xdk.OnPlayerAudioError += OnPodcastError; } catch (JsError e) { } //hide splash screen Xdk.device.HideSplashScreen(); if (Xdk.device.appmobiVersion != "3.2.4") { Xdk.device.GetRemoteData(podcastRSSURL, GetPost.GET, "", "DataLoaded", "DataFailed"); } else { //********* Use XMLHTTP on an error *************** try { XMLHttpRequest xmlhttp = new XMLHttpRequest(); // instantiate it xmlhttp.OnReadyStateChange += delegate(XMLHttpRequestEvent evt_delegate) { if (xmlhttp.readyState == XMLHttpRequestState.DONE) { if (xmlhttp.status == 200 || xmlhttp.responseText != "") { //XML file read, now parse it DataLoaded(xmlhttp.responseText); } } }; try { xmlhttp.Open(GetPost.GET, podcastRSSURL); // open server interface } catch (JsError err) { Alert("XMLHttpRequest.open() failed.\n" + err.message + " \n URL : " + podcastRSSURL); //Permission Denied return; } xmlhttp.Send(@null as JsString); } catch (JsError err) { Alert("Error initializing XMLHttpRequest.\n" + err); // show error } //*************************************** } }