示例#1
0
        protected override bool GetDataPoint(
            LogRow data,
            out float xValue,
            out float yValue,
            out float zValue,
            out string zName)
        {
            xValue = 0;
            yValue = 0;
            zValue = 0;
            zName  = "Not supported";

            if (!supported)
            {
                return(false);
            }

            try
            {
                LogColumn xColumn = data.GetColumn("P8");
                LogColumn yColumn = data.GetColumn("P13");
                LogColumn zColumn = data.GetColumn("P25");
                xValue = (float)xColumn.ValueAsDouble;
                yValue = (float)yColumn.ValueAsDouble;
                zValue = (float)zColumn.ValueAsDouble;
                zName  = zColumn.Conversion.Units;
            }
            catch (InvalidOperationException)
            {
                supported = false;
                return(false);
            }
            return(true);
        }
示例#2
0
        private void dgvConditions_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == SelectColumnIndex ||
                e.ColumnIndex == RelationColumnIndex)
            {
                DataGridViewRow dgvr     = this.dgvConditions.Rows[e.RowIndex];
                bool            isSelect = Convert.ToBoolean(dgvr.Cells[SelectColumnIndex].Value);

                LogColumn lc       = LogColumnService.Instance.GetLogColumn(Convert.ToInt32(dgvr.Tag));
                IRelation relation = RelationService.Instance.GetRelation(lc.Type,
                                                                          Convert.ToString(dgvr.Cells[RelationColumnIndex].Value));

                dgvr.Cells[ColumnNameColumnIndex].ReadOnly        = true;
                dgvr.Cells[ColumnNameColumnIndex].Style.BackColor = SystemColors.Control;

                dgvr.Cells[RelationColumnIndex].ReadOnly        = !isSelect;
                dgvr.Cells[RelationColumnIndex].Style.BackColor = isSelect ? Color.White : SystemColors.Control;

                dgvr.Cells[ContentColumnIndex].ReadOnly        = !isSelect || relation.ParamsCount == 2;
                dgvr.Cells[ContentColumnIndex].Style.BackColor = (isSelect && relation.ParamsCount == 1)?Color.White : SystemColors.Control;

                dgvr.Cells[StartDateColumnIndex].ReadOnly        = !isSelect || relation.ParamsCount == 1;
                dgvr.Cells[StartDateColumnIndex].Style.BackColor = (isSelect && relation.ParamsCount == 2) ? Color.White : SystemColors.Control;

                dgvr.Cells[EndDateColumnIndex].ReadOnly        = !isSelect || relation.ParamsCount == 1;
                dgvr.Cells[EndDateColumnIndex].Style.BackColor = (isSelect && relation.ParamsCount == 2) ? Color.White : SystemColors.Control;
            }
        }
示例#3
0
        protected override void GetDataPoint(
            LogRow data,
            out double xValue,
            out double yValue,
            out string xName,
            out string yName)
        {
            xName  = "MAF";
            yName  = "Sensor / Target";
            xValue = 0;
            yValue = 0;

            if (!supported)
            {
                return;
            }

            try
            {
                LogColumn xColumn = data.GetColumn(this.xParameterName);
                xValue = xColumn.ValueAsDouble;
                LogColumn ySensorColumn = data.GetColumn(this.yParameterName);
                LogColumn yTargetColumn = data.GetColumn(this.desiredAfrParameterName);
                yValue = ySensorColumn.ValueAsDouble / yTargetColumn.ValueAsDouble;
            }
            catch (InvalidOperationException)
            {
                supported = false;
            }
        }
示例#4
0
        /// <summary>
        /// Get a data point for the heat map
        /// </summary>
        protected override bool GetDataPoint(
            LogRow data,
            out float xValue,
            out float yValue,
            out float zValue,
            out string zName)
        {
            try
            {
                LogColumn x = data.GetColumn(this.xParameterName);
                LogColumn y = data.GetColumn(this.yParameterName);
                LogColumn z = data.GetColumn(this.zParameterName);

                xValue = (float)x.ValueAsDouble;
                yValue = (float)y.ValueAsDouble;
                zValue = (float)z.ValueAsDouble;

                zName = z.Conversion.Units;
            }
            catch (InvalidOperationException)
            {
                xValue = -1;
                yValue = -1;
                zValue = 0;
                zName  = "Disabled";
            }
            return(true);
        }
