当前位置: 首页>>代码示例>>C#>>正文


C# ITabContext类代码示例

本文整理汇总了C#中ITabContext的典型用法代码示例。如果您正苦于以下问题:C# ITabContext类的具体用法?C# ITabContext怎么用?C# ITabContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITabContext类属于命名空间,在下文中一共展示了ITabContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetData

 public override object GetData(ITabContext context)
 {
     return new
     {
         MessageQueues = MessageQueue.GetQueueStats()
     };
 }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:7,代码来源:DiagnosticsGlimpseTab.cs

示例2: GetData

 public override object GetData(ITabContext context)
 {
     var getInvocationsRequest = new GetInvocationsRequest();
     var getInvocationsResult = _getInvocationsHandler.Handle(getInvocationsRequest);
     var data = FormatInvocations(getInvocationsResult.Invocations);
     return data;
 }
开发者ID:BredStik,项目名称:Glimpse.SignalR,代码行数:7,代码来源:Plugin.cs

示例3: GetData

 /// <summary>
 /// The context should contain the reference to any mongo connections, and the relevant profile document selection we need to extract from those connections.
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public object GetData(ITabContext context)
 {
     var cutOff = DateTime.UtcNow - TimeSpan.FromSeconds(15);
     var results = new List<MongoProfileModel>();
     foreach (var server in MongoServer.GetAllServers())
     {
         foreach (var database in server.GetDatabaseNames())
         {
             var db = server.GetDatabase(database);
             if (db.CollectionExists("system.profile"))
             {
                 var query =
                         from e in db.GetCollection("system.profile").FindAllAs<SystemProfileInfo>()
                         where e.Namespace != database + ".system.profile" && e.Timestamp > cutOff
                         select new MongoProfileModel(e);
                 // skip one to miss the namespace query above
                 foreach (var d in query.OrderByDescending(x => x.Timestamp).Skip(1).Take(10))
                 {
                     results.Add(d);
                 }
             }
         }
     }
     return results;
 }
开发者ID:peters,项目名称:Glimpse.MongoDB,代码行数:30,代码来源:MongoDBTab.cs

示例4: GetData

        public override object GetData(ITabContext context)
        {
            try
            {
                var portalSettings = PortalSettings.Current;

                int totalRecords = 0;
                LogInfoArray logs = new LogController().GetLog(portalSettings.PortalId, 15, 0, ref totalRecords);

                if (logs.Count == 0)
                    return null;

                var data = new List<object[]> {new object[] {"Created Date", "Log Type", "UserName", "Content"}};
                for (int i = 0; i < logs.Count; i++)
                {
                    var log = logs.GetItem(i);

                    var logProperties = new List<object[]> {new object[] {"Property", "Value"}};
                    for (int j = 0; j < log.LogProperties.Count; j++)
                    {
                        var logDetail = (LogDetailInfo)log.LogProperties[j];
                        logProperties.Add(new object[] { logDetail.PropertyName, logDetail.PropertyValue });
                    }

                    data.Add(new object[] {log.LogCreateDate, log.LogTypeKey, log.LogUserName, logProperties});
                }

                return data;
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return "There was an error loading the data for this tab";
            }
        }        
开发者ID:jbrinkman,项目名称:DotNetNuke.Extensions.Glimpse,代码行数:35,代码来源:DNNLogViewerPlugin.cs

示例5: HandleNullFindViewMessageCollection

        public void HandleNullFindViewMessageCollection(Metadata sut, ITabContext context)
        {
            context.TabStore.Setup(ds => ds.Get(typeof(ViewEngine.FindViews.Message).FullName)).Returns<List<ViewEngine.FindViews.Message>>(null);
            context.TabStore.Setup(ds => ds.Get(typeof(View.Render.Message).FullName)).Returns(new List<View.Render.Message>());

            Assert.DoesNotThrow(() => sut.GetData(context));
        }
开发者ID:TFong1,项目名称:Glimpse,代码行数:7,代码来源:MetadataShould.cs

示例6: GetData

 public override object GetData(ITabContext context)
 {
     var getHubsRequest = new GetHubsRequest();
     var getHubsResult = _getHubsHandler.Handle(getHubsRequest);
     var data = FormatHubs(getHubsResult.Hubs);
     return data;
 }
