Пример #1
0
        public void Create(HardwareManager hardwareManager)
        {
            soft = hardwareManager.CommuniSoft;
            DataTable stationDataTable = DB.GetDB().ExecuteStationDataTable();
            foreach (DataRow row in stationDataTable.Rows)
            {
                //soft.SPUManager.SPUCollection[0].StationFactory.Create(row);
                // TODO:
                //
                string stationType = "";
                int stationID = Convert.ToInt32(row["StationID"]);

                IStationFactory stationFactory = soft.SPUManager.FindStationFactory(stationType);
                if (stationFactory != null)
                {
                    Station st = stationFactory.Create(row);
                    if (st != null)
                    {
                        CreateDevice(st, stationID);
                        hardwareManager.Stations.Add(st);
                    }
                }

                // stationfactory = spumanager.getStationFactory( stationType );
                // st = f.create(row)
                // hd.stations.add(st);

                // dr in device tbl
                // df = dpu.getfactory(device type)
                // df.create(row)
                // st.add(device)
            }
        }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 public TaskManager(CommuniSoft soft, TimeSpan timeoutValue)
 {
     if (soft == null)
         throw new ArgumentNullException("communiSoft");
     this.Timeout = timeoutValue;
     this._communiSoft = soft;
 }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="communiSoft"></param>
 public ProcessAddinManager(CommuniSoft communiSoft)
 {
     if (communiSoft == null)
     {
         throw new ArgumentNullException("communiSoft");
     }
     this._communiSoft = communiSoft;
 }
Пример #4
0
 public void Init(CommuniSoft communiSoft)
 {
     UC u = GetUC();
     //u.Top = 240;
     //u.Dock = System.Windows.Forms.DockStyle.Fill;
     u.Description = this.Description;
     communiSoft.UIManager.ParentControl.Controls.Add(u);
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="soft"></param>
 public DeviceDefineManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("soft");
     }
     this._communiSoft = soft;
 }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 public CommuniPortManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("communiSoft");
     }
     this._communiSoft = soft;
 }
Пример #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="soft"></param>
 public FilterManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("soft");
     }
     _communiSoft = soft;
 }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="soft"></param>
 public FDManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("soft");
     }
     this._soft = soft;
 }
Пример #9
0
 /// <summary>
 /// 
 /// </summary>
 public TaskDefineManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("soft");
     }
     this._communiSoft = soft;
 }
Пример #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="communiSoft"></param>
 public ProcessAddinManager(CommuniSoft communiSoft)
 {
     if (communiSoft == null)
     {
         throw new ArgumentNullException("communiSoft");
     }
     this._communiSoft = communiSoft;
 }
Пример #11
0
 public SocketListenerManager(CommuniSoft soft)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("communiSoft");
     }
     this._communiSoft = soft;
 }
Пример #12
0
 /// <summary>
 ///
 /// </summary>
 public TaskManager(CommuniSoft soft, TimeSpan timeoutValue)
 {
     if (soft == null)
     {
         throw new ArgumentNullException("communiSoft");
     }
     this.Timeout      = timeoutValue;
     this._communiSoft = soft;
 }
Пример #13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="communiSoft"></param>
        public CommuniSoftEventsRegister(CommuniSoft communiSoft, CommuniServerProcessor processor)
        {
            if (communiSoft == null)
                throw new ArgumentNullException("communiSoft");

            if(processor == null)
                throw new ArgumentNullException("processor");

            _communiSoft = communiSoft;
            //_processAddin = _communiSoft.ProcessAddinManager.ProcessAddin;
            _processAddin = processor;
        }
Пример #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public StationCollection CreateRainStations(CommuniSoft soft)
        {
            string deviceType = "LXRainDevice";

            StationCollection stations = new StationCollection();
            DataTable stTable = LXDBDBI.LXDB.GetRainStationDataTable();
            foreach (DataRow row in stTable.Rows)
            {
                string rainName = row["Rain_Name"].ToString();
                int rainAddress = Convert.ToInt32(row["Rain_addr"]);
                string ipString = row["Rain_IP"].ToString();
                IPAddress ip = IPAddress.Parse(ipString);
                int deviceid = rainAddress;
                int stationid = rainAddress;

                SocketCommuniType ct = new SocketCommuniType(ip);
                Station st = new Station(rainName, ct);
                st.ID = stationid;

                DeviceDefine dd = soft.DeviceDefineManager.
                    DeviceDefineCollection.FindDeviceDefine(deviceType);
                LXRainDevice d = new LXRainDevice(dd,rainAddress);
                d.ID = deviceid;

                st.Devices.Add(d);

                stations.Add(st);
            }
            return stations;
        }
Пример #15
0
 public SocketListenerManager(CommuniSoft soft)
 {
     if (soft == null)
         throw new ArgumentNullException("communiSoft");
     this._communiSoft = soft;
 }