示例#5
0
        public void LogFilterPositive()
        {
            LogRow    row    = LogRow.GetInstance(this.readOnlyColumns);
            LogColumn column = this.readOnlyColumns[0];

            MemoryStream memoryStream = new MemoryStream();
            LogFilter    filter       = LogFilter.GetTestInstance(
                delegate { return(LogWriter.GetInstance(memoryStream, false)); },
                column.Parameter,
                column.Conversion);

            LogFilter.SetDefaultBehavior(true);

            filter.LogStart(row);
            filter.LogEntry(row);
            filter.LogEntry(row);
            filter.LogStop();

            string actual   = Encoding.ASCII.GetString(memoryStream.ToArray());
            string expected =
                "Parameter1, Parameter2, Parameter3" + Environment.NewLine +
                "0, 0.0, 0.00" + Environment.NewLine +
                "0, 0.0, 0.00" + Environment.NewLine;

            Assert.AreEqual(expected, actual, "Log with two entries");
        }
示例#6
0
        /// <summary>
        /// Create the test log columns
        /// </summary>
        public virtual void Initialize()
        {
            Conversion units  = Conversion.GetInstance("units", "x", "0");
            Conversion cubits = Conversion.GetInstance("cubits", "x/2", "0.0");
            Conversion torks  = Conversion.GetInstance("torks", "x * 2", "0.00");

            Conversion[] conversions = new Conversion[] { units, cubits, torks };
            SsmParameter p1          = new SsmParameter(null, "P1", "Parameter1", 1, 1, conversions);
            SsmParameter p2          = new SsmParameter(null, "P2", "Parameter2", 2, 2, conversions);
            SsmParameter p3          = new SsmParameter(null, "P3", "Parameter3", 3, 3, conversions);

            List <LogColumn> columns = new List <LogColumn>();

            columns.Add(LogColumn.GetInstance(p1, units, null, false));
            columns.Add(LogColumn.GetInstance(p2, cubits, null, false));
            columns.Add(LogColumn.GetInstance(p3, torks, null, false));
            this.readOnlyColumns = new ReadOnlyCollection <LogColumn>(columns);
            foreach (LogColumn column in columns)
            {
                double unused;
                string value;
                column.Conversion.Convert(0, out value, out unused);
                column.ValueAsString = value;
            }
        }
示例#7
0
        public void ResetCloumns(LogTable lt)
        {
            this.dataGridView1.Rows.Clear();
            this.dataGridView1.Columns.Clear();
            m_lstColsSeq.Clear();

            GC.Collect();

            // 加一个序号列
            DataGridViewColumn dgvc = CreateColumn("序号");

            this.dataGridView1.Columns.Add(dgvc);

            foreach (LogTableItem lti in lt.Columns)
            {
                LogColumn lc = LogColumnService.Instance.GetLogColumn(lti.LogColumnIndex);

                dgvc         = CreateColumn(string.IsNullOrWhiteSpace(lti.NickName) ? lc.Name : lti.NickName);
                dgvc.Visible = lti.Visible;
                dgvc.Tag     = lc.Index;

                m_lstColsSeq.Add(lc.Index);

                this.dataGridView1.Columns.Add(dgvc);
            }
        }
示例#8
0
        private void SetRowContent(LogTable table, int rowIndex, bool isChecked)
        {
            LogTableItem item = GetLogTableItemRow(rowIndex);
            LogColumn    lc   = LogColumnService.Instance.GetLogColumn(item.LogColumnIndex);

            this.dataGridView1.Rows.RemoveAt(rowIndex);
            InsertRow(rowIndex, isChecked, item, lc);
        }
