本文整理汇总了C#中ITabContext.GetMessages方法的典型用法代码示例。如果您正苦于以下问题:C# ITabContext.GetMessages方法的具体用法?C# ITabContext.GetMessages怎么用?C# ITabContext.GetMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITabContext
的用法示例。
在下文中一共展示了ITabContext.GetMessages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentPage
private string GetCurrentPage(ITabContext context, bool mobile)
{
string page = null;
var getDisplayInfoForPageMessage = context.GetMessages<StateRouteHandler.GetDisplayInfoForPage.Message>().FirstOrDefault();
var getPageForDisplayInfoMessage = context.GetMessages<StateRouteHandler.GetPageForDisplayInfo.Message>().FirstOrDefault();
if (getDisplayInfoForPageMessage != null)
page = getDisplayInfoForPageMessage.Page;
if (getPageForDisplayInfoMessage != null)
page = getPageForDisplayInfoMessage.Page;
if (page == null)
page = (!mobile || StateContext.State.MobilePage.Length == 0) ? StateContext.State.Page : StateContext.State.MobilePage;
return page;
}
示例2: GetCurrentTheme
private string GetCurrentTheme(ITabContext context, bool mobile)
{
string theme = null;
var getDisplayInfoForThemeMessage = context.GetMessages<AlternateType.StateRouteHandler.GetDisplayInfoForTheme.Message>().FirstOrDefault();
var getThemeForDisplayInfoMessage = context.GetMessages<AlternateType.StateRouteHandler.GetThemeForDisplayInfo.Message>().FirstOrDefault();
if (getDisplayInfoForThemeMessage != null)
theme = getDisplayInfoForThemeMessage.Theme;
if (getThemeForDisplayInfoMessage != null)
theme = getThemeForDisplayInfoMessage.Theme;
if (theme == null)
theme = (!mobile || (StateContext.State.MobilePage.Length == 0 && StateContext.State.MobileTheme.Length == 0)) ?
StateContext.State.Theme : StateContext.State.MobileTheme;
return theme;
}
示例3: GetCurrentMasters
private List<string> GetCurrentMasters(ITabContext context, bool mobile)
{
var masters = new List<string>();
var getDisplayInfoForMasterMessages = context.GetMessages<StateRouteHandler.GetDisplayInfoForMaster.Message>();
var getMasterForDisplayInfoMessages = context.GetMessages<StateRouteHandler.GetMasterForDisplayInfo.Message>();
foreach (var getDisplayInfoForMasterMessage in getDisplayInfoForMasterMessages)
masters.Add(getDisplayInfoForMasterMessage.Master);
foreach (var getMasterForDisplayInfoMessage in getMasterForDisplayInfoMessages)
masters.Add(getMasterForDisplayInfoMessage.Master);
if (masters.Count == 0)
masters = ((!mobile || (StateContext.State.MobilePage.Length == 0 && StateContext.State.MobileMasters.Count == 0)) ?
StateContext.State.Masters : StateContext.State.MobileMasters).ToList();
return masters;
}
示例4: 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;
}
示例5: 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.";
}
示例6: GetData
public object GetData(ITabContext context)
{
return context.GetMessages<ITimelineMessage>()
.Where(m =>
m.EventCategory.Name.Equals("Command") ||
(m.EventCategory.Name.Equals("Controller") && m.EventName.StartsWith("Controller:")) ||
m.EventCategory.Name.Equals("View")).OrderBy(m => m.Offset);
}
示例7: GetData
public override object GetData(ITabContext context)
{
var viewEngineFindViewsMessages = context.GetMessages<ViewEngine.FindViews.Message>();
var viewRenderMessages = context.GetMessages<View.Render.Message>();
var result = new List<ViewsModel>();
if (viewEngineFindViewsMessages == null || viewRenderMessages == null)
{
return result;
}
foreach (var findView in viewEngineFindViewsMessages)
{
result.Add(new ViewsModel(findView, viewRenderMessages.SingleOrDefault(r => r.ViewCorrelation.ViewEngineFindCallId == findView.Id)));
}
return result;
}
示例8: GetData
public object GetData(ITabContext context)
{
var sessions = context.GetMessages<RavenDbSessionMessage>().Select(x => x.Id).ToArray();
var data = new List<object[]>();
data.Add(new object[] { "Key", "Value" });
data.Add(new object[] { "Stores", GetStoreList() });
data.Add(new object[] { "Sessions", GetSessionList(sessions) });
data.Add(new object[] { "Requests", GetRequestList(sessions) });
return data;
}
示例9: GetData
public override object GetData(ITabContext context)
{
var timelineMessages = context.GetMessages<ITimelineMessage>().Where(m => m.EventName.StartsWith("WAZCache:"));
var model = new CachingModel();
if (timelineMessages != null)
{
// TODO: build useful data from this
model.TotalSuccessful = timelineMessages.Count();
return model;
}
return "No cache has been utilized for this request.";
}
示例10: GetData
public object GetData(ITabContext context) {
var section = Plugin.Create("Level", "Logger", "Message", "From Request Start", "From Last");
foreach (var item in context.GetMessages<NLogEventInfoMessage>()) {
section.AddRow()
.Column(string.Format("<span data-levelNum='{0}'>{1}</span>", item.LevelNumber, item.Level)).Raw()
.Column(item.Logger)
.Column(GetMessage(item.LogEvent))
.Column(item.FromFirst.TotalMilliseconds.ToString("0.00"))
.Column(item.FromLast.TotalMilliseconds.ToString("0.00"))
.Column(item)
.ApplyRowStyle(StyleFromLevel(item.Level));
}
return section.Build();
}
示例11: GetData
public override object GetData(ITabContext context)
{
var hasRun = context.TabStore.Get("hasRun");
if (hasRun == null)
{
context.TabStore.Set("hasRun", "true");
// Make sure the traces are dumpted out to the normal trace stream
writeToDiagnosticsTraceField.SetValue(null, true);
return null;
}
var data = ProcessData(context.GetMessages<PageLifeCycleMessage>());
return data;
}
示例12: GetData
public override object GetData(ITabContext context)
{
var messages = context.GetMessages<OperationCompletedEventMessage>().ToList();
var section = Core.Tab.Assist.Plugin.Create("Query", "Count", "Time");
foreach (var message in messages)
{
section.AddRow()
.Column(message.Query)
.Column(message.ResultCount)
.Column(message.Time);
}
return section;
}
示例13: GetData
public object GetData(ITabContext context)
{
var messages = context.GetMessages<AdoMessage>().ToList();
var aggregator = new MessageAggregator(messages);
var queryData = aggregator.Aggregate();
SqlStatistics sqlStatistics = SqlStatisticsCalculator.Caluculate(queryData);
return new
{
queryCount = sqlStatistics.QueryCount,
connectionCount = sqlStatistics.ConnectionCount,
transactionCount = sqlStatistics.TransactionCount,
queryExecutionTime = sqlStatistics.QueryExecutionTime,
connectionOpenTime = sqlStatistics.ConnectionOpenTime
};
}
示例14: GetData
public override object GetData(ITabContext context)
{
var plugin = Plugin.Create("Command", "Key", "Sent", "Size", "Received", "Size", "Expire", "Duration");
var messages = context.GetMessages<RedisTimelineMessage>().ToArray();
if (!messages.Any()) return null;
var ttl = Task.WhenAll(messages.Select(async x =>
{
var conn = x.UsedSettings.GetConnection();
var db = conn.GetDatabase(x.UsedSettings.Db);
var exists = await db.KeyExistsAsync(x.Key).ConfigureAwait(false);
if (exists)
{
var v = await db.KeyTimeToLiveAsync(x.Key).ConfigureAwait(false);
return (v.HasValue) ? v.Value.ToString(@"hh\:mm\:ss") : "-";
}
else
{
return null;
}
}).ToArray()).Result;
var duplicatedKey = new HashSet<Tuple<string, RedisKey>>();
foreach (var item in messages.Zip(ttl, (message, expire) => new { message, expire }))
{
var message = item.message;
var key = Tuple.Create(message.Command, message.Key);
var columns = plugin.AddRow()
.Column(message.Command)
.Column((string)message.Key)
.Column((message.SentObject == null) ? null : message.SentObject)
.Column((message.SentObject == null) ? null : (long?)message.SentSize)
.Column((message.ReceivedObject == null) ? null : message.ReceivedObject)
.Column((message.ReceivedObject == null) ? null : (long?)message.ReceivedSize)
.Column(item.expire)
.Column(message.Duration);
columns.WarnIf(duplicatedKey.Contains(key));
columns.ErrorIf(message.IsError);
duplicatedKey.Add(key);
}
return plugin;
}
示例15: GetData
public object GetData(ITabContext context)
{
var logEntries = context.GetMessages<WcfEntry>();
if (logEntries == null)
return null;
// Evaluate any expression trees
logEntries = logEntries.ToArray();
var data = new List<object[]> {new object[] {"Timestamp", "Elapsed", "Action", "Request", "Response"}};
data.AddRange(logEntries.Select(log => new object[] {
log.StartTime,
log.Duration.Milliseconds,
log.EventName,
log.RequestBody,
log.ResponseBody
}));
return data;
}