Пример #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="soft"></param>
 /// <param name="task"></param>
 private void AddTask(CommuniSoft soft, Device device, Opera op)
 {
     Task task = new Task(device, op, new ImmediateStrategy());
     soft.TaskManager.Tasks.AddToHead(task);
     NUnit.UiKit.UserMessage.DisplayInfo(strings.CommandSubmit);
 }
Пример #17
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="soft"></param>
 public HardwareManager(CommuniSoft soft)
 {
     if (soft == null)
         throw new ArgumentNullException("communiSoft");
     this._communiSoft = soft;
 }
Пример #18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="soft"></param>
        public override void Build(CommuniSoft soft)
        {
            System.Collections.Hashtable idStationMap = new System.Collections.Hashtable();
            // build station
            //
            foreach (DataRow stationDR in _stationDataTable.Rows)
            {
                bool isStationDeleted = false;
                if (stationDR["Deleted"] != DBNull.Value)
                {
                    isStationDeleted = Convert.ToBoolean(stationDR["Deleted"]);
                }

                if (!isStationDeleted)
                {
                    string stationName = stationDR["Name"].ToString();
                    bool isExistStation = soft.HardwareManager.Stations.ExistName(stationName, null);
                    if (!isExistStation)
                    {
                        string xml = stationDR["CommuniTypeContent"].ToString().Trim();
                        if (xml.Length == 0)
                        {
                            // TODO: 2010-09-17
                            // log error info
                            //
                            continue;
                        }

                        int stationID = (int)stationDR["StationID"];

                        //XmlDataDocument doc = new XmlDataDocument();
                        //doc.LoadXml(xml);
                        //XmlNode node = doc.SelectSingleNode("socketcommunitype");
                        //CommuniType communiType = Xdgk.Communi.XmlBuilder.XmlSocketCommuniBuilder.Build(node);
                         CommuniType communiType = Xdgk.Communi.CommuniTypeFactory.Create(xml);

                        Station station = new Station(stationName, communiType);
                        station.ID = stationID;
                        idStationMap.Add(stationID, station);
                        soft.HardwareManager.Stations.Add(station);
                    }
                }
            }

            // build device
            //
            foreach (DataRow deviceDR in _deviceDataTable.Rows)
            {
                bool isDeviceDeleted = false;
                if (deviceDR["deleted"] != DBNull.Value)
                {
                    isDeviceDeleted = Convert.ToBoolean(deviceDR["Deleted"]);
                }

                if (isDeviceDeleted)
                {
                    continue;
                }

                //if (!isDeviceDeleted)
                //{
                int stationID = (int)deviceDR["StationID"];
                int deviceID = (int)deviceDR["DeviceID"];
                string deviceType = deviceDR["DeviceType"].ToString();
                string addressString = deviceDR["Address"].ToString().Trim();

                if (addressString.Length == 0)
                    continue;

                int address = Convert.ToInt32(addressString);

                Station st = idStationMap[stationID] as Station;
                //if (st != null)
                //{
                //    st.Devices.Add(device);
                //}
                if (st == null)
                {
                    continue;
                }

                //DeviceDefine dd = soft.DeviceDefineCollection.FindDeviceDefine(deviceType);
                DeviceDefine dd = soft.DeviceDefineManager.DeviceDefineCollection.FindDeviceDefine(deviceType);
                if (dd == null)
                {
                    bool exist = soft.UnDefineDeviceType.Exist(deviceType);
                    if (!exist)
                    {
                        soft.UnDefineDeviceType.Add(deviceType);
                        string msg = string.Format(strings.UnDefineDeviceType, deviceType);
                        NUnit.UiKit.UserMessage.Display(msg);
                    }
                    continue;
                }

                //Xdgk.Communi.Device device = new Device(dd, "", address);
                Xdgk.Communi.Device device = DeviceFactory.Create(dd, "", address);

                //Xdgk.Communi.Device device = new Device(deviceType, address);
                //string t = soft.OperaFactory.DeviceDefineCollection.GetDeviceText(deviceType);
                //device.Text = t;
                device.ID = deviceID;

                //Station st = soft.HardwareManager.GetStation(stationName);
                st.Devices.Add(device);
            }
            //}
        }
Пример #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="soft"></param>
 public override void Build(CommuniSoft soft)
 {
     StationCollection stations = BuildStationCollection();
     foreach (Station st in stations)
     {
         soft.HardwareManager.Stations.Add(st);
     }
 }
Пример #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="communiSoft"></param>
 /// <param name="pr"></param>
 public override void ProcessParseResult(Xdgk.Communi.CommuniSoft communiSoft, Xdgk.Communi.ParseResult pr)
 {
     System.Diagnostics.Debug.Fail("from simple 11");
     //throw new NotImplementedException();
 }
Пример #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="communiSoft"></param>
 public UIManager(CommuniSoft communiSoft)
 {
     if (communiSoft == null)
         throw new ArgumentNullException("communiSoft");
     this._communiSoft = communiSoft;
 }
Пример #22
0
 /// <summary>
 /// 
 /// </summary>
 private static void CreateCommuniSoft()
 {
     _communiSoft = new CommuniSoft();
 }