示例#1
0
        private FormatMessagesContextManager.OutputContext CreateOutputContext(FormatMessagesContextManager.OutputContext parentContext, FormatInfoData formatInfoData)
        {
            FormatStartData formatData = formatInfoData as FormatStartData;
            if (formatData != null)
            {
                return new FormatOutputContext(parentContext, formatData);
            }
            GroupStartData data2 = formatInfoData as GroupStartData;
            if (data2 == null)
            {
                return null;
            }
            GroupOutputContext context2 = null;
            switch (this.ActiveFormattingShape)
            {
                case FormatShape.Table:
                    context2 = new TableOutputContext(this, parentContext, data2);
                    break;

                case FormatShape.List:
                    context2 = new ListOutputContext(this, parentContext, data2);
                    break;

                case FormatShape.Wide:
                    context2 = new WideOutputContext(this, parentContext, data2);
                    break;

                case FormatShape.Complex:
                    context2 = new ComplexOutputContext(this, parentContext, data2);
                    break;
            }
            context2.Initialize();
            return context2;
        }
示例#2
0
        /// <summary>
        /// class factory for output context
        /// </summary>
        /// <param name="parentContext">parent context in the stack</param>
        /// <param name="formatInfoData"> fromat info data received from the pipeline</param>
        /// <returns></returns>
        private FormatMessagesContextManager.OutputContext CreateOutputContext(
            FormatMessagesContextManager.OutputContext parentContext,
            FormatInfoData formatInfoData)
        {
            FormatStartData formatStartData = formatInfoData as FormatStartData;

            // initialize the format context
            if (formatStartData != null)
            {
                FormatOutputContext foc = new FormatOutputContext(parentContext, formatStartData);

                return(foc);
            }

            GroupStartData gsd = formatInfoData as GroupStartData;

            // we are starting a group, initialize the group context
            if (gsd != null)
            {
                GroupOutputContext goc = null;

                switch (ActiveFormattingShape)
                {
                case FormatShape.Table:
                {
                    goc = new TableOutputContext(this, parentContext, gsd);
                    break;
                }

                case FormatShape.List:
                {
                    goc = new ListOutputContext(this, parentContext, gsd);
                    break;
                }

                case FormatShape.Wide:
                {
                    goc = new WideOutputContext(this, parentContext, gsd);
                    break;
                }

                case FormatShape.Complex:
                {
                    goc = new ComplexOutputContext(this, parentContext, gsd);
                    break;
                }

                default:
                {
                    Diagnostics.Assert(false, "Invalid shape. This should never happen");
                }
                break;
                }
                goc.Initialize();
                return(goc);
            }

            return(null);
        }
示例#3
0
        private FormatMessagesContextManager.OutputContext CreateOutputContext(FormatMessagesContextManager.OutputContext parentContext, FormatInfoData formatInfoData)
        {
            FormatStartData formatData = formatInfoData as FormatStartData;

            if (formatData != null)
            {
                return(new FormatOutputContext(parentContext, formatData));
            }
            GroupStartData data2 = formatInfoData as GroupStartData;

            if (data2 == null)
            {
                return(null);
            }
            GroupOutputContext context2 = null;

            switch (this.ActiveFormattingShape)
            {
            case FormatShape.Table:
                context2 = new TableOutputContext(this, parentContext, data2);
                break;

            case FormatShape.List:
                context2 = new ListOutputContext(this, parentContext, data2);
                break;

            case FormatShape.Wide:
                context2 = new WideOutputContext(this, parentContext, data2);
                break;

            case FormatShape.Complex:
                context2 = new ComplexOutputContext(this, parentContext, data2);
                break;
            }
            context2.Initialize();
            return(context2);
        }
        /// <summary>
        /// class factory for output context
        /// </summary>
        /// <param name="parentContext">parent context in the stack</param>
        /// <param name="formatInfoData"> fromat info data received from the pipeline</param>
        /// <returns></returns>
        private FormatMessagesContextManager.OutputContext CreateOutputContext(
                                        FormatMessagesContextManager.OutputContext parentContext,
                                        FormatInfoData formatInfoData)
        {
            FormatStartData formatStartData = formatInfoData as FormatStartData;
            // initialize the format context 
            if (formatStartData != null)
            {
                FormatOutputContext foc = new FormatOutputContext(parentContext, formatStartData);

                return foc;
            }

            GroupStartData gsd = formatInfoData as GroupStartData;
            // we are starting a group, initialize the group context
            if (gsd != null)
            {
                GroupOutputContext goc = null;

                switch (ActiveFormattingShape)
                {
                    case FormatShape.Table:
                        {
                            goc = new TableOutputContext(this, parentContext, gsd);
                            break;
                        }

                    case FormatShape.List:
                        {
                            goc = new ListOutputContext(this, parentContext, gsd);
                            break;
                        }

                    case FormatShape.Wide:
                        {
                            goc = new WideOutputContext(this, parentContext, gsd);
                            break;
                        }

                    case FormatShape.Complex:
                        {
                            goc = new ComplexOutputContext(this, parentContext, gsd);
                            break;
                        }

                    default:
                        {
                            Diagnostics.Assert(false, "Invalid shape. This should never happen");
                        }
                        break;
                }
                goc.Initialize();
                return goc;
            }

            return null;
        }