Example #1
0
 public GameBrowser()
     : base(800, 600, GraphicsMode.Default, "Game Browser")
 {
     VSync = VSyncMode.On;
     m_domTreeBuilder = new DOMTreeBuilder();
     m_styleRulesBuilder = new StyleRulesBuilder();
     m_renderTreeBuilder = new RenderTreeBuilder();
 }
 public int TitleFormatRender(RenderTreeBuilder renderTreeBuilder, int seq)
 {
     return(seq);
 }
Example #3
0
 protected override void BuildRenderTree(RenderTreeBuilder builder) => builder.AddContent(0, ChildContent);
Example #4
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 => _renderFragment(builder);
Example #5
0
 protected override void RenderAdditionalElementContent(RenderTreeBuilder builder, ref int sequence)
 {
     RenderTreeBuilderHelper.AddDataTemplateProperty(builder, sequence++, typeof(ItemsView <T>), nameof(ItemTemplate), ItemTemplate);
     RenderTreeBuilderHelper.AddContentProperty(builder, sequence++, typeof(ItemsView <T>), nameof(EmptyView), EmptyView);
 }
Example #6
0
 /// <inheritdoc/>
 public int BuildComponent(object model, PropertyInfo propertyInfo, RenderTreeBuilder builder, int currentIndex) => this.BuildField <DateTime, DateField>(model, propertyInfo, builder, currentIndex);
Example #7
0
 public int TitleFormatRender(RenderTreeBuilder renderTreeBuilder, int seq, NavigationManager _)
 {
     return(seq);
 }
Example #8
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (builder != null)
            {
                base.BuildRenderTree(builder);
                // According to Ant-Design 4.0, Fallback to 1 if level is invalid.

                builder.OpenElement(1, "span");
                builder.AddAttribute(2, "class", this.ClassMapper.Class);
                builder.AddAttribute(3, "style", Style);
                if (Mark)
                {
                    builder.OpenElement(4, "mark");
                }
                if (Delete)
                {
                    builder.OpenElement(5, "del");
                }
                if (Underline)
                {
                    builder.OpenElement(6, "u");
                }
                if (Code)
                {
                    builder.OpenElement(7, "code");
                }
                if (Keyboard)
                {
                    builder.OpenElement(8, "kbd");
                }
                if (Strong)
                {
                    builder.OpenElement(9, "strong");
                }
                builder.AddContent(10, ChildContent);
                if (Strong)
                {
                    builder.CloseElement();
                }
                if (Code)
                {
                    builder.CloseElement();
                }
                if (Keyboard)
                {
                    builder.CloseElement();
                }
                if (Underline)
                {
                    builder.CloseElement();
                }
                if (Delete)
                {
                    builder.CloseElement();
                }
                if (Mark)
                {
                    builder.CloseElement();
                }
                if (Copyable)
                {
                    builder.OpenElement(11, "a");
                    builder.AddAttribute(12, "onclick", (Action)(async() => await Copy()));
                    builder.OpenComponent <Icon>(13);
                    builder.AddAttribute(14, "Type", "copy");
                    builder.AddAttribute(15, "Theme", IconThemeType.Outline);
                    builder.CloseComponent();
                    builder.CloseElement();
                }
                builder.AddElementReferenceCapture(16, r => Ref = r);
                builder.CloseElement();
            }
        }
Example #9
0
 internal static void OpenElement(this RenderTreeBuilder builder, string elementName, [CallerLineNumber] int lineNo = 0)
 {
     builder.OpenElement(lineNo, elementName);
 }
Example #10
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     // This component doesn't render anything; it forwards all its data to its container (Grid)
 }
Example #11
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, $"Hello from the page with message '{Message}'");
 }
Example #12
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            int k = -1;

            builder.OpenElement(k++, "div");
            builder.AddAttribute(k++, "id", "listitem" + bwsMessage.ID); // + Guid.NewGuid().ToString("d").Substring(1, 4));
            builder.AddAttribute(k++, "style", "width:400px;max-height:26px;position:relative;margin:5px");
            builder.OpenElement(k++, "span");



            if (bwsMessage.MessageType == BwsMessageType.send)
            {
                builder.AddAttribute(k++, "style", "position:absolute;top:0px;cursor:pointer;color:blue");
            }
            else
            {
                builder.AddAttribute(k++, "style", "position:absolute;top:0px;cursor:pointer;color:green");
            }



            switch (bwsMessage.TransportType)
            {
            case BwsTransportType.Text:
                builder.AddContent(k++, bwsMessage.ID + " " +
                                   bwsMessage.Date.ToString("HH:mm:ss.fff") + " " +
                                   bwsMessage.MessageType.ToString() + " " +
                                   bwsMessage.TransportType.ToString().ToLower() + ": " +
                                   bwsMessage.Message);
                break;

            case BwsTransportType.ArrayBuffer:
                builder.AddContent(k++, bwsMessage.ID + " " +
                                   bwsMessage.Date.ToString("HH:mm:ss.fff") + " " +
                                   bwsMessage.MessageType.ToString() + " " +
                                   bwsMessage.TransportType.ToString().ToLower() + ": " +
                                   bwsMessage.Message +
                                   " [" + bwsMessage.MessageBinaryVisual +
                                   "]");
                //}
                break;

            case BwsTransportType.Blob:
                break;

            default:
                break;
            }



            builder.CloseElement();

            builder.CloseElement();


            //BlazorTimeAnalyzer.Add("BuildRenderTree", MethodBase.GetCurrentMethod());

            base.BuildRenderTree(builder);
        }
