/// <summary> /// 初使化曲线 /// </summary> private void InitLine() { if (null == _lines) { //_lines = new ElementRealTimeLineDA().selectAllDate(); } var vLine = _lines; if (vLine.Count() > 0) { foreach (t_Element_RealTimeLine tLine in vLine) { RealTimeLineOR obj = new RealTimeLineOR(tLine); _listRealTimeLine.Add(obj); } } else { t_Element_RealTimeLine objLine = new t_Element_RealTimeLine(); objLine.ID = "N" + Guid.NewGuid().ToString("N"); objLine.LineName = "ll"; objLine.MaxValue = "100"; objLine.MinValue = "0"; objLine.LineCZ = 0; objLine.LineCYZQLent = "1"; objLine.LineCYZQType = "ss"; objLine.TimeLen = 50; objLine.TimeLenType = "ss"; objLine.LineShowType = 0; objLine.LineStyle = 0; objLine.LinePointBJ = 0; objLine.ShowFormat = "mm:ss"; objLine.LineColor = Colors.Blue.ToString(); RealTimeLineOR obj = new RealTimeLineOR(objLine); _listRealTimeLine.Add(obj); } }
public void SetRealTimeLineOR(t_Element_RealTimeLine obj) { _RealTime = obj; if (obj == null) return; this.LineName.Text = obj.LineName; //LineType.SelectedIndex = obj.LineType; LineCZ.SelectedIndex = obj.LineCZ; LineShowType.SelectedIndex = obj.LineShowType; LineStyle.SelectedIndex = obj.LineStyle; LinePointBJ.SelectedIndex = obj.LinePointBJ; LineColor.Color = Common1.StringToColor(obj.LineColor); MinValue.Text = obj.MinValue; MaxValue.Text = obj.MaxValue; ValueDecimal.Value = obj.ValueDecimal; FormartYear.IsChecked = false; FormartMonth.IsChecked = false; FormartDay.IsChecked = false; FormartHH.IsChecked = false; FormartMi.IsChecked = false; FormartSS.IsChecked = false; if (obj.ShowFormat.IndexOf("yyyy") == 0)//年度 { FormartYear.IsChecked = true; } if (obj.ShowFormat.IndexOf("MM") >= 0)//月 { FormartMonth.IsChecked = true; } if (obj.ShowFormat.IndexOf("dd") >= 0)//日 { FormartDay.IsChecked = true; } if (obj.ShowFormat.IndexOf("HH") >= 0)//日 { FormartHH.IsChecked = true; } if (obj.ShowFormat.IndexOf("mm") >= 0)//分 { FormartMi.IsChecked = true; } if (obj.ShowFormat.IndexOf("ss") >= 0)//秒 { FormartSS.IsChecked = true; } TimeLen.Text = obj.TimeLen.ToString(); TimeLenType.SelectedIndex = GetIndex(obj.TimeLenType); LineCYZQLent.Text = obj.LineCYZQLent; LineCYZQType.SelectedIndex = GetIndex(obj.LineCYZQType); if (obj.ComputeStr == null) obj.ComputeStr = ""; this.ComputeStr.Text = obj.ComputeStr; var v = _devices.FirstOrDefault(a => a.DeviceID == obj.DeviceID); cbDeviceID.SelectedValue = v; //if (obj.ChannelNo.HasValue) //{ if (null != v) { LoadChanncel(v.DeviceID); } //} //else //{ // LoadChanncel(v.DeviceID); //} //obj.ComputeStr = this.ComputeStr.Text; ShowYear.Value = DateTime.Now.Year; ShowMonth.Value = DateTime.Now.Month; ShowDay.Value = DateTime.Now.Day; ShowHH.Value = DateTime.Now.Hour; ShowMi.Value = DateTime.Now.Minute; ShowSS.Value = DateTime.Now.Millisecond; }
public virtual bool UpdateRealTimeT(t_Element_RealTimeLine elementRealTimeLine) { string intsertRealtimeTSQL = @"update t_Element_RealTimeLine SET ScreenID= @ScreenID, ElementID=@ElementID, LineType=@LineType, LineName=@LineName, LineCZ=@LineCZ, LineShowType=@LineShowType, LineStyle=@LineStyle, LinePointBJ=@LinePointBJ, LineColor= @LineColor, MinValue=@MinValue, MaxValue= @MaxValue, ValueDecimal=@ValueDecimal, ShowFormat= @ShowFormat, TimeLen=@TimeLen, TimeLenType= @TimeLenType, LineCYZQLent=@LineCYZQLent, LineCYZQType=@LineCYZQType, DeviceID=@DeviceID, ChannelNo=@ChannelNo, ComputeStr=@ComputeStr, StartTime= @StartTime WHERE ID=@ID"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", Guid.NewGuid().ToString("N")), new SqlParameter("@ScreenID",elementRealTimeLine.ScreenID), new SqlParameter("@ElementID", elementRealTimeLine.ElementID), new SqlParameter("@LineType", elementRealTimeLine.LineType), new SqlParameter("@LineName", elementRealTimeLine.LineName), new SqlParameter("@LineCZ", elementRealTimeLine.LineCZ), new SqlParameter("@LineShowType", elementRealTimeLine.LineShowType), new SqlParameter("@LineStyle", elementRealTimeLine.LineStyle), new SqlParameter("@LinePointBJ",elementRealTimeLine.LinePointBJ), new SqlParameter("@LineColor", elementRealTimeLine.LineColor), new SqlParameter("@MinValue", elementRealTimeLine.MinValue), new SqlParameter("@MaxValue",elementRealTimeLine.MaxValue), new SqlParameter("@ValueDecimal",elementRealTimeLine.ValueDecimal), new SqlParameter("@ShowFormat",elementRealTimeLine.ShowFormat), new SqlParameter("@TimeLen", elementRealTimeLine.TimeLen), new SqlParameter("@TimeLenType", elementRealTimeLine.TimeLenType), new SqlParameter("@LineCYZQLent", elementRealTimeLine.LineCYZQLent), new SqlParameter("@LineCYZQType",elementRealTimeLine.LineCYZQType), new SqlParameter("@DeviceID",ConvertToDbNull(elementRealTimeLine.DeviceID)), new SqlParameter("@ChannelNo",ConvertToDbNull(elementRealTimeLine.ChannelNo)), new SqlParameter("@ComputeStr", ConvertToDbNull(elementRealTimeLine.ComputeStr)), new SqlParameter("@StartTime", ConvertToDbNull(elementRealTimeLine.StartTime)) }; CmdList.Add(new CommandList() { strCommandText = intsertRealtimeTSQL, Params = parameters }); return true; }
/// <summary> /// 初使化曲线 /// </summary> private void InitLine() { if (null == _lines) { _lines = new ElementRealTimeLineDA().SelectBy(this.ScreenElement.ElementID); } // var vLine = _lines.Where(a => a.ElementID == this.ScreenElement.ElementID); if (_lines != null && _lines.Count() > 0) { foreach (t_Element_RealTimeLine tLine in _lines) { RealTimeLineOR obj = new RealTimeLineOR(tLine); _listRealTimeLine.Add(obj); } FirstLineOR = _listRealTimeLine.First(); } else { t_Element_RealTimeLine objLine = new t_Element_RealTimeLine(); objLine.ID = "N" + Guid.NewGuid().ToString("N"); objLine.LineName = "ll"; objLine.MaxValue = "100"; objLine.MinValue = "0"; objLine.LineCZ = 0; objLine.LineCYZQLent = "1"; objLine.LineCYZQType = "ss"; objLine.TimeLen = 50; objLine.TimeLenType = "ss"; objLine.LineShowType = 0; objLine.LineStyle = 0; objLine.LinePointBJ = 0; objLine.ShowFormat = "mm:ss"; objLine.LineColor = Colors.Blue.ToString(); RealTimeLineOR obj = new RealTimeLineOR(objLine); _listRealTimeLine.Add(obj); } }
public t_Element_RealTimeLine SaveRealTimeLineOR(t_Element_RealTimeLine obj) { _RealTime = obj; return SaveRealTimeLineOR(); }
public RealTimeLineOR(t_Element_RealTimeLine mLine) { _LineInfo = mLine; GetTimeShowELen(); _YValue = GetLineMinValue(); _PolyLine.Stroke = new SolidColorBrush(Common1.StringToColor(_LineInfo.LineColor)); _PolyLine.StrokeThickness = 0.5; _PolyLine.Points = pc; _PolyLine.SetValue(Canvas.ZIndexProperty, 999); _PolyLine.Name = "Name"+ _LineInfo.ID; SetPolyLine(); //曲线点 noteMessages = new CoordinatesValue[maxNote]; timerSetValue.Interval = new TimeSpan(0, 0, GetCYTimeLen()); timerSetValue.Tick += (sender, obj) => { AddNewValue(_YValue); ShowCurve(); }; timerSetValue.Start(); }
private RealTimeLineOR GetRealLine(t_Element_RealTimeLine obj) { foreach (RealTimeLineOR line in _RealTimeData.ListRealTimeLine) { if (line.LineInfo.ID == obj.ID) return line; } return null; }
private void btnAlert_Click(object sender, RoutedEventArgs e) { if (dgDataList.SelectedItem == null) { MessageBox.Show("请选择移出项!"); return; } _RealTime= linePro.SaveRealTimeLineOR(); //SaveRealTimeLineOR(); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { _RealTime = new t_Element_RealTimeLine(); _RealTime.ID = "N" + Guid.NewGuid().ToString("N"); linePro.SaveRealTimeLineOR(_RealTime); //SaveRealTimeLineOR(); //名称 foreach (t_Element_RealTimeLine obj in ListEletement) { if (obj.LineName == _RealTime.LineName) { MessageBox.Show(string.Format("名称:{0},已经存在!", _RealTime.LineName)); return; } } ListEletement.Add(_RealTime); }
public void Clone(t_Element_RealTimeLine obj) { // ID = obj.ID; //场景ID ScreenID = obj.ScreenID; //无素ID ElementID = obj.ElementID; //线类型 LineType = obj.LineType; //线名称 LineName = obj.LineName; //取值() LineCZ = obj.LineCZ; //类型(直线、阶梯线) LineShowType = obj.LineShowType; //样式 LineStyle = obj.LineStyle; //标记,不画点 LinePointBJ = obj.LinePointBJ; //线颜色 LineColor = obj.LineColor; //最小值 MinValue = obj.MinValue; //最大值 MaxValue = obj.MaxValue; //小数位长度 ValueDecimal = obj.ValueDecimal; //显示格式 ShowFormat = obj.ShowFormat; //时间长度 TimeLen = obj.TimeLen; //时间长度类型 TimeLenType = obj.TimeLenType; //时间采样周期 LineCYZQLent = obj.LineCYZQLent; //采样周期类型 LineCYZQType = obj.LineCYZQType; //取值设备ID DeviceID = obj.DeviceID; //取值设备通道 ChannelNo = obj.ChannelNo; //取值表达试 ComputeStr = obj.ComputeStr; //开始时间 StartTime = obj.StartTime; }