示例#9
0
        /// <summary>
        /// Adds a new log message row to the message window.
        /// </summary>
        /// <param name="column">The <see cref="LogColumn"/> that should be represented by the new row.</param>
        private void AddLogMsgRowItem(LogColumn column)
        {
            RowStyle baseStyle = tblLogMessage.RowStyles[0];

            tblLogMessage.RowCount++;

            tblLogMessage.RowStyles.Add(new RowStyle(
                                            baseStyle.SizeType
                                            , baseStyle.Height));

            tblLogMessage.Controls.Add(new Label()
            {
                Text     = column.Name,
                AutoSize = true,
                Margin   = new Padding(3, 1, 10, 1),
                Padding  = new Padding(4),
                Tag      = column,
                Font     = mBoldCaptionFont
            }, 0, tblLogMessage.RowCount - 1);

            TextBox txtValue = new TextBox()
            {
                BorderStyle = BorderStyle.None,
                ReadOnly    = true,
                Dock        = DockStyle.Fill,
                Margin      = new Padding(3, 4, 3, 1),
                BackColor   = ThemeManager.CurrentApplicationTheme.ColorPalette.ContentBackground,
                ForeColor   = ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground,
                Tag         = column
            };

            tblLogMessage.Controls.Add(
                txtValue
                , 1
                , tblLogMessage.RowCount - 1);

            PictureBoxEx pbxCopyButton = new PictureBoxEx()
            {
                BackgroundImageLayout = ImageLayout.Center,
                Cursor  = Cursors.Hand,
                Image   = ThemeManager.CurrentApplicationTheme.Resources.Images["FrmScriptTbCopy"],
                Margin  = new Padding(2, 2, 1, 1),
                Size    = new Size(17, 18),
                Visible = false
            };

            pbxCopyButton.Click += (sender, e) =>
                                   pbxCopyButton.CopyToClipboard(txtValue.Text);

            tltTip.SetToolTip(pbxCopyButton, string.Format(
                                  Resources.strMessageDetailsCopyButtonTooltip
                                  , column.Name));

            tblLogMessage.Controls.Add(
                pbxCopyButton
                , 2
                , tblLogMessage.RowCount - 1);
        }