Example #13
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (builder != null)
            {
                base.BuildRenderTree(builder);

                string container = "input";

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    container = "groupWrapper";
                    builder.OpenElement(1, "span");
                    builder.AddAttribute(2, "class", GroupWrapperClass);
                    builder.AddAttribute(3, "style", Style);
                    builder.OpenElement(4, "span");
                    builder.AddAttribute(5, "class", $"{PrefixCls}-wrapper {PrefixCls}-group");
                }

                if (AddOnBefore != null)
                {
                    // addOnBefore
                    builder.OpenElement(11, "span");
                    builder.AddAttribute(12, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(13, AddOnBefore);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.OpenElement(21, "span");
                    builder.AddAttribute(22, "class", AffixWrapperClass);
                    if (container == "input")
                    {
                        container = "affixWrapper";
                        builder.AddAttribute(23, "style", Style);
                    }
                    if (WrapperRefBack != null)
                    {
                        builder.AddElementReferenceCapture(24, r => WrapperRefBack.Current = r);
                    }
                }

                if (Prefix != null)
                {
                    // prefix
                    builder.OpenElement(31, "span");
                    builder.AddAttribute(32, "class", $"{PrefixCls}-prefix");
                    builder.AddContent(33, Prefix);
                    builder.CloseElement();
                }

                // input
                builder.OpenElement(41, "input");
                builder.AddAttribute(42, "class", ClassMapper.Class);
                if (container == "input")
                {
                    builder.AddAttribute(43, "style", Style);
                }

                bool needsDisabled = Disabled;
                if (Attributes != null)
                {
                    builder.AddMultipleAttributes(44, Attributes);
                    if (!Attributes.TryGetValue("disabled", out object disabledAttribute))
                    {
                        needsDisabled = ((bool?)disabledAttribute ?? needsDisabled) | Disabled;
                    }
                }

                if (AdditionalAttributes != null)
                {
                    builder.AddMultipleAttributes(45, AdditionalAttributes);
                    if (!AdditionalAttributes.TryGetValue("disabled", out object disabledAttribute))
                    {
                        needsDisabled = ((bool?)disabledAttribute ?? needsDisabled) | Disabled;
                    }
                }

                builder.AddAttribute(50, "Id", Id);
                builder.AddAttribute(51, "type", Type);
                builder.AddAttribute(60, "placeholder", Placeholder);
                builder.AddAttribute(61, "value", CurrentValue);
                builder.AddAttribute(62, "disabled", needsDisabled);

                // onchange 和 onblur 事件会导致点击 OnSearch 按钮时不触发 Click 事件,暂时取消这两个事件
                if (!IgnoreOnChangeAndBlur)
                {
                    builder.AddAttribute(70, "onchange", CallbackFactory.Create(this, OnChangeAsync));
                    builder.AddAttribute(71, "onblur", CallbackFactory.Create(this, OnBlurAsync));
                }

                builder.AddAttribute(72, "onkeypress", CallbackFactory.Create(this, OnKeyPressAsync));
                builder.AddAttribute(73, "onkeydown", CallbackFactory.Create(this, OnkeyDownAsync));
                builder.AddAttribute(74, "onkeyup", CallbackFactory.Create(this, OnKeyUpAsync));
                builder.AddAttribute(75, "oninput", CallbackFactory.Create(this, OnInputAsync));
                builder.AddAttribute(76, "onfocus", CallbackFactory.Create(this, OnFocusAsync));
                builder.AddAttribute(77, "onmouseup", CallbackFactory.Create(this, OnMouseUpAsync));
                builder.AddElementReferenceCapture(90, r => Ref = r);
                builder.CloseElement();

                if (Suffix != null)
                {
                    // suffix
                    builder.OpenElement(91, "span");
                    builder.AddAttribute(92, "class", $"{PrefixCls}-suffix");
                    builder.AddContent(93, Suffix);
                    builder.CloseElement();
                }

                if (Prefix != null || Suffix != null)
                {
                    builder.CloseElement();
                }

                if (AddOnAfter != null)
                {
                    // addOnAfter
                    builder.OpenElement(100, "span");
                    builder.AddAttribute(101, "class", $"{PrefixCls}-group-addon");
                    builder.AddContent(102, AddOnAfter);
                    builder.CloseElement();
                }

                if (AddOnBefore != null || AddOnAfter != null)
                {
                    builder.CloseElement();
                    builder.CloseElement();
                }
            }
        }