开发者ID:stevenlauwers22,项目名称:Glimpse.SignalR,代码行数:7,代码来源:Plugin.cs

示例7: GetData

        public override object GetData(ITabContext context)
        {
            var cacheModel = new CacheModel();
            cacheModel.Configuration.EffectivePercentagePhysicalMemoryLimit = HttpRuntime.Cache.EffectivePercentagePhysicalMemoryLimit;
            cacheModel.Configuration.EffectivePrivateBytesLimit = HttpRuntime.Cache.EffectivePrivateBytesLimit;

            var list = HttpRuntime.Cache.Cast<DictionaryEntry>().ToList();
            foreach (var item in list)
            {
                try
                {
                    var cacheEntry = MethodInfoCacheGet.Invoke(HttpRuntime.Cache, new object[] { item.Key, 1 });

                    var cacheItemModel = new CacheItemModel();
                    cacheItemModel.Key = item.Key.ToString();
                    cacheItemModel.Value = Serialization.GetValueSafe(item.Value);
                    cacheItemModel.CreatedOn = GetCacheProperty(ProcessInfoUtcCreated, cacheEntry) as DateTime?;
                    cacheItemModel.ExpiresOn = GetCacheProperty(ProcessInfoUtcExpires, cacheEntry) as DateTime?;
                    cacheItemModel.SlidingExpiration = GetCacheProperty(ProcessInfoSlidingExpiration, cacheEntry) as TimeSpan?;

                    cacheModel.CacheItems.Add(cacheItemModel);
                }
                catch (Exception)
                {
                    return false;
                }
            }

            return cacheModel;
        }
开发者ID:jeffora,项目名称:Glimpse,代码行数:30,代码来源:Cache.cs

示例8: GetData

        public override object GetData(ITabContext context)
        {
            var plugin = Plugin.Create("No", "Started", "Duration", "Command", "Parameters");

            var requestContext = context.GetRequestContext<HttpContextBase>();
            List<LogItem> items = LogItemHandler.GetLogList(requestContext);

            if (items == null)
                return plugin;

            var count = 0;
            foreach (var item in items)
            {
                plugin.AddRow()
                    .Column(count++)
                    .Column(String.Format("{0:#,0}", item.Time.Subtract(requestContext.Timestamp).TotalMilliseconds))
                    .Column(item.Duration.HasValue ? String.Format("{0:#,0}", item.Duration.Value.TotalMilliseconds) : null)
                    .Column(item.Command)
                    .Column(item.Params.Count > 0
                        ? new[] { new object[] { "Name", "Type", "Value" } }.Concat(item.Params.Select(p => new object[]
                            {
                                p.Name,
                                p.Type,
                                p.Value,
                            }))
                        : null);
            }

            return plugin;
        }
开发者ID:artiomchi,项目名称:Glimpse-Linq2Sql,代码行数:30,代码来源:PluginCore.cs

示例9: GetData

        public override object GetData(ITabContext context)
        {
            var glimpseResult = new List<object[]>();

            var filepath = LoadCode("glimpse.csx");

            if (!File.Exists(filepath))
            {
                glimpseResult.Add(new[] { "Script result", "No code found" });
                return glimpseResult;
            }

            var code = File.ReadAllText(filepath);
            glimpseResult.Add(new object[] {"Executed code", code});

            var host = new ScriptCsHost();
            host.Root.Executor.Initialize(new[] { "System.Web" }, new[] { new GlimpseContextScriptPack(context),  });
            host.Root.Executor.AddReferenceAndImportNamespaces(new[] { typeof(ITabContext), typeof(AspNetTab), typeof(ScriptCsTab), typeof(IScriptExecutor) });
            
            var result = host.Root.Executor.ExecuteScript(code, new string[0]);
            host.Root.Executor.Terminate();

            if (result.CompileExceptionInfo != null) glimpseResult.Add(new object[] { "Compilation exception", result.CompileExceptionInfo.SourceException.Message });;
            if (result.ExecuteExceptionInfo != null) glimpseResult.Add(new object[] { "Execution exception", result.ExecuteExceptionInfo.SourceException.Message }); ;

            glimpseResult.Insert(0, new[] { "Script result", result.ReturnValue });
            return glimpseResult;
        }
开发者ID:modulexcite,项目名称:Glimpse.ScriptCs,代码行数:28,代码来源:ScriptCsTab.cs

