Develop and Download Open Source Software

Browse Subversion Repository

Contents of /ErrorReportHelper.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (show annotations) (download)
Thu Feb 24 14:12:19 2011 UTC (13 years, 2 months ago) by aqua877
File size: 912 byte(s)
エラー報告機能の実装
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Net;
6 using System.Collections.Specialized;
7
8 namespace Aqua877.WinApp.IronLivetube
9 {
10 public class ErrorReportHelper
11 {
12 public static event Action<bool> ReportExceptionFinished;
13
14 public static void ReportException(Exception ex)
15 {
16 var connector = new WebClient() { Encoding = Encoding.UTF8 };
17 connector.UploadValuesCompleted += (s, e) =>
18 {
19 if (e.Error != null)
20 {
21 if (ReportExceptionFinished != null)
22 {
23 ReportExceptionFinished(false);
24 }
25 }
26 else
27 {
28 if (ReportExceptionFinished != null)
29 {
30 ReportExceptionFinished(true);
31 }
32 }
33 };
34
35 connector.UploadValuesAsync(new Uri("http://192.168.1.2/ls_errors/lserr.php"), new NameValueCollection()
36 {
37 { "exception", ex.ToString() }
38 });
39 }
40 }
41 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26