Ejemplo n.º 1
0
        /// <summary>
        /// 現在値をセットする
        /// </summary>
        /// <param name="data">現在値データ</param>
        /// <param name="position">表示データ位置(Mode2で使用)</param>
        public void SetDataCalc(CalcData data, int position)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke((MethodInvoker)delegate() { SetDataCalc(data, position); });
                return;
            }

            //show calculate value
            try
            {
                //if (data == null)
                //{
                    for (int i = 0; i < this.dataValueLabelsAnl.Length; i++)
                    {
                        this.dataValueLabelsAnl[i].Text = string.Empty;
                    }
                //    return;
                //}
                int posPoint = 0;
                int chPos = 1;
                //data.TagDatas[0].DataValues
                foreach (var chData in data.TagDatas)
                {
                    if (chData == null)
                    {
                        continue;
                    }

                    if (chData.DataValues == null) continue;

                    var index = -1;
                    //for (int i = 1; i < this.dataValueLabelsAnl.Length; i++)
                    //{
                    //    if (this.dataValueLabelsAnl[i].Name.Equals("lblAnlData" + chPos.ToString()))
                    //    {
                    //        index = i;
                    //        chPos++;
                    //        break;
                    //    }

                    //}

                    for (int i = 1; i < this.calcAssignedTagNo.Length; i++)
                    {
                        if (this.calcAssignedTagNo[i] == chData.TagNo)
                        {
                            index = i;
                        }
                    }

                    if (index < 0)
                    {
                        continue;
                    }

                    DataTag tag = this.analyzeData.DataTagSetting.GetTag(chData.TagNo);
                    posPoint = tag.Point;
                    var t = chData.DataValues.GetType();
                    if (t == typeof(Value_Standard))
                    {
                        this.dataValueLabelsAnl[index].Text = ((Value_Standard)chData.DataValues).Value.ToString(tagPoint[posPoint]);
                    }
                    else if (t == typeof(Value_MaxMin))
                    {
                        this.dataValueLabelsAnl[index].Text = ((Value_MaxMin)chData.DataValues).MaxValue.ToString(tagPoint[posPoint]);

                        if (isMeasure)
                        {
                            if (pnlAnalysis.Controls.ContainsKey(this.dataValueLabelsAnl[index].Name + "-2"))
                            {
                                Label val2_Lable = (Label)pnlAnalysis.Controls.Find(this.dataValueLabelsAnl[index].Name + "-2", false)[0];

                                val2_Lable.Text = ((Value_MaxMin)chData.DataValues).MinValue.ToString(tagPoint[posPoint]);
                            }
                        }
                        else
                        {
                            if (tabPage2.Controls.ContainsKey(this.dataValueLabelsAnl[index].Name + "-2"))
                            {
                                Label val2_Lable = (Label)tabPage2.Controls.Find(this.dataValueLabelsAnl[index].Name + "-2", false)[0];

                                val2_Lable.Text = ((Value_MaxMin)chData.DataValues).MinValue.ToString(tagPoint[posPoint]);
                            }

                        }
                    }
                    else if (t == typeof(Value_Mode2))
                    {
                        // Mode2は解析中のみ表示
                        var d = (Value_Mode2)chData.DataValues;
                        this.dataValueLabelsAnl[index].Text = d.Values[position].ToString(tagPoint[posPoint]);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 演算データからタグデータを取得する
        /// </summary>
        /// <param name="calcDataLis">演算データ</param>
        /// <param name="tagNo">タグ番号</param>
        /// <returns>タグデータ</returns>
        private DataValue GetCalcData(CalcData calcData, int tagNo)
        {
            foreach (var calc in calcData.TagDatas)
            {
                if (calc.TagNo == tagNo)
                {
                    return calc.DataValues;
                }
            }

            return null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 測定データをセットする
        /// </summary>
        /// <param name="dataList">測定データ</param>
        public void SetCalculateData(CalcData[] dataList)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke((MethodInvoker)delegate() { SetCalculateData(dataList); });
                return;
            }

            try
            {
                if (dataList == null)
                {
                    throw new ArgumentNullException("dataList");
                }

                var data = dataList.Last();
                SetDataCalc(data, 0);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
        }