示例10: GetData

        public override object GetData(ITabContext context)
        {
            var plugin = Plugin.Create("Level", "Timestamp", "Message", "Properties");

            foreach (var item in context.GetMessages<LogEventItem>())
            {
                var properties = item.LogEvent.Properties
                        .Select(pv => new { Name = pv.Key, Value = GlimpsePropertyFormatter.Simplify(pv.Value) })
                        .ToList();

                if (item.LogEvent.Exception != null)
                    properties.Add(new { Name = "Exception", Value = (object)item.LogEvent.Exception });

                properties = properties.OrderBy(p => p.Name).ToList();

                var row = plugin.AddRow();
                row.Column(item.LogEvent.Level.ToString());
                row.Column(item.LogEvent.Timestamp.ToString("HH:mm:ss.fff", item.FormatProvider));
                row.Column(item.LogEvent.RenderMessage(item.FormatProvider)).Strong();
                row.Column(properties);

                ApplyRowLevelStyle(item.LogEvent.Level, row);
            }

            return plugin;
        }
开发者ID:RossMerr,项目名称:serilog,代码行数:26,代码来源:GlimpseTab.cs

示例11: GetData

        public override object GetData(ITabContext context)
        {
            var timelineMessages = context.GetMessages<ITimelineMessage>()
                .Where(m => m.EventName.StartsWith("WAZStorage:")).Cast<WindowsAzureStorageTimelineMessage>();

            var model = new StorageModel();

            if (timelineMessages != null)
            {
                model.Statistics.TotalStorageTx = timelineMessages.Count();
                model.Statistics.TotalBlobTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Blob"));
                model.Statistics.TotalTableTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Table"));
                model.Statistics.TotalQueueTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Queue"));
                model.Statistics.TotalTrafficToStorage = timelineMessages.Sum(m => m.RequestSize).ToBytesHuman();
                model.Statistics.TotalTrafficFromStorage = timelineMessages.Sum(m => m.ResponseSize).ToBytesHuman();
                model.Statistics.PricePerTenThousandPageViews = string.Format("${0}", model.Statistics.TotalStorageTx * 1000 * 0.0000001 + timelineMessages.Sum(m => m.ResponseSize) * 10000 * (0.12 / 1024 / 1024 / 1024));

                model.Requests = FlattenRequests(timelineMessages);
                model.Warnings = AnalyzeMessagesForWarnings(timelineMessages);

                return model;
            }

            return "No storage transactions have been utilized for this request.";
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:25,代码来源:Storage.cs

示例12: GetData

        public override object GetData(ITabContext context)
        {
            TabSection plugin = Plugin.Create("No", "Started", "Duration", "Method", "Index", "Document", "Query");

            var requestContext = context.GetRequestContext<HttpContextBase>();
            List<RequestItem> items = RequestHandler.GetLogList(requestContext);
            if (items ==null|| !items.Any())
                return null;
            int count = 0;
            foreach (RequestItem item in items)
            {
                plugin.AddRow()
                    .Column(count++)
                    .Column(String.Format("{0:#,0}", item.Time.Subtract(requestContext.Timestamp).TotalMilliseconds))
                    .Column(item.Duration.HasValue
                        ? String.Format("{0:#,0}", item.Duration.Value.TotalMilliseconds)
                        : null)
                    .Column(item.Method)
                    .Column(item.Index)
                    .Column(item.Document)
                    .Column(item.Query);
            }

            return plugin;
        }
开发者ID:icool123,项目名称:Glimpse.ElasticSearch,代码行数:25,代码来源:ElasticSearchTab.cs

示例13: HandleNullViewRenderMessageCollection

        public void HandleNullViewRenderMessageCollection(Views sut, ITabContext context)
        {
            context.TabStore.Setup(ds => ds.Get(typeof(IList<ViewEngine.FindViews.Message>).AssemblyQualifiedName)).Returns(new List<ViewEngine.FindViews.Message>());
            context.TabStore.Setup(ds => ds.Get(typeof(IList<View.Render.Message>).AssemblyQualifiedName)).Returns<List<View.Render.Message>>(null);

            Assert.DoesNotThrow(() => sut.GetData(context));
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:7,代码来源:ViewsShould.cs

示例14: GetData

        public override object GetData(ITabContext context)
        {
            try
            {
                var sitecoreData = _sitecoreRequest.GetData();

                if (!sitecoreData.HasData()) return null;

                var itemSummary = new ItemSummary(sitecoreData).Create();

                if (string.IsNullOrEmpty(itemSummary)) return null;

                var plugin = Plugin.Create("Item", itemSummary);

                var itemSection = new ItemSection(sitecoreData).Create();
                var contextSection = new ContextSection(sitecoreData).Create();
                var serverSection = new ServerSection(sitecoreData).Create();

                if (itemSection != null)
                    plugin.AddRow().Column("Item").Column(itemSection).Selected();

                if (contextSection != null)
                    plugin.AddRow().Column("Context").Column(contextSection).Quiet();

                if (serverSection != null)
                    plugin.AddRow().Column("Server").Column(serverSection);

                return plugin;
            }
            catch (Exception ex)
            {
                return new { Exception = ex };
            }
        }
开发者ID:gitter-badger,项目名称:Sitecore.Glimpse,代码行数:34,代码来源:SitecoreTab.cs

示例15: MatchConstraintMessageToRoute

        public void MatchConstraintMessageToRoute(Routes tab, ITabContext context, System.Web.Routing.IRouteConstraint constraint)
        {
            var route = new System.Web.Routing.Route("url", new System.Web.Routing.RouteValueDictionary { { "Test", "Other" } }, new System.Web.Routing.RouteValueDictionary { { "Test", constraint } }, new System.Web.Routing.RouteValueDictionary { { "Data", "Tokens" } }, new System.Web.Routing.PageRouteHandler("~/Path"));

            System.Web.Routing.RouteTable.Routes.Clear();
            System.Web.Routing.RouteTable.Routes.Add(route);

            var routeMessage = new RouteBase.GetRouteData.Message(route.GetHashCode(), new System.Web.Routing.RouteData(), "routeName")
                .AsSourceMessage(route.GetType(), null)
                .AsTimedMessage(new TimerResult { Duration = TimeSpan.FromMilliseconds(19) });
            var constraintMessage = new RouteBase.ProcessConstraint.Message(new RouteBase.ProcessConstraint.Arguments(new object[] { (HttpContextBase)null, constraint, "test", (System.Web.Routing.RouteValueDictionary)null, System.Web.Routing.RouteDirection.IncomingRequest }), route.GetHashCode(), true)
                .AsTimedMessage(new TimerResult { Duration = TimeSpan.FromMilliseconds(25) })
                .AsSourceMessage(route.GetType(), null);

            context.TabStore.Setup(mb => mb.Contains(typeof(IList<RouteBase.ProcessConstraint.Message>).AssemblyQualifiedName)).Returns(true).Verifiable();
            context.TabStore.Setup(mb => mb.Contains(typeof(IList<RouteBase.GetRouteData.Message>).AssemblyQualifiedName)).Returns(true).Verifiable();

            context.TabStore.Setup(mb => mb.Get(typeof(IList<RouteBase.ProcessConstraint.Message>).AssemblyQualifiedName)).Returns(new List<RouteBase.ProcessConstraint.Message> { constraintMessage }).Verifiable();
            context.TabStore.Setup(mb => mb.Get(typeof(IList<RouteBase.GetRouteData.Message>).AssemblyQualifiedName)).Returns(new List<RouteBase.GetRouteData.Message> { routeMessage }).Verifiable();

            var model = tab.GetData(context) as List<RouteModel>;
            var itemModel = model[0];

            Assert.NotNull(model);
            Assert.Equal(1, model.Count);
            Assert.NotNull(itemModel.Constraints);
            Assert.True(itemModel.IsMatch);
            Assert.Equal("Test", ((List<RouteConstraintModel>)itemModel.Constraints)[0].ParameterName);
            Assert.Equal(true, ((List<RouteConstraintModel>)itemModel.Constraints)[0].IsMatch);
            Assert.NotNull(itemModel.DataTokens);
            Assert.Equal("Tokens", itemModel.DataTokens["Data"]);
            Assert.NotNull(itemModel.RouteData);
            Assert.Equal("Other", ((List<RouteDataItemModel>)itemModel.RouteData)[0].DefaultValue);
        }
开发者ID:rroman81,项目名称:Glimpse,代码行数:34,代码来源:RoutesShould.cs


注:本文中的ITabContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。