Пример #1
0
 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);
     }
 }
Пример #2
0
        /// <summary>
        /// 初始化 项目单元数据.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="initArray"></param>
        protected void InitBaseItemData(ItemMaster result, int[,] initArray)
        {
            // 取得二维数组的 边长.
            sizeOfArray = Convert.ToInt32(Math.Sqrt(initArray.Length));

            // 遍历二维数组, 填写数据.
            for (int i = 0; i < sizeOfArray; i++)
            {
                for (int j = 0; j < sizeOfArray; j++)
                {
                    if (initArray[i, j] == 0)
                    {
                        // 等于零的情况.
                        DynamicsItem item = new DynamicsItem()
                        {
                            X = i,
                            Y = j,
                        };

                        // 初始化.
                        item.InitDefaultList(9);

                        // 加入 结果列表.
                        result.DynamicsItemList.Add(item);
                    }
                    else
                    {
                        // 非零的情况.
                        FixedItem item = new FixedItem()
                        {
                            X         = i,
                            Y         = j,
                            IintValue = initArray[i, j],
                        };

                        // 加入 固定结果列表.
                        result.FixItemList.Add(item);
                    }
                }
            }
        }
Пример #3
0
 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;
     }
 }
Пример #4
0
 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);
     }
 }