代码拉取完成,页面将自动刷新
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));
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。