[Dev Blog] KCV插件 —— Provissy Tools 。

承蒙各位支持!

 

正式版已推出,请前往http://tieba.baidu.com/p/3398574166

或者前往:http://provissy.com/?p=7

 

请不要在这里回复,我无法保证回复您的及时性!

 

更新日志:

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

 

posted @ 2014-10-30 13:11  Provissy  阅读(3069)  评论(0编辑  收藏  举报