public void SetUndefinedValue(int i)
 {
 	if (this.watchList.Rows[i].Cells[0].Value != null)
     {
 		this.ClearRow(i);
         //FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string,PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE"),PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE"));
         FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string,"","");
         //fi.imageIndex = CodeCompletionProvider.ImagesProvider.IconNumberEvalError;
         this.watchList.Rows[i].Cells[1].Value = fi.Text;
         this.watchList.Rows[i].Cells[2].Value = fi.Type;
         (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
         (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
         this.watchList.InvalidateCell(0,i);
 	}
 }
        public void RefreshRow(int i)
        {
            if (this.watchList.Rows[i].Cells[0].Value != null)
            {
                if ((this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).UserRow)
                {
                    string s = this.watchList.Rows[i].Cells[0].Value as string;
                    RetValue rv = WorkbenchServiceFactory.DebuggerManager.Evaluate(s);
                    if (rv.syn_err)
                    {
                        this.ClearRow(i);
                        FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string, PascalABCCompiler.StringResources.Get("EXPR_VALUE_SYNTAX_ERROR_IN_EXPR"), "");
                        fi.imageIndex = CodeCompletionProvider.ImagesProvider.IconNumberEvalError;
                        this.watchList.Rows[i].Cells[1].Value = fi.Text;
                        this.watchList.Rows[i].Cells[2].Value = fi.Type;
                        (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                        (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                    }
                    else
                        if (rv.obj_val != null)
                        {
                            //this.ClearRow(i);
                            try
                            {
                                ValueItem vi = new ValueItem(rv.obj_val, s, WorkbenchServiceFactory.DebuggerManager.evaluator.declaringType);
                                (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                                (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = vi;
                                this.watchList.Rows[i].Cells[1].Value = WorkbenchServiceFactory.DebuggerManager.MakeValueView(rv.obj_val);//rv.obj_val.AsString;
                                this.watchList.Rows[i].Cells[2].Value = DebugUtils.WrapTypeName(rv.obj_val.Type);
                                this.watchList.InvalidateCell(0, i);
                            }
                            catch (System.Exception e)
                            {
                                
                            }
                        }
                        else if (rv.prim_val != null)
                        {
                            //this.ClearRow(i);
                            FixedItem fi = new FixedItem(s, WrapPrimValue(rv.prim_val), DebugUtils.WrapTypeName(rv.prim_val.GetType()));
                            this.watchList.Rows[i].Cells[1].Value = fi.Text;
                            this.watchList.Rows[i].Cells[2].Value = fi.Type;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                            this.watchList.InvalidateCell(0, i);
                        }
                        else if (rv.type != null)
                        {
                            //this.ClearRow(i);
                            BaseTypeItem bti = new BaseTypeItem(rv.type, rv.managed_type);
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = bti;
                        }
                        else
                        {
                            this.ClearRow(i);
                            FixedItem fi = null;
                            if (WorkbenchServiceFactory.DebuggerManager.IsRunning)
                            {
                                fi = new FixedItem(s, rv.err_mes != null ? rv.err_mes : PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE"),/*PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE")*/"");
                                fi.imageIndex = CodeCompletionProvider.ImagesProvider.IconNumberEvalError;
                            }
                            else
                            {
                                fi = new FixedItem(s, "", "");
                            }
                            this.watchList.Rows[i].Cells[1].Value = fi.Text;
                            this.watchList.Rows[i].Cells[2].Value = fi.Type;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                            this.watchList.InvalidateCell(0, i);
                        }
                }
                else
                {

                }
            }
            else
            {
                //this.watchList.Rows[i].Cells[1].Value = null;
                //this.watchList.Rows[i].Cells[2].Value = null;
                if (i != this.watchList.Rows.Count - 1)
                {
                    this.ClearRow(i);
                    FixedItem fi = new FixedItem("", "", "");
                    this.watchList.Rows[i].Cells[1].Value = "";
                    this.watchList.Rows[i].Cells[2].Value = "";
                    (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                    (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                    this.watchList.InvalidateCell(0, i);
                    this.watchList.Rows.RemoveAt(i);
                }
                //this.watchList.InvalidateCell(0,i);
            }
        }
        public void RefreshRow(int i)
        {
            if (this.watchList.Rows[i].Cells[0].Value != null)
            {
                if ((this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).UserRow)
                {
                    RetValue rv = WorkbenchServiceFactory.DebuggerManager.Evaluate(this.watchList.Rows[i].Cells[0].Value as string);
                    if (rv.syn_err)
                    {
                        this.watchList.Rows[i].Cells[1].Value = PascalABCCompiler.StringResources.Get("EXPR_VALUE_SYNTAX_ERROR_IN_EXPR");
                        this.watchList.Rows[i].Cells[2].Value = null;//PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE");
                    }
                    else
                        if (rv.obj_val != null)
                        {
                            try
                            {
                                ValueItem vi = new ValueItem(rv.obj_val, this.watchList.Rows[i].Cells[0].Value as string, WorkbenchServiceFactory.DebuggerManager.evaluator.declaringType);
                                (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                                (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = vi;
                                this.watchList.Rows[i].Cells[1].Value = WorkbenchServiceFactory.DebuggerManager.MakeValueView(rv.obj_val);//rv.obj_val.AsString;
                                this.watchList.Rows[i].Cells[2].Value = DebugUtils.WrapTypeName(rv.obj_val.Type);
                                this.watchList.InvalidateCell(0, i);
                            }
                            catch (System.Exception e)
                            {
                                this.watchList.Rows[i].Cells[1].Value = PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE");
                                this.watchList.Rows[i].Cells[2].Value = PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE");
                                //								  FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string,PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE"),PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE"));
                                //								  fi.imageIndex = CodeCompletionProvider.ImagesProvider.IconNumberEvalError;
                                //								  (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                                //                            	  (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                            }
                        }
                        else if (rv.prim_val != null)
                        {
                            FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string, WrapPrimValue(rv.prim_val), DebugUtils.WrapTypeName(rv.prim_val.GetType()));
                            this.watchList.Rows[i].Cells[1].Value = fi.Text;
                            this.watchList.Rows[i].Cells[2].Value = fi.Type;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                        }
                        else
                        {
                            this.watchList.Rows[i].Cells[1].Value = PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE");
                            this.watchList.Rows[i].Cells[2].Value = PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE");
                            //                            FixedItem fi = new FixedItem(this.watchList.Rows[i].Cells[0].Value as string,PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_VALUE"),PascalABCCompiler.StringResources.Get("EXPR_VALUE_UNDEFINED_TYPE"));
                            //							fi.imageIndex = CodeCompletionProvider.ImagesProvider.IconNumberEvalError;
                            //							(this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
                            //                            (this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = fi;
                            this.ClearRow(i);
                        }
                }
                else
                {

                }
            }
            else
            {
                this.watchList.Rows[i].Cells[1].Value = null;
                this.watchList.Rows[i].Cells[2].Value = null;
            }
        }