Beispiel #1
0
 //_______________________________________________________________________________________________________________________
 internal void AddLinkInfoItem(string additionalInfo, TestObjectBase o, string sMenu = "", string sMenuLnk = "")
 {
     if (o != null)
     {
         AdditionalLinkedInfo.Add(new Tuple <int, int, string>(additionalInfo.Length - (sMenu.Length) - o.Name.Length - 1, o.Name.Length, o.Link));
     }
     if (sMenu != "" && sMenuLnk != "")
     {
         AdditionalLinkedInfo.Add(new Tuple <int, int, string>(additionalInfo.Length - (sMenu.Length) + 1, sMenu.Length - 3, sMenuLnk));
     }
 }
        //_______________________________________________________________________________________________________________________
        private void CDgVars_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            Location loc = (Location)TestObjectBase.LinkedObject(sLnkCurrentLocation);

            if (loc == null)
            {
                return;
            }
            if (cDgVars.Rows[e.RowIndex].Cells[0].Value.Equals(DBNull.Value))
            {
                if (e.ColumnIndex == 1)
                {
                    long id = TestsHelper.saveVariable(TestObjectBase.NO_ID, cDgVars.Rows[e.RowIndex].Cells[1].Value.ToString());
                    cDgVars.Rows[e.RowIndex].Cells[0].Value = id;
                }
                else if (e.ColumnIndex == 2 && cDgVars.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != "")
                {
                    string name = "$tstVar" + cDgVars.Rows.Count;
                    long   id   = TestsHelper.saveVariable(TestObjectBase.NO_ID, name);
                    TestsHelper.setLocationVariableValue(loc, id, cDgVars.Rows[e.RowIndex].Cells[2].Value.ToString());
                    cDgVars.Rows[e.RowIndex].Cells[0].Value = id;
                    cDgVars.Rows[e.RowIndex].Cells[1].Value = name;
                }
                else if (e.ColumnIndex == 3 && cDgVars.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != "")
                {
                    string name = "$tstVar" + cDgVars.Rows.Count;
                    long   id   = TestsHelper.saveVariable(TestObjectBase.NO_ID, name);
                    TestsHelper.saveVariableDetail(TestsHelper.getVariableByID(id), cDgVars.Rows[e.RowIndex].Cells[3].Value.ToString());
                    cDgVars.Rows[e.RowIndex].Cells[0].Value = id;
                    cDgVars.Rows[e.RowIndex].Cells[1].Value = name;
                }
                return;
            }
            if (e.ColumnIndex == 1)
            {
                TestsHelper.saveVariable((long)cDgVars.Rows[e.RowIndex].Cells[0].Value, cDgVars.Rows[e.RowIndex].Cells[1].Value.ToString());
            }
            else if (e.ColumnIndex == 2)
            {
                TestsHelper.saveLocationVariable(loc, TestsHelper.getVariableByID((long)cDgVars.Rows[e.RowIndex].Cells[0].Value));
                TestsHelper.setLocationVariableValue(loc, (long)cDgVars.Rows[e.RowIndex].Cells[0].Value, cDgVars.Rows[e.RowIndex].Cells[2].Value.ToString());
            }
            else if (e.ColumnIndex == 3)
            {
                TestsHelper.saveVariableDetail(TestsHelper.getVariableByID((long)cDgVars.Rows[e.RowIndex].Cells[0].Value), cDgVars.Rows[e.RowIndex].Cells[3].Value.ToString());
            }
            ShowLasError();
        }