2 Star 5 Fork 3

彭添/SerialPlot_PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Mod.cs 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
彭添 提交于 2015-08-13 01:36 . FirstSync
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.ComponentModel;
namespace 帆板仪表盘
{
public class Mod : INotifyPropertyChanged
{
private double angle;
private double power;
private long time;
/// <summary>
///角度
/// </summary>
public long Count
{
get { return time; }
set
{
time = value;
OnPropertyChanged("Mod");
}
}
public double Angle
{
get { return angle; }
set { angle = value; OnPropertyChanged("PlotModel"); }
}
public double Power
{
get { return power; }
set { power = value; OnPropertyChanged("PlotModel"); }
}
public Mod() { }
public Mod(double a, double p, long t)
{
Angle = a;
Power = p;
Count = t;
}
public Mod(string dataIn,long t)
{
Count = t;
Deal(dataIn);
}
private void Deal(string dataIn)
{
/*此处需要长度处理,待写*/
// int index= dataIn.LastIndexOf("\r\n");
if (dataIn.Length<10)
{
return;
}
try
{
var powers = Regex.Matches(dataIn, @"power:[0-9]+");
power = Double.Parse(powers[powers.Count - 1].ToString().Substring(6));
var angles = Regex.Matches(dataIn, @"角度:[0-9]+.?[0-9]+");
angle = Double.Parse(angles[angles.Count - 1].ToString().Substring(3));
}
catch
{
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pengtianabc/SerialPlot_PT.git
git@gitee.com:pengtianabc/SerialPlot_PT.git
pengtianabc
SerialPlot_PT
SerialPlot_PT
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385