public t_Element_RealTimeLine SaveRealTimeLineOR(t_Element_RealTimeLine obj)
 {
     _RealTime = obj;
        return SaveRealTimeLineOR();
 }
        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.Value;
            LineShowType.SelectedIndex = obj.LineShowType.Value;
            LineStyle.SelectedIndex = obj.LineStyle.Value;

            LinePointBJ.SelectedIndex = obj.LinePointBJ.Value;

            LineColor.Color = Common.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;

            if (obj.DeviceID.HasValue)
            {
                var v = _devices.FirstOrDefault(a => a.DeviceID == obj.DeviceID);
                cbDeviceID.SelectedValue = v;

                if (obj.ChannelNo.HasValue)
                {
                    LoadChanncel(v.DeviceID, obj.ChannelNo.Value);
                }
                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;
        }
Beispiel #3
0
 /// <summary>
 /// 用于向 t_Element_RealTimeLine EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTot_Element_RealTimeLine(t_Element_RealTimeLine t_Element_RealTimeLine)
 {
     base.AddObject("t_Element_RealTimeLine", t_Element_RealTimeLine);
 }
        public RealTimeLineOR(t_Element_RealTimeLine mLine)
        {
            _LineInfo = mLine;
            GetTimeShowELen();

            _YValue = GetLineMinValue()+10;

            _PolyLine.Stroke = new SolidColorBrush(Common.StringToColor(_LineInfo.LineColor));
            _PolyLine.StrokeThickness = 0.5;
            _PolyLine.Points = pc;
            _PolyLine.SetValue(Canvas.ZIndexProperty, 999);
            _PolyLine.Name = _LineInfo.ID;
            SetPolyLine();
            //曲线点
            noteMessages = new CoordinatesValue[maxNote];
            timerSetValue.Interval = new TimeSpan(0, 0, GetCYTimeLen());
            timerSetValue.Tick += (sender, obj) =>
            {
                AddNewValue(_YValue);
                ShowCurve();
            };
            timerSetValue.Start();
        }
Beispiel #5
0
 /// <summary>
 /// 创建新的 t_Element_RealTimeLine 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="screenID">ScreenID 属性的初始值。</param>
 /// <param name="elementID">ElementID 属性的初始值。</param>
 /// <param name="lineType">LineType 属性的初始值。</param>
 /// <param name="lineColor">LineColor 属性的初始值。</param>
 /// <param name="minValue">MinValue 属性的初始值。</param>
 /// <param name="maxValue">MaxValue 属性的初始值。</param>
 /// <param name="valueDecimal">ValueDecimal 属性的初始值。</param>
 /// <param name="timeLen">TimeLen 属性的初始值。</param>
 /// <param name="timeLenType">TimeLenType 属性的初始值。</param>
 /// <param name="lineCYZQLent">LineCYZQLent 属性的初始值。</param>
 /// <param name="lineCYZQType">LineCYZQType 属性的初始值。</param>
 public static t_Element_RealTimeLine Createt_Element_RealTimeLine(global::System.String id, global::System.Int32 screenID, global::System.Int32 elementID, global::System.Int32 lineType, global::System.String lineColor, global::System.String minValue, global::System.String maxValue, global::System.Int32 valueDecimal, global::System.Int32 timeLen, global::System.String timeLenType, global::System.String lineCYZQLent, global::System.String lineCYZQType)
 {
     t_Element_RealTimeLine t_Element_RealTimeLine = new t_Element_RealTimeLine();
     t_Element_RealTimeLine.ID = id;
     t_Element_RealTimeLine.ScreenID = screenID;
     t_Element_RealTimeLine.ElementID = elementID;
     t_Element_RealTimeLine.LineType = lineType;
     t_Element_RealTimeLine.LineColor = lineColor;
     t_Element_RealTimeLine.MinValue = minValue;
     t_Element_RealTimeLine.MaxValue = maxValue;
     t_Element_RealTimeLine.ValueDecimal = valueDecimal;
     t_Element_RealTimeLine.TimeLen = timeLen;
     t_Element_RealTimeLine.TimeLenType = timeLenType;
     t_Element_RealTimeLine.LineCYZQLent = lineCYZQLent;
     t_Element_RealTimeLine.LineCYZQType = lineCYZQType;
     return t_Element_RealTimeLine;
 }
 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 = Guid.NewGuid().ToString();
     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);
 }
        /// <summary>
        /// 初使化曲线
        /// </summary>
        private void InitLine()
        {
            var vLine = LoadScreen._DataContext.t_Element_RealTimeLines.Where(a => a.ElementID == this.ScreenElement.ElementID);
            if (vLine.Count() > 0)
            {
                foreach (t_Element_RealTimeLine tLine in vLine)
                {
                    RealTimeLineOR obj = new RealTimeLineOR(tLine);
                    _listRealTimeLine.Add(obj);
                }
                FirstLineOR = _listRealTimeLine.First();
            }
            else
            {
                t_Element_RealTimeLine objLine = new t_Element_RealTimeLine();
                objLine.ID = Guid.NewGuid().ToString();
                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);
            }
        }