コード例 #1
0
            public DocumentZone(HtmlHelper html, string targetZone, ZoneInjectMode injectMode, string key)
            {
                Guard.NotEmpty(targetZone, nameof(targetZone));

                _viewContext = html.ViewContext;
                _originalViewContextWriter = _viewContext.Writer;
                _page = (WebViewPage)html.ViewDataContainer;

                var writer = new StringWriter();

                _page.OutputStack.Push(writer);
                _viewContext.Writer = writer;

                _targetZone = targetZone;
                _injectMode = injectMode;

                if (key.HasValue())
                {
                    if (HasUniqueKey(key))
                    {
                        _isVoid = true;
                    }
                    else
                    {
                        UniqueKeys.Add(key);
                    }
                }

                if (_page.Request.IsAjaxRequest())
                {
                    _isVoid = true;
                }
            }
コード例 #2
0
 public static IDisposable BeginZoneContent(this HtmlHelper helper,
                                            string targetZone,
                                            ZoneInjectMode injectMode = ZoneInjectMode.Append,
                                            string key = null)
 {
     return(new DocumentZone(helper, targetZone, injectMode, key));
 }
コード例 #3
0
        public static IDisposable BeginZoneContent(this HtmlHelper helper,
                                                   string targetZone,
                                                   ZoneInjectMode injectMode = ZoneInjectMode.Append,
                                                   string key = null)
        {
            if (key.HasValue() && DocumentZone.HasUniqueKey(key))
            {
                return(ActionDisposable.Empty);
            }

            return(new DocumentZone((WebViewPage)helper.ViewDataContainer, targetZone, injectMode, key));
        }
コード例 #4
0
            public DocumentZone(WebViewPage page, string targetZone, ZoneInjectMode injectMode, string key)
            {
                Guard.NotEmpty(targetZone, nameof(targetZone));

                _page = page;
                _page.OutputStack.Push(new StringWriter());

                _targetZone = targetZone;
                _injectMode = injectMode;

                if (key.HasValue())
                {
                    UniqueKeys.Add(key);
                }
            }