private void InitInput() { Windows.Storage.ApplicationDataCompositeValue composite = LocalSettingsHelper.GetAccount(); if (composite != null) { usernameInput.Text = (string)composite[LocalSettingsHelper.KEY_USERNAME]; passwordInput.Password = (string)composite[LocalSettingsHelper.KEY_PASSWORD]; } }
public static async Task <string> UploadRequestBindRelationInfo(string parentname) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("parentname", parentname); return(await conn.SendPostRequest(ConnectServer.URL_REQUESTBINDRELATION, dic_param)); }
public static async Task <string> UploadSleepInfo(string action) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("action", action); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADSLEEP, dic_param)); }
private void InitRadioBtn() { if (LocalSettingsHelper.GetBoolStatus(LocalSettingsHelper.KEY_ROLE)) { rb_elder.IsChecked = true; } else { rb_children.IsChecked = true; } }
public static async Task <string> UploadIndoorPosition(string room) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("room", room); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADINDOORPOSITION, dic_param)); }
public static async Task <string> UploadTemperature(double temperature) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("temperature", temperature.ToString()); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADTEMPERATURE, dic_param)); }
public static async Task <string> UploadHeartbeat(int beat) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("beat", beat.ToString()); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADHEARTBEAT, dic_param)); }
public static async Task <string> UploadPosition(double longitude, double latitude) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("longitude", longitude.ToString()); dic_param.Add("latitude", latitude.ToString()); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADPOSITION, dic_param)); }
private async void onNoClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args) { string username = LocalSettingsHelper.GetUsername(); if (username != null) { await UploadFunctions.UploadBindRelationInfo(username, childname, "no"); } else { MessageDialog dialog = new MessageDialog("Null Username!"); await dialog.ShowAsync(); } }
private async void abb_signin_onClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { SaveUserInfo(); if (rb_elder.IsChecked == true) { LocalSettingsHelper.SetBoolStatus(LocalSettingsHelper.KEY_ROLE, true); } else { LocalSettingsHelper.SetBoolStatus(LocalSettingsHelper.KEY_ROLE, false); } //Button btn = sender as Button; //向布局中添加控件 //Button jj = new Button(); //jj.Content = "fasdf"; //uu.Children.Add(jj); disablePanel(); PopupLoading.IsOpen = true; //显示进度条 // loadingPanel.Visibility = Windows.UI.Xaml.Visibility.Visible; string result = await SignIn(); if (result.Equals("succeed")) { LocalSettingsHelper.SetBoolStatus(LocalSettingsHelper.KEY_SIGNIN, true); InitPush(); } else { if (result != "") { MessageDialog message = new MessageDialog(result); await message.ShowAsync(); } } // loadingPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed; this.PopupLoading.IsOpen = false; enablePanel(); ////构建参数 //ValueSet p = new ValueSet(); //p["name"] = account; //p["city"] = password; //导航到目标页 //并传递参数 // this.Frame.Navigate(typeof(SecondPage), p); }
private async void initDailyPieChartData() { try { //设置日期控件日期 MainPage.notification.Date_DP = LocalSettingsHelper.GetDPDate(); // 获取饼图记录 IEnumerable <PieChartDataItem> allRecords = await Common.GetPieRecords(); if (allRecords != null) { foreach (var record in allRecords) { PieChartDataItem data = new PieChartDataItem { title = record.title, value = record.value }; MainPage.notification.Data_pie_daily.Add(data); switch (record.title) { case "dining": MainPage.notification.Text_dining = record.value.ToString(); break; case "sleep": MainPage.notification.Text_sleep = record.value.ToString(); break; case "toilet": MainPage.notification.Text_toilet = record.value.ToString(); break; case "parlour": MainPage.notification.Text_parlour = record.value.ToString(); break; case "outdoor": MainPage.notification.Text_outdoor = record.value.ToString(); break; } } } } catch (Exception e) { Debug.WriteLine("InitDaily: " + e.Message); } }
private async void abb_signup_onClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { SaveUserInfo(); //Button btn = sender as Button; disablePanel(); this.PopupLoading.IsOpen = true; //显示进度条 // loadingPanel.Visibility = Windows.UI.Xaml.Visibility.Visible; string result = await SignUp(); if (result.Equals("succeed")) { LocalSettingsHelper.SetBoolStatus(LocalSettingsHelper.KEY_SIGNIN, true); } MessageDialog message = new MessageDialog(result); await message.ShowAsync(); // loadingPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed; this.PopupLoading.IsOpen = false; enablePanel(); }
private async void InitPush() { if (LocalSettingsHelper.GetBoolStatus(LocalSettingsHelper.KEY_SIGNIN)) { if (usernameInput.Text.Trim() != "") { string result = await notification.openNotificationService(usernameInput.Text); if (result != null && result.Equals("succeed")) { if (LocalSettingsHelper.GetBoolStatus(LocalSettingsHelper.KEY_ROLE)) { this.Frame.Navigate(typeof(ElderPage)); } else { this.Frame.Navigate(typeof(PivotPage)); } } } } }
public static async Task <string> UploadRemind(string message) { string role = ""; if (LocalSettingsHelper.GetBoolStatus(LocalSettingsHelper.KEY_ROLE)) { role = "parent"; } else { role = "child"; } ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); dic_param.Add("time", DateTime.Now.ToString()); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("role", role); dic_param.Add("message", message); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADREMIND, dic_param)); }
public static async Task <string> UploadDaily(double dining, string detail_dining, double sleep, string detail_sleep, double toilet, string detail_toilet, double parlour, string detail_parlour, double outdoor, string detail_outdoor) { ConnectServer conn = new ConnectServer(); //将post使用的参数加入字典 Dictionary <string, string> dic_param = new Dictionary <string, string>(); // dic_param.Add("date", DateTime.Now.Date.ToString("yyyy/MM/dd")); dic_param.Add("date", DateTime.Now.Date.ToString("2016/04/25")); //dic_param.Add("date", "2016/02/18"); dic_param.Add("username", LocalSettingsHelper.GetUsername()); dic_param.Add("dining", dining.ToString()); dic_param.Add("detail_dining", detail_dining); dic_param.Add("sleep", sleep.ToString()); dic_param.Add("detail_sleep", detail_sleep); dic_param.Add("toilet", toilet.ToString()); dic_param.Add("detail_toilet", detail_toilet); dic_param.Add("parlour", parlour.ToString()); dic_param.Add("detail_parlour", detail_parlour); dic_param.Add("outdoor", outdoor.ToString()); dic_param.Add("detail_outdoor", detail_outdoor); return(await conn.SendPostRequest(ConnectServer.URL_UPLOADDAILY, dic_param)); }
private async void DP_onDateChanged(object sender, DatePickerValueChangedEventArgs e) { try { bool isNull = true; if (dp_date.Date != DateTime.Now.Date) { IEnumerable <Daily> allRecords = await Common.GetThisDayDailyRecords(dp_date.Date.ToString("yyyy/MM/dd")); if (allRecords != null) { foreach (var record in allRecords) { isNull = false; if (MainPage.notification.Data_pie_daily != null && MainPage.notification.Data_pie_daily.Count > 0) { int count = int.MaxValue; while (count > 0) { try { MainPage.notification.Data_pie_daily.Clear(); count = MainPage.notification.Data_pie_daily.Count; } catch (Exception exc) { Debug.WriteLine(exc.Message); } } } PieChartDataItem item_dining = new PieChartDataItem(); item_dining.title = "dining"; item_dining.value = record.dining; MainPage.notification.Data_pie_daily.Add(item_dining); MainPage.notification.Text_dining = record.dining.ToString(); PieChartDataItem item_sleep = new PieChartDataItem(); item_sleep.title = "sleep"; item_sleep.value = record.sleep; MainPage.notification.Data_pie_daily.Add(item_sleep); MainPage.notification.Text_sleep = record.sleep.ToString(); PieChartDataItem item_toilet = new PieChartDataItem(); item_toilet.title = "toilet"; item_toilet.value = record.toilet; MainPage.notification.Data_pie_daily.Add(item_toilet); MainPage.notification.Text_toilet = record.toilet.ToString(); PieChartDataItem item_parlour = new PieChartDataItem(); item_parlour.title = "parlour"; item_parlour.value = record.parlour; MainPage.notification.Data_pie_daily.Add(item_parlour); MainPage.notification.Text_parlour = record.parlour.ToString(); PieChartDataItem item_outdoor = new PieChartDataItem(); item_outdoor.title = "outdoor"; item_outdoor.value = record.outdoor; MainPage.notification.Data_pie_daily.Add(item_outdoor); MainPage.notification.Text_outdoor = record.outdoor.ToString(); } } } if (isNull) { dp_date.Date = LocalSettingsHelper.GetDPDate(); string message = "No records in the day"; MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); } } catch (Exception exc) { Debug.WriteLine("PivotPage DP_Changed: " + exc.Message); } }
private void OnDailyReceived() { try { isReceiveDaily = true; Daily daily = Util.DataContractJsonDeSerializer <Daily>(message); //将日常数据加入到本地存储中 dailyDataHelper.AddNew(daily); // dailyDataHelper.SaveToFile(); LocalSettingsHelper.SetDPDate(Util.StringToDateOffset(daily.date)); Date_DP = LocalSettingsHelper.GetDPDate(); PieChartDataItem item_dining = new PieChartDataItem(); item_dining.title = "dining"; item_dining.value = daily.dining; Text_dining = daily.dining.ToString(); PieChartDataItem item_sleep = new PieChartDataItem(); item_sleep.title = "sleep"; item_sleep.value = daily.sleep; Text_sleep = daily.sleep.ToString(); PieChartDataItem item_parlour = new PieChartDataItem(); item_parlour.title = "parlour"; item_parlour.value = daily.parlour; Text_parlour = daily.parlour.ToString(); PieChartDataItem item_toilet = new PieChartDataItem(); item_toilet.title = "toilet"; item_toilet.value = daily.toilet; Text_toilet = daily.toilet.ToString(); PieChartDataItem item_outdoor = new PieChartDataItem(); item_outdoor.title = "outdoor"; item_outdoor.value = daily.outdoor; Text_outdoor = daily.outdoor.ToString(); if (Data_pie_daily.Count > 0) { int count = int.MaxValue; while (count > 0) { try { Data_pie_daily.Clear(); pieChartDataHelper.Clear(); count = Data_pie_daily.Count; } catch (Exception e) { Debug.WriteLine(e.Message); } } } Data_pie_daily.Add(item_dining); Data_pie_daily.Add(item_sleep); Data_pie_daily.Add(item_toilet); Data_pie_daily.Add(item_parlour); Data_pie_daily.Add(item_outdoor); pieChartDataHelper.AddNew(item_dining); pieChartDataHelper.AddNew(item_sleep); pieChartDataHelper.AddNew(item_toilet); pieChartDataHelper.AddNew(item_parlour); pieChartDataHelper.AddNew(item_outdoor); pieChartDataHelper.SaveToFile(); } catch (Exception e) { if (e.Message != "") { Debug.WriteLine("OnDailyReceived: " + e.Message); } } }
private void SaveUserInfo() { LocalSettingsHelper.SetAccount(usernameInput.Text, passwordInput.Password); }
private void LogOutBtn_Clicked(object sender, RoutedEventArgs e) { LocalSettingsHelper.SetBoolStatus(LocalSettingsHelper.KEY_SIGNIN, false); this.Frame.Navigate(typeof(MainPage)); }