示例#10
0
        private void cmImportColumns_Click(object sender, EventArgs e)
        {
            XmlTextReader reader = null;

            this.Cursor = Cursors.WaitCursor;

            try
            {
                StringBuilder sb = new StringBuilder();

                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "XML 文件(*.xml)|*.xml";

                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    reader = new XmlTextReader(ofd.FileName);
                    XmlSerializer    serializer = new XmlSerializer(typeof(List <LogColumn>));
                    List <LogColumn> columns    = (List <LogColumn>)serializer.Deserialize(reader);

                    foreach (LogColumn col in columns)
                    {
                        if (LogColumnService.Instance.IsColumnIndexExist(col.Index) ||
                            m_newItems.ContainsKey(col.Index))
                        {
                            sb.AppendLine(string.Format("日志列\"{0}\"的编号\"{1}\"已经存在,无法导入", col.Name, col.Index));
                            continue;
                        }

                        LogColumn lc = (LogColumn)col.Clone();
                        this.dataGridView1.Rows.Add(new object[] { false, this.dataGridView1.Rows.Count + 1, lc.Index, lc.Name, lc.Type });
                        DataGridViewRow dgvr = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1];
                        dgvr.Tag = lc.Index;

                        m_newItems.Add(lc.Index, lc);
                    }

                    if (sb.Length > 0)
                    {
                        MessageBox.Show(sb.ToString(), "警告", MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入日志列集合失败,错误消息为:" + ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;

                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
示例#11
0
            public static LogColumn FromLogColumnPlus(LogColumnPlus pCol)
            {
                LogColumn col = new LogColumn();

                col.Type  = pCol.Type;
                col.Name  = pCol.Name;
                col.Index = pCol.Index;

                return(col);
            }
示例#12
0
            public static LogColumnPlus ToLogColumnPlus(LogColumn col)
            {
                LogColumnPlus p = new LogColumnPlus();

                p.Index = col.Index;
                p.Name  = col.Name;
                p.Type  = col.Type;

                return(p);
            }
示例#13
0
        private void cmExportSelectedColumns_Click(object sender, EventArgs e)
        {
            XmlTextWriter writer = null;

            this.Cursor = Cursors.WaitCursor;

            try
            {
                List <LogColumn> lstColumns = new List <LogColumn>();

                foreach (DataGridViewRow dgvr in this.dataGridView1.Rows)
                {
                    if (Convert.ToBoolean(dgvr.Cells[RowSelectIndex].Value))
                    {
                        LogColumn lc = LogColumnService.Instance.CreateNewLogColumn(
                            Convert.ToString(dgvr.Cells[LogColumnNameIndex].Value),
                            Convert.ToString(dgvr.Cells[LogColumnType].Value));
                        lc.Index = Convert.ToInt32(dgvr.Cells[LogColumnIndex].Value);

                        lstColumns.Add(lc);
                    }
                }

                if (lstColumns.Count <= 0)
                {
                    throw new Exception("没有选中任一列,请选中要导出的列集合");
                }

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName = "日志列定义集合.xml";
                sfd.Filter   = "XML 文件(*.xml)|*.xml";

                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string fileName = sfd.FileName;
                    writer = new XmlTextWriter(fileName, Encoding.Default);
                    XmlSerializer serializer = new XmlSerializer(typeof(List <LogColumn>));
                    serializer.Serialize(writer, lstColumns);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导出日志列集合失败,错误消息为:" + ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;

                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
示例#14
0
        public void AddLogColumn(LogColumn column)
        {
            if (m_logColumns.ContainsKey(column.Index))
            {
                return;
            }

            DBService.Instance.AddLogColumn(column);

            m_logColumns.Add(column.Index, column);
        }
示例#15
0
        public LogColumn CreateNewLogColumn(string name, string type)
        {
            LogColumn lc = new LogColumn();

            lc.Name  = name;
            lc.Type  = type;
            lc.Index = m_maxItemIndex;

            m_maxItemIndex++;
            return(lc);
        }
示例#16
0
        private static bool FindMatch(string strLogEntry, string strColumnRow, LogColumn Column, string ColVal)
        {
            bool   found = false;
            int    x     = strColumnRow.IndexOf(Column.ToString());
            string value = strLogEntry.Substring(x, ColVal.Length);

            if (value == ColVal)
            {
                found = true;
            }
            return(found);
        }
示例#17
0
        /// <summary>
        /// Gets a <see cref="DataGridViewRow"/> that tags the spezified <paramref name="column."/>
        /// </summary>
        /// <param name="column">The <see cref="LogColumn"/> that is tagged in a <see cref="DataGridViewRow"/>.</param>
        /// <returns>The <see cref="DataGridViewRow"/> that tags the spezified <paramref name="column."/>; or <c>null</c> if none is found.</returns>
        private DataGridViewRow GetRowWithTag(LogColumn column)
        {
            foreach (DataGridViewRow dgvRow in dgvResult.Rows)
            {
                if (Equals(dgvRow.Tag, column))
                {
                    return(dgvRow);
                }
            }

            return(null);
        }
示例#18
0
        public SecurityCondition GetEditedCondition()
        {
            SecurityCondition sc = SecurityCondition.CreateSecurityCondition(Convert.ToString(this.Tag));

            if (!CheckRelation())
            {
                return(sc);
            }

            sc.RelationName = comboRelation.Text;

            if (this.combo1st.SelectedIndex >= 0)
            {
                LogColumn col = m_lstColumns[this.combo1st.SelectedIndex];
                sc.SourceCol = col.Index;

                IRelation relation = RelationService.Instance.GetRelation(col.Type, comboRelation.Text);

                if (relation.ParamsCount == 1)
                {
                    if (rbConstant.Checked)
                    {
                        sc.SetContent(txtContent.Text);
                    }
                    else
                    {
                        sc.IsUsingDestCol = true;
                        sc.DestinationCol = m_matchedColumns[comboContent.SelectedIndex].Index;
                        sc.SetContent(sc.DestinationCol.ToString());
                    }
                }
                else if (relation.ParamsCount == 2)
                {
                    List <string> lstContent = new List <string>();

                    if (rbConstant.Checked)
                    {
                        lstContent.Add(txtLeftBound.Text);
                        lstContent.Add(txtRightBound.Text);
                    }
                    else
                    {
                        sc.IsUsingDestCol = true;
                        lstContent.Add(m_matchedColumns[comboLeftBound.SelectedIndex].Index.ToString());
                        lstContent.Add(m_matchedColumns[comboRightBound.SelectedIndex].Index.ToString());
                    }

                    sc.SetMultiValues(lstContent);
                }
            }

            return(sc);
        }
示例#19
0
        private void button1_Click(object sender, EventArgs e)
        {
            // 新建的列允许更改列编号,但是需要检测编号是否重复

            LogColumn lc = LogColumnService.Instance.CreateNewLogColumn(ConstColumnValue.DefaultLogColumnName, ConstColumnValue.DefaultLogColumnType);

            this.dataGridView1.Rows.Add(new object[] { false, this.dataGridView1.Rows.Count + 1, lc.Index, lc.Name, lc.Type });
            DataGridViewRow dgvr = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1];

            dgvr.Tag = lc.Index;
            dgvr.Cells[LogColumnIndex].ReadOnly        = false;
            dgvr.Cells[LogColumnIndex].Style.BackColor = Color.White;

            m_newItems.Add(lc.Index, lc);
        }
示例#20
0
        protected override void GetDataPoint(
            LogRow data,
            out double xValue,
            out double yValue,
            out string xName,
            out string yName)
        {
            LogColumn x = data.GetColumn(this.xParameterName);
            LogColumn y = data.GetColumn(this.yParameterName);

            xValue = x.ValueAsDouble;
            yValue = y.ValueAsDouble;
            xName  = x.Conversion.Units;
            yName  = y.Conversion.Units;
        }
示例#21
0
        protected override void GetDataPoint(
            LogRow data,
            out double xValue,
            out double yValue,
            out string xName,
            out string yName)
        {
            LogColumn x = data.GetColumn(this.xParameterName);
            LogColumn y = data.GetColumn(this.yParameterName);

            xValue = x.ValueAsDouble / 453.6d * 60d; // g/s to lb/min
            yValue = y.ValueAsDouble;                // TODO: calc from actual atmos pressure
            xName  = "lb/min";
            yName  = "PR";
        }
示例#22
0
        public void SetCondition(SecurityCondition condition)
        {
            this.Tag = condition.ConditionGuid;

            this.combo1st.SelectedIndex = FindLogColumnArrayIndex(m_lstColumns, condition.SourceCol);
            this.comboRelation.Text     = condition.RelationName;
            this.rbAnotherCol.Checked   = condition.IsUsingDestCol;
            this.rbConstant.Checked     = !condition.IsUsingDestCol;

            if (this.combo1st.SelectedIndex >= 0)
            {
                LogColumn col = m_lstColumns[this.combo1st.SelectedIndex];

                IRelation relation = RelationService.Instance.GetRelation(col.Type, comboRelation.Text);

                if (relation.ParamsCount == 1)
                {
                    if (condition.IsUsingDestCol)
                    {
                        this.comboContent.SelectedIndex = FindLogColumnArrayIndex(m_matchedColumns, condition.DestinationCol);
                    }
                    else
                    {
                        txtContent.Text = condition.GetContent();
                    }
                }
                else if (relation.ParamsCount == 2)
                {
                    string firstValue  = condition.MultiValues.Count > 0 ? condition.MultiValues[0] : string.Empty;
                    string secondValue = condition.MultiValues.Count > 1 ? condition.MultiValues[1] : string.Empty;

                    if (condition.IsUsingDestCol)
                    {
                        this.comboLeftBound.SelectedIndex  = FindLogColumnArrayIndex(m_matchedColumns, Convert.ToInt32(firstValue));
                        this.comboRightBound.SelectedIndex = FindLogColumnArrayIndex(m_matchedColumns, Convert.ToInt32(secondValue));
                    }
                    else
                    {
                        this.txtLeftBound.Text  = firstValue;
                        this.txtRightBound.Text = secondValue;
                    }
                }
            }

            SaveInitValue(condition);
            UpdateExpression();
        }
示例#23
0
        public void LogFilterTwoLogs()
        {
            int          iteration     = 1;
            MemoryStream memoryStream1 = new MemoryStream();
            MemoryStream memoryStream2 = new MemoryStream();

            LogRow    row    = LogRow.GetInstance(this.readOnlyColumns);
            LogColumn column = this.readOnlyColumns[0];
            LogFilter filter = LogFilter.GetTestInstance(
                delegate
            {
                if (iteration == 1)
                {
                    return(LogWriter.GetInstance(memoryStream1, false));
                }
                else
                {
                    return(LogWriter.GetInstance(memoryStream2, false));
                }
            },
                column.Parameter,
                column.Conversion);

            LogFilter.SetDefaultBehavior(true);

            filter.LogStart(row);
            filter.LogEntry(row);
            filter.LogEntry(row);
            filter.LogStop();
            iteration = 2;
            filter.LogStart(row);
            filter.LogEntry(row);
            filter.LogEntry(row);
            filter.LogStop();

            string actual   = Encoding.ASCII.GetString(memoryStream1.ToArray());
            string expected =
                "Parameter1, Parameter2, Parameter3" + Environment.NewLine +
                "0, 0.0, 0.00" + Environment.NewLine +
                "0, 0.0, 0.00" + Environment.NewLine;

            Assert.AreEqual(expected, actual, "first log");

            actual = Encoding.ASCII.GetString(memoryStream2.ToArray());
            Assert.AreEqual(expected, actual, "second log");
        }
示例#24
0
        /// <summary>
        /// Get a data point for the heat map
        /// </summary>
        protected override bool GetDataPoint(
            LogRow data,
            out float xValue,
            out float yValue,
            out float zValue,
            out string zName)
        {
            LogColumn x = data.GetColumn(this.xParameterName);
            LogColumn y = data.GetColumn(this.yParameterName);
            LogColumn z = data.GetColumn(this.zParameterName);

            xValue = (float)x.ValueAsDouble;
            yValue = (float)y.ValueAsDouble;
            zValue = (float)z.ValueAsDouble;

            zName = z.Conversion.Units;
            return(true);
        }
示例#25
0
        public void SaveInitValue(SecurityCondition condition)
        {
            this.lblStatus.Text  = string.Empty;
            this.btnSave.Visible = false;

            m_initValueOfCombo1st      = this.combo1st.Text;
            m_initValueOfComboRelation = this.comboRelation.Text;
            m_initValueOfRbAnotherCol  = this.rbAnotherCol.Checked;
            m_initValueOfRbConstant    = this.rbConstant.Checked;

            if (this.combo1st.SelectedIndex <= 0)
            {
                return;
            }

            LogColumn col = m_lstColumns[this.combo1st.SelectedIndex];

            IRelation relation = RelationService.Instance.GetRelation(col.Type, comboRelation.Text);

            if (relation.ParamsCount == 1)
            {
                if (condition.IsUsingDestCol)
                {
                    m_initValueOfComboContent = this.comboContent.Text;
                }
                else
                {
                    m_initValueOfTxtContent = txtContent.Text;
                }
            }
            else if (relation.ParamsCount == 2)
            {
                if (condition.IsUsingDestCol)
                {
                    m_initValueOfComboLeftBound  = this.comboLeftBound.Text;
                    m_initValueOfComboRightBound = this.comboRightBound.Text;
                }
                else
                {
                    this.m_initValueOfTxtLeftBound  = this.txtLeftBound.Text;
                    this.m_initValueOfTxtRightBound = this.comboRightBound.Text;
                }
            }
        }
示例#26
0
        private void combo1st_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(combo1st.Text))
            {
                LogColumn col = m_lstColumns[this.combo1st.SelectedIndex];

                InitRelation(col.Type);

                if (comboRelation.Items.Count > 0)
                {
                    comboRelation.SelectedIndex = 0;
                }

                m_matchedColumns = GetMatchedColumns(col.Type);

                FillCombobox(comboContent, m_matchedColumns);
                FillCombobox(comboLeftBound, m_matchedColumns);
                FillCombobox(comboRightBound, m_matchedColumns);
            }

            UpdateExpression();
        }
示例#27
0
        private void comboRelation_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.comboRelation.SelectedIndex >= 0)
            {
                LogColumn col = m_lstColumns[this.combo1st.SelectedIndex];

                IRelation relation = RelationService.Instance.GetRelation(col.Type, comboRelation.Text);

                if (relation.ParamsCount == 1)
                {
                    this.txtContent.Enabled    = true;
                    this.txtLeftBound.Enabled  = false;
                    this.txtRightBound.Enabled = false;

                    this.comboContent.Enabled    = true;
                    this.comboLeftBound.Enabled  = false;
                    this.comboRightBound.Enabled = false;
                }
                else if (relation.ParamsCount == 2)
                {
                    this.txtContent.Enabled    = false;
                    this.txtLeftBound.Enabled  = true;
                    this.txtRightBound.Enabled = true;

                    this.comboContent.Enabled    = false;
                    this.comboLeftBound.Enabled  = true;
                    this.comboRightBound.Enabled = true;
                }
                else
                {
                    MessageBox.Show("暂时不支持2个参数上的关系");
                    this.tpCol.Parent      = null;
                    this.tpConstant.Parent = null;
                }

                UpdateExpression();
            }
        }
