Exemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////////

        private TableViewCell CreateTableCell(TableView table, ref ConsoleViewCellEntry entry)
        {
            if (entry.IsPlain || entry.IsTable)
            {
                ConsoleTextEntryView cell;

                if (entry.level == LogLevel.Exception)
                {
                    ConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell <ConsoleTextEntryExceptionView>();
                    if (exceptionCell == null)
                    {
                        exceptionCell = new ConsoleTextEntryExceptionView();
                    }
                    exceptionCell.StackTraceLines = entry.data as StackTraceLine[];

                    cell = exceptionCell;
                }
                else
                {
                    cell = table.DequeueReusableCell <ConsoleTextEntryView>();
                    if (cell == null)
                    {
                        cell = new ConsoleTextEntryView();
                    }
                }

                // set the size first to calculate individual lines height
                ColorCode colorCode = entry.level != null ? entry.level.Color : ColorCode.Plain;
                cell.TextColor = EditorSkin.GetColor(colorCode);
                cell.Width     = entry.width;
                cell.Height    = entry.height;

                cell.Value      = entry.value;
                cell.LogLevel   = entry.level;
                cell.StackTrace = entry.stackTrace;

                return(cell);
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
Exemplo n.º 2
0
        //////////////////////////////////////////////////////////////////////////////
        private TableViewCell CreateTableCell(TableView table, ref ConsoleViewCellEntry entry)
        {
            if (entry.IsPlain || entry.IsTable)
            {
                ConsoleTextEntryView cell;

                if (entry.level == LogLevel.Exception)
                {
                    ConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell<ConsoleTextEntryExceptionView>();
                    if (exceptionCell == null)
                    {
                        exceptionCell = new ConsoleTextEntryExceptionView();
                    }
                    exceptionCell.StackTraceLines = entry.data as StackTraceLine[];

                    cell = exceptionCell;
                }
                else
                {
                    cell = table.DequeueReusableCell<ConsoleTextEntryView>();
                    if (cell == null)
                    {
                        cell = new ConsoleTextEntryView();
                    }
                }

                // set the size first to calculate individual lines height
                ColorCode colorCode = entry.level != null ? entry.level.Color : ColorCode.Plain;
                cell.TextColor = EditorSkin.GetColor(colorCode);
                cell.Width = entry.width;
                cell.Height = entry.height;

                cell.Value = entry.value;
                cell.LogLevel = entry.level;
                cell.StackTrace = entry.stackTrace;

                return cell;
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }