/// <summary> /// 描述: 构造函数 /// </summary> public DataUnit() { DataItemsList = new List <IDataItem>(); DataParamItemsList = new List <IDataItem>(); DataIndex = 0; DataStr = "12"; //首先添加脉冲 DataItemsList.Add(DataItemFactory.GetStepPulseItem()); }
private void button1_Click(object sender, EventArgs e) { DataUnit dataUnit = new DataUnit(); dataUnit.AddDataItem(DataItemFactory.GetDoubleB1ChanItem(111, 111)); dataUnit.AddDataItem(DataItemFactory.GetDoubleB1ChanItem(222, 222)); dataUnit.AddDataItem(DataItemFactory.GetDoubleB1ChanItem(333, 333)); dataUnit.AddDataItem(DataItemFactory.GetDoubleB1ChanItem(444, 444)); for (int i = 0; i < 3; i++) { DataUnit dataUnit_Mile = CopyDataUnit(dataUnit); AddDataParamItem(dataUnit_Mile, i); ChangeData(dataUnit_Mile, i); Console.WriteLine(dataUnit_Mile); } }
private void AddDataParamItem(DataUnit dataUnit_Mile, int i) { dataUnit_Mile.AddDataParamItem(DataItemFactory.GetDateItem(DateTime.Now)); }