private async void btn_health_onClicked(object sender, RoutedEventArgs e) { //await UploadFunctions.UploadTemperature(37.8); // await UploadFunctions.UploadHeartbeat(34); DailyDetail detail_dining = new DailyDetail { time = 3, detail = new List <string> { "07:43 - 08:11", "12:10 - 12:42", "17:06 - 17:34" }, comment = "diet condition is good." }; DailyDetail detail_sleep = new DailyDetail { time = 1, detail = new List <string> { "22:10 - 8:31" }, comment = "sleeping time is too long, please develop a health living habit." }; DailyDetail detail_toilet = new DailyDetail { time = 4, detail = new List <string> { "09:43 - 10:21" }, comment = "lavatory condition is abnormal, please pay attention to his/her diet habit, eat more fruit and vegetables." }; DailyDetail detail_parlour = new DailyDetail { time = 2, detail = new List <string> { "08:40 - 09:38", "14:03 - 15:22" }, comment = "parlour condition is good." }; DailyDetail detail_outdoor = new DailyDetail { time = 1, detail = new List <string> { "10:30 - 11:10" }, comment = "Outdoor exercise time is too short, Strongly recommend him/her do more exercises after meals." }; // Util.ObjectToJsonData(detail_dining) string result = await UploadFunctions.UploadDaily(2.7, Util.ObjectToJsonData(detail_dining), 10.2, Util.ObjectToJsonData(detail_sleep), 1.3, Util.ObjectToJsonData(detail_toilet), 8.4, Util.ObjectToJsonData(detail_parlour), 0.7, Util.ObjectToJsonData(detail_outdoor)); // await UploadFunctions.UploadPosition(108.232591096998, 34.5341); //await UploadFunctions.UploadIndoorPosition("C"); // System.Diagnostics.Debug.WriteLine("result:" + result); this.Frame.Navigate(typeof(HealthPage)); }
private async void ShowDetail(string item) { string message = string.Empty; IEnumerable <Daily> allRecords = null; try { allRecords = await Common.GetThisDayDailyRecords(dp_date.Date.ToString("yyyy/MM/dd")); } catch (Exception e) { Debug.WriteLine("PivotPage ShowDetail: " + e.Message); } if (allRecords != null) { foreach (var record in allRecords) { switch (item) { case "detail_dining": //message = "Diet condition \n\n" + "time :\t" + "3" + "\ndetial :"; //message += "\t" + "7:43 - 8:11" + "\n" + "\t" + "12:10 - 12:42" + "\n" + "\t" + "17:06 - 17:34" + "\n\n" + "Comment:diet condition is good."; DailyDetail detail_dining = Util.DataContractJsonDeSerializer <DailyDetail>(record.detail_dining); message = "Diet condition\n\ntime :\t" + detail_dining.time + "\ndetail :"; foreach (var data in detail_dining.detail) { message += "\t" + data + "\n"; } message += "\nComment : " + detail_dining.comment; break; case "detail_sleep": //message = "Sleeping condition \n\n" + "detial :"; //message += "\t" + "22:10 - 6:31\n\n" + "Comment:sleeping condition is good."; DailyDetail detail_sleep = Util.DataContractJsonDeSerializer <DailyDetail>(record.detail_sleep); message = "Sleeping condition\n\ntime :\t" + detail_sleep.time + "\ndetail :"; foreach (var data in detail_sleep.detail) { message += "\t" + data + "\n"; } message += "\nComment : " + detail_sleep.comment; break; case "detail_toilet": //message = "Lavatory condition \n\ntime :\t" + "6"; //message += "\n\n" + "Comment:lavatory condition is normal."; DailyDetail detail_lavatory = Util.DataContractJsonDeSerializer <DailyDetail>(record.detail_toilet); message = "Lavatory condition\n\ntime :\t" + detail_lavatory.time + "\ndetail :"; foreach (var data in detail_lavatory.detail) { message += "\t" + data + "\n"; } message += "\nComment : " + detail_lavatory.comment; break; case "detail_parlour": DailyDetail detail_parlour = Util.DataContractJsonDeSerializer <DailyDetail>(record.detail_parlour); message = "Parlour condition\n\ntime :\t" + detail_parlour.time + "\ndetail :"; foreach (var data in detail_parlour.detail) { message += "\t" + data + "\n"; } message += "\nComment : " + detail_parlour.comment; break; case "detail_outdoor": //message = "Outdoor condition \n\n" + "time :\t" + "2" + "\ndetial :"; //message += "\t" + "9:22-10:10" + "\n" + "\t" + "15:20-16:18" + "\n\n" + "Comment:Strongly recommend him/her do more exercises after meals"; DailyDetail detail_outdoor = Util.DataContractJsonDeSerializer <DailyDetail>(record.detail_outdoor); message = "Outdoor condition\n\ntime :\t" + detail_outdoor.time + "\ndetail :"; foreach (var data in detail_outdoor.detail) { message += "\t" + data + "\n"; } message += "\nComment : " + detail_outdoor.comment; break; } } if (message.Trim() != "") { //使用语音播报 SpeechSynthesizer synthesizer = new SpeechSynthesizer(); SpeechSynthesisStream stream = await synthesizer.SynthesizeTextToStreamAsync(message); me.SetSource(stream, stream.ContentType); me.AutoPlay = true; MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); message = ""; me.AutoPlay = false; } } }