You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
14 years ago
|
using System;
|
||
|
using System.IO.Ports;
|
||
|
|
||
|
namespace ArducopterConfigurator.PresentationModels
|
||
|
{
|
||
14 years ago
|
public class SerialMonitorVm : NotifyProperyChangedBase, IPresentationModel
|
||
14 years ago
|
{
|
||
|
private string _text;
|
||
|
|
||
|
public string ReceviedText { get { return _text; } }
|
||
|
|
||
|
public string SendText { get; set; }
|
||
14 years ago
|
|
||
|
public string Name
|
||
14 years ago
|
{
|
||
14 years ago
|
get { return "Serial Monitor"; }
|
||
14 years ago
|
}
|
||
|
|
||
14 years ago
|
public void Activate()
|
||
14 years ago
|
{
|
||
14 years ago
|
_text = string.Empty;
|
||
14 years ago
|
FirePropertyChanged("ReceviedText");
|
||
|
}
|
||
|
|
||
14 years ago
|
public void DeActivate()
|
||
14 years ago
|
{
|
||
14 years ago
|
if (sendTextToApm!=null)
|
||
|
sendTextToApm(this, new sendTextToApmEventArgs("X"));
|
||
14 years ago
|
}
|
||
|
|
||
14 years ago
|
public event EventHandler updatedByApm;
|
||
|
|
||
14 years ago
|
public void SendTextCommand()
|
||
|
{
|
||
14 years ago
|
if (sendTextToApm != null)
|
||
|
sendTextToApm(this, new sendTextToApmEventArgs(SendText));
|
||
14 years ago
|
SendText = "";
|
||
|
FirePropertyChanged("SendText");
|
||
|
}
|
||
14 years ago
|
|
||
|
public void handleLineOfText(string strRx)
|
||
|
{
|
||
|
_text += strRx + Environment.NewLine;
|
||
|
FirePropertyChanged("ReceviedText");
|
||
|
}
|
||
|
|
||
|
public event EventHandler<sendTextToApmEventArgs> sendTextToApm;
|
||
14 years ago
|
}
|
||
|
}
|