private void Call(object sender, RoutedEventArgs e) { ListView l = FindChildControl <ListView>(ContactersHub, "ContactersDisplay") as ListView; ContactorContent item = (ContactorContent)l.SelectedItem; Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(item.PhoneNum, item.Name); }
private void ContacterClick(object sender, ItemClickEventArgs e) { //Button btn = FindChildControl<Button>(ContactersHub, "CallBtn") as Button; //btn.IsEnabled = true; ListView l = FindChildControl <ListView>(ContactersHub, "ContactersDisplay") as ListView; ContactorContent item = (ContactorContent)l.SelectedItem; Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(item.PhoneNum, item.Name); }
/// <summary> /// 在此页将要在 Frame 中显示时进行调用。 /// </summary> /// <param name="e">描述如何访问此页的事件数据。 /// 此参数通常用于配置页。</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { Windows.Phone.UI.Input.HardwareButtons.BackPressed += (sender, arg) => { arg.Handled = true; }; Contacters = new ContentCollection <ContactorContent>(); MessageBox = new ContentCollection <MessageBoxContent>(); #region GetContacters Dictionary <string, string> commandPair = new Dictionary <string, string>(); commandPair.Add("ID", StaticObj.user.ID); Packet[] packets = DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetContacters), JsonParser.SerializeObject(commandPair)); StaticObj.SendPackets(packets); Packet[] incommingContacters = await StaticObj.ReceivePackets(); if (DataParser.GetPacketCommandCode(incommingContacters[0]) == Convert.ToInt32(CommandCode.ReturnContacters)) { List <Dictionary <string, string> > jsonContacters = JsonParser.DeserializeListOfDictionaryObject(DataParser.Packets2Str(incommingContacters)); foreach (Dictionary <string, string> con in jsonContacters) { ContactorContent listContent = new ContactorContent(); listContent.Name = con["NAME"]; listContent.PhoneNum = con["CELLPHONE"]; Contacters.Add(listContent); } } #endregion #region GetMessageBox packets = DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetMessageBox), ""); StaticObj.SendPackets(packets); Packet[] incommingMessageBox = await StaticObj.ReceivePackets(); if (DataParser.GetPacketCommandCode(incommingMessageBox[0]) == Convert.ToInt32(CommandCode.ReturnMessageBox)) { List <Dictionary <string, string> > jsonMessageBox = JsonParser.DeserializeListOfDictionaryObject(DataParser.Packets2Str(incommingMessageBox)); foreach (Dictionary <string, string> msg in jsonMessageBox) { MessageBoxContent listContent = new MessageBoxContent(); listContent.ID = msg["ID"]; if (msg["ISFROMSTUDENT"].Equals("1")) { listContent.Type = "Student"; } else { listContent.Type = "Supervisor"; } //listContent.Type = msg["TYPE"]; listContent.Time = msg["SENDTIME"]; listContent.Content = msg["CONTENT"]; MessageBox.Add(listContent); } } #endregion if (StaticObj.user is HeartLink_Lib.Student) { WorkServiceForStudent.Visibility = Visibility.Visible; WorkServiceForSupervisor.Visibility = Visibility.Collapsed; StaticObj.SendPackets(DataParser.Str2Packets(Convert.ToInt32(CommandCode.GetDailyReminder), "")); Packet[] incommingDailyReminder = await StaticObj.ReceivePackets(); DailyReminderDisplay dis = new DailyReminderDisplay(); if (DataParser.GetPacketCommandCode(incommingDailyReminder[0]) == Convert.ToInt32(CommandCode.ReturnDailyReminder)) { Dictionary <string, string> dailyReminder = JsonParser.DeserializeObject(DataParser.Packets2Str(incommingDailyReminder)); dis.ReminderTime = dailyReminder["REMINDTIME"]; dis.ReminderContent = dailyReminder["CONTENT"]; } WorkServiceForStudent.DataContext = dis; } else { WorkServiceForSupervisor.Visibility = Visibility.Visible; WorkServiceForStudent.Visibility = Visibility.Collapsed; } }