Example #14
0
 protected abstract void BuildRenderTree(RenderTreeBuilder builder);
Example #15
0
        private void BuildLinkList(RenderTreeBuilder builder, int index)
        {
            _pages.Clear();

            for (int i = CurrentPage - PagePadLinks; i < CurrentPage; i++)
            {
                if (i < 1)
                {
                    continue;
                }

                _pages.Add(i);
            }

            _pages.Add(CurrentPage);

            for (int i = CurrentPage + 1; i <= CurrentPage + PagePadLinks; i++)
            {
                if (i < 2 || i > PageCount)
                {
                    continue;
                }

                _pages.Add(i);
            }

            var showFirstPage = false;

            if (!_pages.Contains(1))
            {
                showFirstPage = true;
            }

            var showLastPage = false;

            if (!_pages.Contains(PageCount) && PageCount > PagePadLinks + 1)
            {
                showLastPage = true;
            }

            builder.OpenRegion(index);
            builder.OpenElement(0, "ul");
            builder.AddAttribute(1, "class", "pagination-list");

            if (showFirstPage)
            {
                BuildFirstPageLink(builder, 2);
            }

            int el = 3;

            foreach (var page in _pages)
            {
                BuildPageLink(builder, el, page);

                el++;
            }

            if (showLastPage)
            {
                BuildLastPageLink(builder, el);
            }

            builder.CloseElement();
            builder.CloseRegion();
        }
Example #16
0
 internal static void AddElementReferenceCapture(this RenderTreeBuilder builder, Action <ElementReference> elementReferenceCaptureAction, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddElementReferenceCapture(lineNo, elementReferenceCaptureAction);
 }
Example #17
0
 internal static void AddMultipleAttributes(this RenderTreeBuilder builder, IEnumerable <KeyValuePair <string, object> >?attributes, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddMultipleAttributes(lineNo, attributes);
 }
Example #18
0
 /// <summary>
 /// Renders the component to the supplied <see cref="RenderTreeBuilder"/>.
 /// </summary>
 /// <param name="builder">The builder to use for rendering.</param>
 protected virtual void BuildRenderTree(RenderTreeBuilder builder)
 {
 }
Example #19
0
 internal static void AddAttribute <TArgument>(this RenderTreeBuilder builder, string name, EventCallback <TArgument> value, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddAttribute <TArgument>(lineNo, name, value);
 }
Example #20
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, ChildContent);
     //base.BuildRenderTree(builder);
 }
Example #21
0
 internal static void OpenRegion(this RenderTreeBuilder builder, [CallerLineNumber] int lineNo = 0)
 {
     builder.OpenRegion(lineNo);
 }
Example #22
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(1, "h2");
     builder.AddContent(2, Title);
     builder.CloseElement();
 }
Example #23
0
 internal static void AddContent(this RenderTreeBuilder builder, object?textContent, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddContent(lineNo, textContent);
 }
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "p");
     builder.AddContent(1, Counter);
     builder.CloseElement();
 }
Example #25
0
 internal static void AddMarkupContent(this RenderTreeBuilder builder, string?markupContent, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddMarkupContent(lineNo, markupContent);
 }
Example #26
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     NumRenders++;
     builder.AddContent(0, $"CascadingParameter={CascadingParameter}; RegularParameter={RegularParameter}");
 }
Example #27
0
 internal static void AddAttribute(this RenderTreeBuilder builder, string name, object?value, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddAttribute(lineNo, name, value);
 }
Example #28
0
 public override void Render(RenderTreeBuilder builder)
 {
     builder.OpenComponent <WasabiTextField>(0);
     builder.AddAttribute(1, "Text", Element.Text);
     builder.CloseComponent();
 }
Example #29
0
 internal static void OpenComponent <TComponent>(this RenderTreeBuilder builder, [CallerLineNumber] int lineNo = 0) where TComponent : IComponent
 {
     builder.OpenComponent <TComponent>(lineNo);
 }
Example #30
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.AddContent(0, "RootLayout starts here");
     builder.AddContent(1, Body);
     builder.AddContent(2, "RootLayout ends here");
 }
Example #31
0
 internal static void AddComponentReferenceCapture(this RenderTreeBuilder builder, Action <object> componentReferenceCaptureAction, [CallerLineNumber] int lineNo = 0)
 {
     builder.AddComponentReferenceCapture(lineNo, componentReferenceCaptureAction);
 }