annotate MetroWpf/Stocks.Common/Models/SummaryStats.cs @ 100:9b6855dc165e

Updated System.Windows into Libs
author stevenhollidge <stevenhollidge@hotmail.com>
date Sat, 05 May 2012 23:04:16 +0100
parents 6109bc268b90
children
rev   line source
20
adminsh@apollo
parents:
diff changeset
1 using System;
adminsh@apollo
parents:
diff changeset
2 using System.Text;
adminsh@apollo
parents:
diff changeset
3
adminsh@apollo
parents:
diff changeset
4 namespace Stocks.Common.Models
adminsh@apollo
parents:
diff changeset
5 {
adminsh@apollo
parents:
diff changeset
6 public class SummaryStats
adminsh@apollo
parents:
diff changeset
7 {
adminsh@apollo
parents:
diff changeset
8 public WebRequestStats LastWebRequest { get; set; }
adminsh@apollo
parents:
diff changeset
9 public int PriceChangeEvents { get; set; }
adminsh@apollo
parents:
diff changeset
10 public int NumberOfRequests { get; set; }
adminsh@apollo
parents:
diff changeset
11 public DateTime TimeServiceStarted { get; set; }
adminsh@apollo
parents:
diff changeset
12
adminsh@apollo
parents:
diff changeset
13 public void Reset()
adminsh@apollo
parents:
diff changeset
14 {
adminsh@apollo
parents:
diff changeset
15 LastWebRequest = new WebRequestStats();
adminsh@apollo
parents:
diff changeset
16 PriceChangeEvents = 0;
adminsh@apollo
parents:
diff changeset
17 NumberOfRequests = 0;
adminsh@apollo
parents:
diff changeset
18 TimeServiceStarted = DateTime.Now;
adminsh@apollo
parents:
diff changeset
19 }
adminsh@apollo
parents:
diff changeset
20
adminsh@apollo
parents:
diff changeset
21 public override string ToString()
adminsh@apollo
parents:
diff changeset
22 {
adminsh@apollo
parents:
diff changeset
23 var sb = new StringBuilder();
adminsh@apollo
parents:
diff changeset
24 sb.AppendLine("Stocks Service Summary Stats:");
adminsh@apollo
parents:
diff changeset
25 sb.AppendLine(string.Format(" Time service started: {0}", TimeServiceStarted));
adminsh@apollo
parents:
diff changeset
26 sb.AppendLine(string.Format(" Number of requests: {0}", NumberOfRequests));
adminsh@apollo
parents:
diff changeset
27 sb.AppendLine(string.Format(" Number of price change events: {0}", PriceChangeEvents));
adminsh@apollo
parents:
diff changeset
28 sb.AppendLine(string.Format(" Number of symbols sent on last request: {0}", LastWebRequest.SymbolCount));
adminsh@apollo
parents:
diff changeset
29 sb.AppendLine(string.Format(" Number of prices in last response: {0}", LastWebRequest.PricesDownloaded));
adminsh@apollo
parents:
diff changeset
30 sb.AppendLine(string.Format(" Time taken for last request: {0}", LastWebRequest.Duration));
adminsh@apollo
parents:
diff changeset
31 //sb.AppendLine(string.Format(" Response string for last request: {0}", LastWebRequest.Response));
adminsh@apollo
parents:
diff changeset
32 return sb.ToString();
adminsh@apollo
parents:
diff changeset
33 }
adminsh@apollo
parents:
diff changeset
34 }
adminsh@apollo
parents:
diff changeset
35 }