示例#28
0
        private string GetConditionExpression()
        {
            if (string.IsNullOrWhiteSpace(this.combo1st.Text))
            {
                return(string.Empty);
            }

            if (string.IsNullOrWhiteSpace(this.comboRelation.Text))
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("\"" + this.combo1st.Text + "\" ");
            sb.Append(this.comboRelation.Text + " \"");

            LogColumn col      = m_lstColumns[this.combo1st.SelectedIndex];
            IRelation relation = RelationService.Instance.GetRelation(col.Type, comboRelation.Text);

            if (relation.ParamsCount == 1)
            {
                sb.Append(this.rbConstant.Checked ? this.txtContent.Text : this.comboContent.Text);
                sb.Append("\"");
            }
            else if (relation.ParamsCount == 2)
            {
                sb.Append(this.rbConstant.Checked ? (this.txtLeftBound.Text + "\" 与 \"" + this.txtRightBound.Text + "\" 之间") :
                          (this.comboLeftBound.Text + "\" 与 \"" + this.comboRightBound.Text + "\" 之间"));
            }
            else
            {
                sb.Clear();
                sb.Append("错误:暂时不支持2个参数上的关系");
            }

            return(sb.ToString());
        }
示例#29
0
        /// <summary>
        /// Draw a single cell
        /// </summary>
        private void DrawCell(LogColumn data, int column, int row)
        {
            int        left   = this.cellWidth * column;
            int        right  = left + this.cellWidth;
            int        top    = this.cellHeight * row;
            int        bottom = top + this.cellHeight;
            RectangleF cell   = new RectangleF(left, top, this.cellWidth, this.cellHeight);

            this.DrawTextAtTop(
                data.Parameter.Name,
                cell,
                minorTextBrush);

            this.DrawTextCentered(
                data.ValueAsString,
                cell,
                majorTextBrush);

            this.DrawTextAtBottom(
                data.Conversion.Units,
                cell,
                minorTextBrush);
        }
示例#30
0
        public int GetOrAllocateOrdinal(string name)
        {
            for (int i = 0; i < Columns.Count; ++i)
            {
                if (Columns[i].Name == name)
                {
                    return(Columns[i].Ordinal);
                }
            }

            LogColumn lc = new LogColumn();

            lc.Name    = name;
            lc.Visible = Columns.Count < 20;
            lc.Width   = 100;
            lc.Ordinal = Columns.Count;
            Columns.Add(lc);
            if (lc.Visible && TabPanel != null)
            {
                TabPanel.ReloadColumns();
            }
            return(lc.Ordinal);
        }