-
大小: 54KB文件類型: .7z金幣: 1下載: 0 次發(fā)布日期: 2021-05-16
- 語言: 其他
- 標簽: WCF??雙向通信??批量轉(zhuǎn)發(fā)??
資源簡介
WCF接收Client端數(shù)據(jù),進行轉(zhuǎn)發(fā)其他客戶端,也可以直接進行一對一通信,親測可用。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Configuration;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
namespace?Client
{
????public?class?AppConfig
????{
????????public?string?UserName?{?get;?set;?}
????????public?string?GetUserName()
????????{
????????????return?“游客“?+?DateTime.Now.ToString(“MMddhhmmssfff“);
????????}
????????public?string?GetUserAppName()
????????{
????????????System.xml.xmlDocument?xDoc?=?new?System.xml.xmlDocument();
????????????xDoc.Load(System.Windows.Forms.Application.ExecutablePath?+?“.config“);
????????????System.xml.xmlNode?xNode;
????????????System.xml.xmlElement?xElem1;
????????????xNode?=?xDoc.SelectSingleNode(“//appSettings“);
????????????xElem1?=?(System.xml.xmlElement)xNode.SelectSingleNode(“//add[@key=‘UserName‘]“);
????????????return?xElem1.GetAttribute(“value“);
????????}
????????public?void?SetUserName(string?name)
????????{
????????????System.xml.xmlDocument?xDoc?=?new?System.xml.xmlDocument();
????????????xDoc.Load(System.Windows.Forms.Application.ExecutablePath?+?“.config“);
????????????System.xml.xmlNode?xNode;
????????????System.xml.xmlElement?xElem1;
????????????xNode?=?xDoc.SelectSingleNode(“//appSettings“);
????????????xElem1?=?(System.xml.xmlElement)xNode.SelectSingleNode(“//add[@key=‘UserName‘]“);
????????????if?(xElem1?!=?null)?xElem1.SetAttribute(“value“?name);
????????????xDoc.Save(System.Windows.Forms.Application.ExecutablePath?+?“.config“);
????????}
????}
}
- 上一篇:語音合成工具源碼
- 下一篇:qt數(shù)據(jù)畫波形
評論
共有 條評論