I have made a C# application , now I want to create custom survey (actually sending data automatically to me, about - crashes , usage duration etc.) to enhance my application .
How can I do it ?
I have made a C# application , now I want to create custom survey (actually sending data automatically to me, about - crashes , usage duration etc.) to enhance my application .
How can I do it ?
On
Sorry for the rough reception you received with that one comment. Many of us understood you weren't asking for us to write code for you, and I think you had a legit question.
You might want to also look at the .Net Trace capabilities. While you won't get data sent to you automatically, there's a built-in, easy-to-use framework that's unobtrusive and let's you gather statistics. Here are some links to check out:
How to Add Trace Statements to Code
See also
So there you go. Another possible way to approach this.
On
Rather than rolling your own, which would require a lot of work to set up a server to gather the metrics and produce reports, 3rd party services exist which provide comprehensive end-to-end solutions for app metrics and exception reporting. I've worked with sentry.io. They are built for large and complex backend systems but it's worked well for me in the context of a small C# WPF desktop app. It was only about ten lines of code to get started. For example this will get exception reporting up and running:
using System.Windows;
public partial class App : Application
{
public App()
{
SentrySdk.Init(o =>
{
// Tells which project in Sentry to send events to:
o.Dsn = "https://example.ingest.sentry.io/x";
// Enable Global Mode since this is a client app
o.IsGlobalModeEnabled = true;
});
DispatcherUnhandledException += App_DispatcherUnhandledException;
}
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
SentrySdk.CaptureException(e.Exception);
// If you want to avoid the application from crashing:
e.Handled = true;
}
}
You may do this:
System.Threading.Timerinstance and set desired schedule to send the statistics. Or just send them each time user starts your application.WebClient/HttpClient.Tutorials:
Get Started with ASP.NET Web API 2 (C#)
Call a Web API From a .NET Client (C#)