using FLY.OBJComponents.Client; using FLY.OBJComponents.IService; using FLY.Winder.Common; using FLY.Winder.IService; using FLY.Winder.OBJ_INTERFACE; using FObjBase; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace FLY.Winder.Client { public class WinderSystemServiceClient : FObjServiceClient, IWinderSystemService { #region IWinderSystemService public WinderAccessory Accessory { get; private set; } public List<WinderInsideOutside> Items { get; private set; } /// <summary> /// PLC代理系统 /// </summary> public IPLCProxySystemService PLCos { get; private set; } #endregion SyncPropServiceClient syncPropServiceClient; /// <summary> /// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged, 是由于 接收到数据导致的 /// </summary> public bool IsInPushValue { get { return syncPropServiceClient.IsInPushValue; } } public WinderSystemServiceClient(UInt32 serviceId) : base(serviceId) { Init(); } public WinderSystemServiceClient(UInt32 serviceId, string connName) : base(serviceId) { Init(); ConnName = connName; FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this); } void Init() { Items = new List<WinderInsideOutside>(); for (int i = 0; i < 2; i++) { Items.Add(new WinderInsideOutside()); } Accessory = new WinderAccessory(); syncPropServiceClient = new SyncPropServiceClient( mServerID + 1, new Dictionary<string, INotifyPropertyChanged> { {"Accessory", Accessory }, {"Items[0]", Items[0] }, {"Items[1]", Items[1] } }); PLCos = new PLCProxySystemServiceClient( mServerID + 2, new Dictionary<string, INotifyPropertyChanged> { {"Accessory", Accessory }, {"Items[0]", Items[0] }, {"Items[1]", Items[1] } }); } public override UInt32[] GetIDs() { List<UInt32> IDs = new List<uint>(); IDs.Add(ID); IDs.Add(syncPropServiceClient.ID); IDs.AddRange(((PLCProxySystemServiceClient)PLCos).GetIDs()); return IDs.ToArray(); } public override void ConnectNotify(IFConn from) { base.ConnectNotify(from); if (from.IsConnected) { CurrObjSys.SenseConfigEx(mConn, mServerID, ID, 0xffffffff, SENSE_CONFIG.ADD); } } } }