public void AddArrayDataTest2( ) { byte[] b1 = new byte[] { 0x13, 0xA6, 0x15, 0x85 }; byte[] b2 = new byte[] { 0x5B, 0x05, 0x12 }; byte[] b3 = new byte[] { 0x13, 0xA6, 0x15, 0x85, 0x5B, 0x05, 0x12 }; byte[] b4 = new byte[] { 0x15, 0x85, 0x5B, 0x05, 0x12 }; SoftBasic.AddArrayData(ref b1, b2, 5); Assert.IsTrue(SoftBasic.IsTwoBytesEquel(b1, b4)); }
private void Timer_Tick(object sender, EventArgs e) { if (timerEnable) { // 把数据新增到每一个数组里,并指定最大3000个数,再多就覆盖之前的 SoftBasic.AddArrayData(ref steps, new float[] { random.Next(10) }, 3000); SoftBasic.AddArrayData(ref data, new float[] { (float)(Math.Sin(2 * Math.PI * timeTick / 50) * 20 + 120) }, 3000); SoftBasic.AddArrayData(ref times, new DateTime[] { DateTime.Now }, 3000); SoftBasic.AddArrayData(ref press, new float[] { (float)(Math.Sin(2 * Math.PI * timeTick / 100) * 0.5d + 4.1d) }, 3000); hslCurveHistory1.SetLeftCurve("步序", steps); hslCurveHistory1.SetLeftCurve("温度", data, Color.DodgerBlue, HslControls.CurveStyle.Curve, "{0:F1} ℃"); hslCurveHistory1.SetRightCurve("压力", press, Color.Tomato, HslControls.CurveStyle.Curve, "{0:F2} Mpa"); hslCurveHistory1.SetDateTimes(times); hslCurveHistory1.SetCurveVisible("步序", false); // 步序不是曲线信息,不用显示出来 hslCurveHistory1.ScrollToRight( ); timeTick++; } }
public void AddArrayDataExample( ) { #region AddArrayDataExample int[] old = new int[5] { 1234, 1235, 1236, 1237, 1238 }; int[] tmp = new int[2] { 456, 457 }; SoftBasic.AddArrayData(ref old, tmp, 6); foreach (var m in old) { Console.Write(m + " "); } // 输出 1235, 1236, 1237, 1238, 456, 457 #endregion }