} //contactRequest public String[] getUserDeets(String token) { Console.WriteLine("into the belly of it m8"); String output = httpRequest(token, "https://www.yammer.com/api/v1/users/current.json"); Console.WriteLine("we dun it now"); if (output != "") { //JSONArray jObject = new JSONArray (output); // json String[] details; JSONObject data, tmp; //String[] items; String uid, fname, lname, email, phone = "", org, profilepicture; //maybe use less memory because im using heaps apparently data = new JSONObject(output); // get data object uid = data.GetString("id"); fname = data.GetString("first_name"); lname = data.GetString("last_name"); email = data.GetString("email"); profilepicture = data.GetString("mugshot_url_template"); profilepicture = profilepicture.Replace("{width}x{height}", "300x300"); tmp = data.GetJSONObject("contact"); phone = tmp.GetString("phone_numbers"); try { tmp = new JSONArray(phone).GetJSONObject(0); phone = tmp.GetString("number"); } catch { phone = ""; } org = data.GetString("network_name"); details = new String[] { fname, lname, email, phone, org, uid, profilepicture }; tmp.Dispose(); data.Dispose(); fname = ""; lname = ""; email = ""; phone = ""; org = ""; uid = ""; profilepicture = ""; //jObject.Dispose (); return(details); } String[] gg = null; return(gg); } //getuserdeets
/// <summary> /// 节目控制 /// </summary> public void ProgramControl() { // 读取配置文件 JSONObject jsonConfig = ReadConfig(); if (jsonConfig != null) { // 正在载入节目 RunOnUiThread(() => { Toast.MakeText(this, "正在载入节目...", ToastLength.Long).Show(); }); Settings.RuntimeLog.Info("正在载入节目..."); bIsProgramLoop = true; } else { return; } // 节目循环 using (JSONObject program = jsonConfig.OptJSONObject("program")) using (JSONArray resources = program.OptJSONArray("resources")) { int i = -1, nLength = resources.Length(); while (bIsProgramLoop) { i = (i + 1) % nLength; // 资源循环 CActivityManager.GetInstence().FinishSingleActivityByType(typeof(VideoViewActivity)); // 关闭视频播放 CActivityManager.GetInstence().FinishSingleActivityByType(typeof(ImageViewActivity)); // 关闭图片播放 if (!bIsProgramLoop) { // 重新载入节目 RunOnUiThread(() => { Toast.MakeText(this, "重新载入节目...", ToastLength.Long).Show(); }); Settings.RuntimeLog.Info("重新载入节目..."); break; } System.Threading.Thread.Sleep(50); string name, type, md5, url, duration; using (JSONObject resource = resources.GetJSONObject(i)) { name = resource.OptString("name"); type = resource.OptString("type"); md5 = resource.OptString("md5"); url = resource.OptString("url"); duration = resource.OptString("duration"); } if (type == "video") { // 播放视频 RunOnUiThread(() => { using (Intent intentVideo = new Intent(this, typeof(VideoViewActivity))) { intentVideo.PutExtra("uri", Settings.AppPath + "/" + type + "/" + name); StartActivity(intentVideo); } }); Settings.semVideoCompleted.WaitOne(); // 等待视频结束 } else if (type == "image") { // 播放图片 RunOnUiThread(() => { using (Intent intentImage = new Intent(this, typeof(SrcActivity.ImageViewActivity))) { intentImage.PutExtra("uri", Settings.AppPath + "/" + type + "/" + name); StartActivity(intentImage); } }); int nDuration = int.Parse(duration) + 1; // 图片播放时间 System.Threading.Thread.Sleep(nDuration * 1000); } else { // other type } } } if (jsonConfig != null) { jsonConfig.Dispose(); jsonConfig = null; } }