/// <summary> /// 从服务器获取联系人列表 /// </summary> protected void getContactListFromServer() { Hashtable hashtable = new Hashtable(); UtilityLoading utilityLoading = new UtilityLoading(); utilityLoading.StatusText = "正在获取联系人列表"; if (userInfo != null) { utilityLoading.functionGetContactList(userInfo); } if (utilityLoading.ShowDialog() == DialogResult.OK) { //hashtable = utilityLoading.CallBackTable; string callback = utilityLoading.CallBackMessage; //ContactList cl = JsonHelper.getDeserializeObject<ContactList>(callback); /* 创建联系人树 */ Dictionary <string, ContactList.Group.GroupMember[]>[] contactDic = JsonHelper.getDeserializeObject <Dictionary <string, ContactList.Group.GroupMember[]>[]>(callback); setContactTree(contactDic); } else { MessageBox.Show("无法获取联系人信息!"); this.DialogResult = DialogResult.No; this.Close(); } }
private void button_confirm_Click(object sender, EventArgs e) { if (RelativeFilePath == null) { return; } UserInfo uiToSend = userInfo; string filePath; uiToSend.FileShareList = new UserInfo.ShareList(); for (int i = 0; i < RelativeFilePath.Count; i++) { filePath = RelativeFilePath.ElementAt(i); foreach (TreeNode node in treeView_contact.Nodes) { foreach (TreeNode contact_node in node.Nodes) { if (!contact_node.Checked) { continue; } if (!(uiToSend.FileShareList.IDList.Contains(contact_node.Name) && uiToSend.FileShareList.FileList.Contains(filePath))) { uiToSend.FileShareList.IDList.AddLast(contact_node.Name); uiToSend.FileShareList.FileList.AddLast(filePath); } } } } if (uiToSend.FileShareList.IDList.Count > 0) { UtilityLoading utL = new UtilityLoading(); utL.StatusText = "正在分享"; utL.ButtonText = "取消"; utL.functionShareFiles(uiToSend); if (utL.ShowDialog() == DialogResult.OK) { MessageBox.Show("分享成功"); } else { MessageBox.Show("分享失败!"); } } else { MessageBox.Show("请选择联系人!"); } }
/// <summary> /// 注销窗体 /// </summary> void closeWindow() { /* 向服务器提交注销请求 */ UtilityLoading utilityLoading = new UtilityLoading(); utilityLoading.ButtonText = "取消"; utilityLoading.StatusText = "正在向服务器发送注销请求"; utilityLoading.functionLogout(userInfo); if (utilityLoading.ShowDialog() == DialogResult.OK) { } else { MessageBox.Show("注销失败!"); return; } if (form_ParentLogin != null) { form_ParentLogin.Show(); form_ParentLogin.button_login.Enabled = true; } this.Close(); }