本文整理汇总了C#中Microsoft.ApplicationInsights.TelemetryClient类的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.ApplicationInsights.TelemetryClient类的具体用法?C# Microsoft.ApplicationInsights.TelemetryClient怎么用?C# Microsoft.ApplicationInsights.TelemetryClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Microsoft.ApplicationInsights.TelemetryClient类属于命名空间,在下文中一共展示了Microsoft.ApplicationInsights.TelemetryClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: App_UnhandledException
private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
var client = new Microsoft.ApplicationInsights.TelemetryClient();
client.TrackException(e.Exception);
_logger.Error(e.Exception);
e.Handled = true;
}
开发者ID:sunnycase,项目名称:love-life,代码行数:7,代码来源:App.xaml.cs
示例2: TaskScheduler_UnobservedTaskException
private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
var client = new Microsoft.ApplicationInsights.TelemetryClient();
client.TrackException(e.Exception);
_logger.Error(e.Exception);
e.SetObserved();
}
开发者ID:sunnycase,项目名称:love-life,代码行数:7,代码来源:App.xaml.cs
示例3: updateWith10DayData
private void updateWith10DayData(string response)
{
var json = JObject.Parse(response);
JToken forecastToken;
if (!json.TryGetValue("forecast", out forecastToken))
{
var tc = new Microsoft.ApplicationInsights.TelemetryClient();
var properties = new Dictionary<String, string> { { "response", response } };
tc.TrackEvent($"Unexpected response in {nameof(updateWith10DayData)}", properties);
return;
}
var allDaily = forecastToken["simpleforecast"]["forecastday"].Children();
var dailyForecast = new List<WeatherDetailsModel>();
foreach (var daily in allDaily.Take(10))
{
var rawEpoch = Int64.Parse(daily["date"]["epoch"].ToString());
var epoch = DateTimeOffset.FromUnixTimeSeconds(rawEpoch);
var forecast = new WeatherDetailsModel()
{
Conditions = daily["conditions"].ToString(),
TemperatureHigh = Int32.Parse(daily["high"]["celsius"].ToString()),
TemperatureLow = Int32.Parse(daily["low"]["celsius"].ToString()),
Rainfall = Int32.Parse(daily["qpf_allday"]["mm"].ToString()),
Snowfall = Int32.Parse(daily["snow_allday"]["cm"].ToString()),
Time = epoch.DateTime,
};
dailyForecast.Add(forecast);
}
DailyForecast = dailyForecast;
}
开发者ID:AmadeusW,项目名称:Mirror,代码行数:30,代码来源:WeatherModel_wunderground.cs
示例4: Login
public ActionResult Login(LoginModel model, string returnUrl)
{
var telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
TraceTelemetry traceSample = new TraceTelemetry();
if (ModelState.IsValid && WebSecurity.Login(
model.UserName, model.Password, persistCookie: model.RememberMe))
{
// Migrate the user's shopping cart
MigrateShoppingCart(model.UserName);
//Sample Trace telemetry
traceSample.Message = "Login succesfull";
traceSample.SeverityLevel = SeverityLevel.Information;
telemetryClient.TrackTrace(traceSample);
return RedirectToLocal(returnUrl);
}
//Sample Trace telemetry
traceSample.Message = "Login failed";
traceSample.SeverityLevel = SeverityLevel.Information;
telemetryClient.TrackTrace(traceSample);
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);
}
开发者ID:JoseCarlosMM,项目名称:Glimpse.ApplicationInsights,代码行数:28,代码来源:AccountController.cs
示例5: Index
//
// GET: /ShoppingCart/
public ActionResult Index()
{
var telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
var cart = ShoppingCart.GetCart(storeDB, this.HttpContext);
// Set up our ViewModel
var viewModel = new ShoppingCartViewModel
{
CartItems = cart.GetCartItems(),
CartTotal = cart.GetTotal()
};
foreach (var item in viewModel.CartItems)
{
Trace.Write("Cart item: " + item.AlbumId);
}
//Sample Trace Telemetry
TraceTelemetry sampleTelemetry = new TraceTelemetry();
sampleTelemetry.Message = "Normal response- Database";
sampleTelemetry.SeverityLevel = SeverityLevel.Information;
telemetryClient.TrackTrace(sampleTelemetry);
// Return the view
return View(viewModel);
}
开发者ID:JoseCarlosMM,项目名称:Glimpse.ApplicationInsights,代码行数:30,代码来源:ShoppingCartController.cs
示例6: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
this.InitializeComponent();
this.Suspending += OnSuspending;
}
开发者ID:andriikrupka,项目名称:SwipeControlProject,代码行数:11,代码来源:App.xaml.cs
示例7: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
MapService.ServiceToken = "Your token here";
this.InitializeComponent();
this.Suspending += OnSuspending;
}
开发者ID:bozood,项目名称:MobileDay,代码行数:12,代码来源:App.xaml.cs
示例8: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
TelemetryClient.Context.Properties.Add("Alias", "");
this.InitializeComponent();
this.Suspending += OnSuspending;
}
开发者ID:codekaizen,项目名称:internetradio,代码行数:12,代码来源:App.xaml.cs
示例9: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += this.App_UnhandledException;
}
开发者ID:Majirefy,项目名称:uwptodoapp,代码行数:12,代码来源:App.xaml.cs
示例10: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
this.InitializeComponent();
BaseViewModel.NavigationService = new NavigationHelper();
this.Suspending += OnSuspending;
}
开发者ID:cynoteck,项目名称:Windows10-Universal-DemoApp,代码行数:12,代码来源:App.xaml.cs
示例11: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
ParseObject.RegisterSubclass<Toilet>();
ParseClient.Initialize("xSi6lznksibSQE8LXWhEYLNghkZNVA3yCPATXPJ2", "wdorZjmU5SRAiHElPRBilEBzICmcAoepvpEoTrO7");
this.InitializeComponent();
this.Suspending += OnSuspending;
}
开发者ID:br3nt0n,项目名称:LooFinder,代码行数:13,代码来源:App.xaml.cs
示例12: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
this.InitializeComponent();
this.Suspending += OnSuspending;
if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
开发者ID:JavierErdozain,项目名称:Events,代码行数:14,代码来源:App.xaml.cs
示例13: App
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
this.InitializeComponent();
this.Suspending += OnSuspending;
Router.Current.Scheme = "solidnavigation://";
Router.Current.AddRoute("tasks/{taskid}/comments", typeof(TaskDetailsPage), typeof(CommentTarget));
Router.Current.AddRoute("tasks/{taskid}", typeof(TaskDetailsPage), typeof(TaskDetailsTarget));
Router.Current.AddRoute("lists/{listid}", typeof(TasksPage), typeof(TaskListTarget));
Router.Current.AddRoute("", typeof(ListsPage), typeof(HomeTarget));
}
开发者ID:skallab78,项目名称:solid-navigation-dwx-2015,代码行数:13,代码来源:App.xaml.cs
示例14: Index
//
// GET: /Home/
public async Task<ActionResult> Index()
{
// Get most popular albums
var albums = await GetTopSellingAlbums(6);
//var albums = GetTopSellingAlbums(6);
// Trigger some good old ADO code
var albumCount = GetTotalAlbumns();
Trace.Write(string.Format("Total number of Albums = {0} and Albums with 'The' = {1}", albumCount.Item1, albumCount.Item2));
var telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
//Sample Trace telemetry
TraceTelemetry traceSample = new TraceTelemetry();
traceSample.Message = "Slow response - database";
traceSample.SeverityLevel = SeverityLevel.Warning;
telemetryClient.TrackTrace(traceSample);
//Sample event telemetry
var properties = new Dictionary<string, string> { { "Property 1",string.Format("Album Count {0}" ,albumCount.Item1) } };
var measurements = new Dictionary<string, double> { { "Sample Meassurement", albumCount.Item1 } };
telemetryClient.TrackEvent("Top Selling Albums", properties, measurements);
//Sample exception telemetry
try
{
albumCount = null;
int count=albumCount.Item1;
}
catch (Exception ex)
{
telemetryClient.TrackException(ex, properties, measurements);
}
//Obtains the ip address from the request
var request = new RequestTelemetry();
request.Url = HttpContext.Request.Url;
request.Duration = System.TimeSpan.FromMilliseconds(100);
request.Success = false;
request.Name = "TEST REQUEST " + request.Name;
telemetryClient.TrackRequest(request);
return View(albums);
}
开发者ID:pablodam20,项目名称:Glimpse.ApplicationInsights,代码行数:47,代码来源:HomeController.cs
示例15: GlobalKeyDown
internal void GlobalKeyDown(CoreWindow sender, KeyEventArgs args)
{
try
{
if (args.VirtualKey == Windows.System.VirtualKey.Right)
{
NavigateNext();
}
else if (args.VirtualKey == Windows.System.VirtualKey.Left)
{
NavigatePrevious();
}
}
catch (Exception ex)
{
var tc = new Microsoft.ApplicationInsights.TelemetryClient();
var properties = new Dictionary<String, string> { { "Module", "Navigation" } };
tc.TrackException(ex, properties);
System.Diagnostics.Debugger.Break();
}
}
开发者ID:AmadeusW,项目名称:Mirror,代码行数:21,代码来源:NavigationController.cs
示例16: GetSasToken
public string GetSasToken(string deviceId)
{
string ns = WebApiApplication.ehWebConsumerGroup.eventHubNamespace;
string hubName = WebApiApplication.ehWebConsumerGroup.eventHubPath;
string keyName = WebApiApplication.ehWebConsumerGroup.SendKeyName;
string key = WebApiApplication.ehWebConsumerGroup.SendKeyValue;
int TTLmins = 60 * 24;
if (deviceId == "")
return "";
TimeSpan ttl = new TimeSpan(0, TTLmins, 0);
var sas = CreateForHttpSender(keyName, key, ns, hubName, deviceId, ttl);
// add app insight
var tc = new Microsoft.ApplicationInsights.TelemetryClient();
tc.TrackEvent("SasToken dispensed");
return sas;
}
开发者ID:amykatenicho,项目名称:ms-band-azure,代码行数:24,代码来源:ValuesController.cs
示例17: LogOff
public ActionResult LogOff()
{
WebSecurity.Logout();
var telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
//Sample Trace telemetry
TraceTelemetry traceSample = new TraceTelemetry();
traceSample.Message = "Logged off";
traceSample.SeverityLevel = SeverityLevel.Information;
telemetryClient.TrackTrace(traceSample);
return RedirectToAction("Index", "Home");
}
开发者ID:JoseCarlosMM,项目名称:Glimpse.ApplicationInsights,代码行数:14,代码来源:AccountController.cs
示例18: AppController
private const int deleteInterval = 1; //Value in hours
public AppController()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
Server = new WebServer();
XmlSettings = new AppSettings();
}
开发者ID:bethoma,项目名称:securitysystem,代码行数:8,代码来源:Controller.cs
示例19: Execute
public static bool Execute(string[] args, Stream outputStream)
{
var sessionId = Guid.NewGuid().ToString();
var machineId = getMachineId();
// Create AppInsights telemetry client to track app usage
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();
TelemetryClient.Context.User.Id = machineId;
TelemetryClient.Context.Session.Id = sessionId;
Assembly assembly = Assembly.GetAssembly(typeof(DeploymentWorker));
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
var version = fileVersionInfo.ProductVersion;
TelemetryClient.TrackEvent("DeployStart", new Dictionary<string, string>()
{
{ "AppVersion", version }
});
var worker = new DeploymentWorker(outputStream);
if (!worker.argsHandler.HandleCommandLineArgs(args))
{
TelemetryClient.TrackEvent("DeployFailed_IncorrectArgs", new Dictionary<string, string>() { });
TelemetryClient.Flush();
return false;
}
worker.OutputMessage(Resource.DeploymentWorker_Starting);
var taskResult = worker.CreateAndDeployApp();
if (taskResult)
{
TelemetryClient.TrackEvent("DeploySucceeded", new Dictionary<string, string>() { });
}
else
{
TelemetryClient.TrackEvent("DeployFailed", new Dictionary<string, string>() { });
}
TelemetryClient.Flush();
return taskResult;
}
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:39,代码来源:DeploymentWorker.cs
示例20: updateWithHourlyData
private void updateWithHourlyData(string response)
{
var json = JObject.Parse(response);
JToken allHourly;
if (!json.TryGetValue("hourly_forecast", out allHourly))
{
var tc = new Microsoft.ApplicationInsights.TelemetryClient();
var properties = new Dictionary<String, string> { { "response", response } };
tc.TrackEvent($"Unexpected response in {nameof(updateWithHourlyData)}", properties);
return;
}
var hourlyForecast = new List<WeatherDetailsModel>();
foreach (var hourly in allHourly.Take(24))
{
var rawEpoch = Int64.Parse(hourly["FCTTIME"]["epoch"].ToString());
var epoch = DateTimeOffset.FromUnixTimeSeconds(rawEpoch);
var forecast = new WeatherDetailsModel()
{
Conditions = hourly["condition"].ToString(),
Temperature = Int32.Parse(hourly["temp"]["metric"].ToString()),
Rainfall = Int32.Parse(hourly["qpf"]["metric"].ToString()),
Snowfall = Int32.Parse(hourly["snow"]["metric"].ToString()),
Time = epoch.DateTime,
};
hourlyForecast.Add(forecast);
}
HourlyForecast = hourlyForecast;
}
开发者ID:AmadeusW,项目名称:Mirror,代码行数:28,代码来源:WeatherModel_wunderground.cs
注:本文中的Microsoft.ApplicationInsights.TelemetryClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论