using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FObjBase { /// /// FObj 客户端 /// public class FObjServiceClient : FObj,INotifyPropertyChanged { /// /// 服务Id /// protected UInt32 mServerID; /// /// 连接器 /// protected IFConn mConn; /// /// 连接名称 /// public string ConnName; /// /// 连接成功 /// public bool IsConnected { get; set; } /// /// 使用 服务Id初始化, 还需要 Connect_to_Another_OBJSys /// /// public FObjServiceClient(UInt32 id) { mServerID = id; } /// /// 使用全局地址字典初始化, 不需要再 手动 Connect_to_Another_OBJSys /// /// /// public FObjServiceClient(UInt32 serviceId, string connName) : this(serviceId) { ConnName = connName; FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this); } public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } /// /// 连接通知 /// /// public override void ConnectNotify(IFConn from) { mConn = from; IsConnected = from.IsConnected; } /// /// 注销 /// public override void Dispose() { if (!string.IsNullOrEmpty(ConnName)) FObjServiceClientManager.Instance.ObjClientDisponse(this); CurrObjSys.ObjRemove( this, mConn); } public virtual UInt32[] GetIDs() { return new UInt32[] { ID }; } } }