承蒙各位支持!
正式版已推出,請前往http://tieba.baidu.com/p/3398574166
請不要在這里回復,我無法保證回復您的及時性!
更新日志:
V1.0 Release。
V8.0,卡頓問題緩解,徹底解決遇到很多麻煩,暫時無法實現,求大神。
0.79---------------------------------------
0.78 --------------------------------------
11/05/2014,晚,V0.77,揭示板功能發布!
11/05/2014,傍晚,V0.76,新增更新提醒,點擊左上角方框可取消,否則5分鍾檢查一次。
11/05/2014,午,V0.75,BBS內部測試發布(其實也不是BBS啦),詳情看下面。
11/04/2014,午,V0.73,修復全部有關文件位置錯誤的bug,包括生成的記錄莫名其妙跑到桌面,或者跑到了Windows\System32
11/03/2014,更晚,V0.71,資源統計圖的加載使用異步調用,現在不會卡頓了。
11/03/2014,晚,V0.7,修復大部分UI有關問題,經過各種姿勢確認應該是沒問題了。新增錯誤處理頁面。下面有介紹。
11/03/2014,午,V0.68發布,修復更新與資源統計相關的Bug。
11/02/2014,晚,努力了一整天,從早上8點到晚上9點,終於完成了繪制圖表的工作,真的很辛苦。。。下面有詳細。
11/02/2014,午,V0.61,修復bug,新增捐贈頁面。
11/01/2014,晚,V0.6發布,服務器全部遷移,Updater更新,修復大量bug。
10/31/2014,更晚,V0.59⑨發布,修復切換統計數據出錯的bug,修復按鈕名稱錯誤的bug。
10/31/2014,晚,V0.59發布,現可直接查看統計數據。
10/31/2014,午,v0.52發布,修復bug。
10/31/2014,早,V0.51發布,修復csv亂碼。
10/30/2014,晚間,解決全部更新有關的bug。
->啊咧?多了個功能?
差不多做了個模子。。。
有什么用呢?秋活dalao推圖的時候,能用這個實時更新探路情況,別的人也可以持續刷新,看看別人的出擊陣容。
但是首先,你得有人用。。。。。大概會有人用吧。。。。。
如果報錯,再試一次應該就沒問題了。
無法在英文系統下讀取和發布標題帶有中文的內容,如要使用請將區域改為中文。
->錯誤處理頁面是個什么東東?
大概就是這樣的
->Chart !讀取CSV文件並繪制折線圖。
Google沒有任何資源!全部靠自己干!弄了13個小時終於搞定!!!!!
這是定義圖表控件的XAML代碼。
1 <chartingToolkit:Chart Name="LineChart1" Title="Material Log"> 2 <chartingToolkit:LineSeries Name="Fuel" 3 Title="Fuel" 4 DependentValuePath="countOfMat" 5 IndependentValuePath="DateOF" 6 ItemsSource="{Binding [0]}" 7 IsSelectionEnabled="True" AnimationSequence="FirstToLast"/> 8 <chartingToolkit:LineSeries Name="Ammo" 9 Title="Ammo" 10 DependentValuePath="countOfMat" 11 IndependentValuePath="DateOF" 12 ItemsSource="{Binding [1]}" 13 IsSelectionEnabled="True" AnimationSequence="FirstToLast"/> 14 <chartingToolkit:LineSeries Name="Steel" 15 Title="Steel" 16 DependentValuePath="countOfMat" 17 IndependentValuePath="DateOF" 18 ItemsSource="{Binding [2]}" 19 IsSelectionEnabled="True" AnimationSequence="FirstToLast"/> 20 <chartingToolkit:LineSeries Name="Bauxite" 21 Title="Bauxite" 22 DependentValuePath="countOfMat" 23 IndependentValuePath="DateOF" 24 ItemsSource="{Binding [3]}" 25 IsSelectionEnabled="True" 26 AnimationSequence="FirstToLast"/> 27 28 </chartingToolkit:Chart>
以下是本人心血,C#邏輯代碼。
1 private static Style GetNewDataPointStyle(int R,int G,int B) 2 { 3 Random random = new Random(); 4 Color background = Color.FromRgb((byte)R, 5 (byte)G, 6 (byte)B); 7 Style style = new Style(typeof(DataPoint)); 8 Setter st1 = new Setter(DataPoint.BackgroundProperty, 9 new SolidColorBrush(background)); 10 Setter st2 = new Setter(DataPoint.BorderBrushProperty, 11 new SolidColorBrush(Colors.White)); 12 Setter st3 = new Setter(DataPoint.BorderThicknessProperty, new Thickness(0.1)); 13 14 Setter st4 = new Setter(DataPoint.TemplateProperty, null); 15 style.Setters.Add(st1); 16 style.Setters.Add(st2); 17 style.Setters.Add(st3); 18 style.Setters.Add(st4); 19 return style; 20 } 21 22 private void loadMatChart() 23 { 24 LineSeries fuelLine = LineChart1.Series[0] as LineSeries; 25 fuelLine.ItemsSource = loadFuel(); 26 LineSeries ammoLine = LineChart1.Series[1] as LineSeries; 27 ammoLine.ItemsSource = loadAmmo(); 28 LineSeries steelLine = LineChart1.Series[2] as LineSeries; 29 steelLine.ItemsSource = loadSteel(); 30 LineSeries bauxiteLine = LineChart1.Series[3] as LineSeries; 31 bauxiteLine.ItemsSource = loadBauxite(); 32 Style dataPointStyle1 = GetNewDataPointStyle(34,139,34); 33 Style dataPointStyle2 = GetNewDataPointStyle(138,54,15); 34 Style dataPointStyle3 = GetNewDataPointStyle(128,138,135); 35 Style dataPointStyle4 = GetNewDataPointStyle(199,97,20); 36 fuelLine.DataPointStyle = dataPointStyle1; 37 ammoLine.DataPointStyle = dataPointStyle2; 38 steelLine.DataPointStyle = dataPointStyle3; 39 bauxiteLine.DataPointStyle = dataPointStyle4; 40 } 41 42 private List<MatData> loadBauxite() 43 { 44 List<MatData> matdata = new List<MatData>(); 45 foreach (string[] ss in ReadCSV("MaterialsLog.csv")) 46 { 47 matdata.Add(new MatData(ss[0], Int32.Parse(ss[4]))); 48 } 49 return matdata; 50 } 51 52 private List<MatData> loadSteel() 53 { 54 List<MatData> matdata = new List<MatData>(); 55 foreach (string[] ss in ReadCSV("MaterialsLog.csv")) 56 { 57 matdata.Add(new MatData(ss[0], Int32.Parse(ss[3]))); 58 } 59 return matdata; 60 } 61 62 private List<MatData> loadAmmo() 63 { 64 List<MatData> matdata = new List<MatData>(); 65 foreach (string[] ss in ReadCSV("MaterialsLog.csv")) 66 { 67 matdata.Add(new MatData(ss[0], Int32.Parse(ss[2]))); 68 } 69 return matdata; 70 } 71 72 private List<MatData> loadFuel() 73 { 74 List<MatData> matdata = new List<MatData>(); 75 foreach (string[] ss in ReadCSV("MaterialsLog.csv")) 76 { 77 matdata.Add(new MatData(ss[0], Int32.Parse(ss[1]))); 78 } 79 return matdata; 80 } 81 82 83 public static List<String[]> ReadCSV(string filePathName) 84 { 85 List<String[]> ls = new List<String[]>(); 86 StreamReader fileReader = new StreamReader(filePathName); 87 string strLine = ""; 88 while (strLine != null) 89 { 90 strLine = fileReader.ReadLine(); 91 if (strLine != null && strLine.Length > 0) 92 { 93 ls.Add(strLine.Split(',')); 94 //Debug.WriteLine(strLine); 95 } 96 } 97 fileReader.Close(); 98 return ls; 99 } 100 101 private void initializeSoNoDobiraWo() 102 { 103 try 104 { 105 loadMatChart(); 106 } 107 catch (Exception ex) 108 { 109 MessageBox.Show("加載統計圖錯誤!(重開KCV試試?) " + ex.ToString()); 110 } 111 } 112 } 113 114 115 public class MatData 116 { 117 public string DateOF { get; set; } 118 public int countOfMat { get; set; } 119 120 public MatData(string dateof, int countofmat) 121 { 122 DateOF = dateof; 123 countOfMat = countofmat; 124 } 125 }
什么?看起來很簡單?實踐出真知。
->內建統計數據查看器:
因為WPF控件的特殊性,老夫翻遍了百度找不到讀取csv的方法。
然后,我突然忘了一件重要的事——平時我都是用Google的啊!
美帝的方法也是亂七八糟五花八門,最后終於讓我找到了!
非常感謝這位叫做morio的博主!
這是他的文章——
CSVファイルを読み込んでDataGridに表示
http://morio2.blogspot.jp/2012/11/csvdatagrid.html
天氣轉涼,大家注意保重身體!
下載地址:V0.41 : http://pan.baidu.com/s/1kToStfh
V0.5 : http://pan.baidu.com/s/1mgxDO3Q
永久下載地址:http://provissy.boo.jp/PrvTools_Beta_Download/ProvissyTools-Beta.dll