1.兼容版和新飞控版用同样的软件,配置文件不同

2.飞行时间计算,每一个判断是否修改速度,有修改就按新速度计算时间
3.加入魔方基站支持
4.支持部分任务
This commit is contained in:
xu 2020-09-20 11:42:07 +08:00
parent 3719c74753
commit 4dba5da8fd
17 changed files with 432 additions and 97 deletions

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plane.FormationCreator", "Plane.FormationCreator\Plane.FormationCreator.csproj", "{61E2F31E-220A-4E3F-A64D-F7CDC2135008}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plane.FormationCreator", "Plane.FormationCreator\Plane.FormationCreator.csproj", "{61E2F31E-220A-4E3F-A64D-F7CDC2135008}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{BE3280E8-8C7F-4961-9685-1124C5B990CB} = {BE3280E8-8C7F-4961-9685-1124C5B990CB} {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A} = {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plane.Windows", "..\Plane.Libraries\Plane.Windows\Plane.Windows.csproj", "{06848293-9B17-4068-9B35-44D0ED713CD4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plane.Windows", "..\Plane.Libraries\Plane.Windows\Plane.Windows.csproj", "{06848293-9B17-4068-9B35-44D0ED713CD4}"
@ -26,7 +26,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlaneGcsSdk_Shared", "..\Pl
EndProject EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlaneGcsSdk.Contract_Shared", "..\Plane.Sdk3\PlaneGcsSdk.Contract_Shared\PlaneGcsSdk.Contract_Shared.shproj", "{695733D7-99FF-4707-8C89-474E949CADCB}" Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlaneGcsSdk.Contract_Shared", "..\Plane.Sdk3\PlaneGcsSdk.Contract_Shared\PlaneGcsSdk.Contract_Shared.shproj", "{695733D7-99FF-4707-8C89-474E949CADCB}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "flyBase", "..\flyBase\flyBase.csproj", "{BE3280E8-8C7F-4961-9685-1124C5B990CB}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlightRoute", "..\FlyTest\FlightRoute\FlightRoute.csproj", "{705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}"
EndProject EndProject
Global Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution GlobalSection(SharedMSBuildProjectFiles) = preSolution
@ -106,14 +106,14 @@ Global
{47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU {47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU
{47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU {47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU
{47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU {47141894-ECE3-48CA-8DCF-CA751BDA231E}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.Release|Any CPU.Build.0 = Release|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.Release|Any CPU.Build.0 = Release|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.v4.0-Debug|Any CPU.ActiveCfg = Debug|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU
{BE3280E8-8C7F-4961-9685-1124C5B990CB}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU {705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -21,11 +21,16 @@ using System.IO;
namespace Plane.FormationCreator.Formation namespace Plane.FormationCreator.Formation
{ {
public class CopterCollection : ObservableCollection<ICopter> public class CopterCollection : ObservableCollection<ICopter>
{ {
//软件过期时间---过期将无法添加飞机,并自动退出
public static DateTime Expire_App = DateTime.Parse("2021-06-01");
//超级用户过期时间--过期将无法使用内置超级用户登录
public static DateTime Expire_SuperUser = Expire_App;
//允许飞行的飞机数量
public int EnCopterNumber = 0; public int EnCopterNumber = 0;
//允许模拟的飞机数量
public int EnVCopterNumber = 0; public int EnVCopterNumber = 0;
@ -36,15 +41,13 @@ namespace Plane.FormationCreator.Formation
/// <param name="baseSemObjects"></param> /// <param name="baseSemObjects"></param>
public int AddCopter(ICopter entityObject, CopterManager.CopterSortType vSortType) public int AddCopter(ICopter entityObject, CopterManager.CopterSortType vSortType)
{ {
////给第三方时候限制数量和时间用
DateTime dateTime2019 = DateTime.Parse("2020-08-01");
//新增飞机区域限制:内蒙 //新增飞机区域限制:内蒙
// if (entityObject.Latitude < 37.4307185218 || entityObject.Latitude > 45.6754821756 // if (entityObject.Latitude < 37.4307185218 || entityObject.Latitude > 45.6754821756
// || entityObject.Longitude < 97.3493089056 || entityObject.Longitude > 115.8006783856) // || entityObject.Longitude < 97.3493089056 || entityObject.Longitude > 115.8006783856)
// return 0; // return 0;
if (DateTime.UtcNow > dateTime2019) if (DateTime.UtcNow > Expire_App)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -179,8 +182,17 @@ namespace Plane.FormationCreator.Formation
const string LoginPage = "checkforapp.php"; const string LoginPage = "checkforapp.php";
const string supername = "admin"; const string supername = "admin";
const string superpass = "fxmf0622"; const string superpass = "admin0622";
const string TEMP_MISSIONFILE = @".\gcs.dat"; const string TEMP_MISSIONFILE = @".\gcs.dat";
//飞控版本控制
public int FC_VER_NO = 1;//"4.1.2" 这个版本以前版本灯光比较少no=1 //"4.5"以后no=2;
//飞控版本控制
public string FC_VER_STRING = "4.1.2以前"; //
//用户级别 //用户级别
const int LEVEL_NORMAL = 1; const int LEVEL_NORMAL = 1;
const int LEVEL_ADMIN = 0; const int LEVEL_ADMIN = 0;
@ -205,6 +217,18 @@ namespace Plane.FormationCreator.Formation
Task.WhenAll(Copters.Select(c => c.DisconnectAsync())); Task.WhenAll(Copters.Select(c => c.DisconnectAsync()));
}; };
Windows.IniHelper.IniFiles inifilse = new Windows.IniHelper.IniFiles();
string readvalue = "";
int intTemp;
readvalue = inifilse.IniReadvalue("Default", "FC_VER_NO");
if (readvalue != "" && int.TryParse(readvalue, out intTemp))
FC_VER_NO = int.Parse(readvalue);
readvalue = inifilse.IniReadvalue("Default", "FC_VER_STRING");
if (readvalue != "" )
FC_VER_STRING =readvalue;
} }
public List<ICopter> ShowCopter = new List<ICopter>(); public List<ICopter> ShowCopter = new List<ICopter>();
@ -328,6 +352,7 @@ namespace Plane.FormationCreator.Formation
private string _UserName = ""; private string _UserName = "";
private string _UserDisplayName = ""; private string _UserDisplayName = "";
public string RTK_URL = "";
public void NetLogined(string UserName,string UserDisplayName,int vEnCopterNumber,int vEnVCopterNumber,int userlever=1) public void NetLogined(string UserName,string UserDisplayName,int vEnCopterNumber,int vEnVCopterNumber,int userlever=1)
{ {
@ -355,6 +380,40 @@ namespace Plane.FormationCreator.Formation
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
} }
public void GetRTKURL()
{
if (_UserName == "") return;
// 发送请求
StringBuilder sbUrl = new StringBuilder(); // 请求URL内容
sbUrl.Append(VersionControl.ServerURL + LoginPage);
sbUrl.Append("?");
sbUrl.Append("username=" + _UserName);
sbUrl.Append("&clientname=" + System.Net.Dns.GetHostName());
sbUrl.Append("&type=GetRTK");
sbUrl.Append("&ver=" + Assembly.GetExecutingAssembly().GetName().Version.ToString());
String strUrl = sbUrl.ToString();
string errorstr;
new AsynDataUtils().AsynGetData(strUrl, ResultCallBack_rtk, out errorstr);
}
public void ReleaseRTKURL()
{
if (_UserName == "") return;
// 发送请求
StringBuilder sbUrl = new StringBuilder(); // 请求URL内容
sbUrl.Append(VersionControl.ServerURL + LoginPage);
sbUrl.Append("?");
sbUrl.Append("username=" + _UserName);
sbUrl.Append("&clientname=" + System.Net.Dns.GetHostName());
sbUrl.Append("&type=RelRTK");
sbUrl.Append("&ver=" + Assembly.GetExecutingAssembly().GetName().Version.ToString());
String strUrl = sbUrl.ToString();
string errorstr;
new AsynDataUtils().AsynGetData(strUrl, null, out errorstr);
}
private void NetActivePost() private void NetActivePost()
{ {
// 发送请求 // 发送请求
@ -565,7 +624,8 @@ namespace Plane.FormationCreator.Formation
{ {
Logined = false; Logined = false;
//超级用户,无限制 //超级用户,无限制
if ((username== supername) && (password== superpass))
if ((username== supername) && (password== superpass) &&(DateTime.UtcNow < CopterCollection.Expire_SuperUser) )
{ {
NetLogined(supername, superDispname, -1, -1, LEVEL_ADMIN); NetLogined(supername, superDispname, -1, -1, LEVEL_ADMIN);
return; return;
@ -590,7 +650,29 @@ namespace Plane.FormationCreator.Formation
else Loginstate = "登录失败,"+ errorstr; else Loginstate = "登录失败,"+ errorstr;
} }
private void ResultCallBack_rtk(string data, bool haveerror)
{
if (haveerror)
{
MessageBox.Show("获取RTK账号失败" + data, "错误");
return;
}
if (data == "")
{
MessageBox.Show("获取RTK账号失败请检查网络", "错误");
return;
}
string[] arr = data.Split(';');
string loginret = arr[0];
if (loginret == "ok")
{
RTK_URL = arr[1];
}
else
MessageBox.Show(loginret, "错误");
}
//在这个方法里面接收回调的返回信息 //在这个方法里面接收回调的返回信息
private void DataResultCallBack_changepassword(string data, bool haveerror) private void DataResultCallBack_changepassword(string data, bool haveerror)

View File

@ -31,7 +31,7 @@ namespace Plane.FormationCreator.Formation
_copterManager.Copters.CollectionChanged += (sender, e) => _copterManager.Copters.CollectionChanged += (sender, e) =>
{ {
// TODO: 林俊清, 20150724, 需要改为正确的做法(清除旧飞机的任务,补充新飞机的任务)。 // TODO: 王海, 20150724, 需要改为正确的做法(清除旧飞机的任务,补充新飞机的任务)。
//AddTakeOffTask(e.NewItems?.Cast<ICopter>()); //AddTakeOffTask(e.NewItems?.Cast<ICopter>());
}; };
@ -47,7 +47,7 @@ namespace Plane.FormationCreator.Formation
} }
*/ */
// TODO: 林俊清, 20150803, 处理选中多个飞行器的情况。 // TODO: 王海, 20150803, 处理选中多个飞行器的情况。
if (_copterManager.SelectedCopters.Count() > 1) if (_copterManager.SelectedCopters.Count() > 1)
{ {
return; return;
@ -74,7 +74,7 @@ namespace Plane.FormationCreator.Formation
TaskAdded += (sender, e) => TaskAdded += (sender, e) =>
{ {
// TODO: 林俊清, 20150803, 处理选中多个飞行器的情况。 // TODO: 王海, 20150803, 处理选中多个飞行器的情况。
if (_copterManager.SelectedCopters.Count() > 1) if (_copterManager.SelectedCopters.Count() > 1)
{ {
return; return;
@ -1072,7 +1072,7 @@ namespace Plane.FormationCreator.Formation
var center = nullableCenter.Value; var center = nullableCenter.Value;
var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = staggerRoutes, FlytoTime = flytoTime, LoiterTime = loiterTime }; var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = staggerRoutes, FlytoTime = flytoTime, LoiterTime = loiterTime };
if(taskName != null) newTask.TaskCnName = taskName; if(taskName != null) newTask.TaskCnName = taskName;
// TODO: 林俊清, 20150801, 处理实际飞行器数目与记录中数目不一致的情况。 // TODO: 王海, 20150801, 处理实际飞行器数目与记录中数目不一致的情况。
for (int i = 0; i < copters.Count; i++) for (int i = 0; i < copters.Count; i++)
{ {
var copter = copters[i]; var copter = copters[i];
@ -1505,15 +1505,34 @@ namespace Plane.FormationCreator.Formation
} }
public void SetTaskFlytime(int taskIndex,bool settime=true) public void SetTaskFlytime(int taskIndex,bool settime=true,float currspeed=-1.0f)
{ {
double speed = 5.0f; //默认速度
if ((taskIndex > 0 )&&(taskIndex < Tasks.Count) &&( Tasks[taskIndex].TaskType == FlightTaskType.FlyTo)) if ((taskIndex > 0 )&&(taskIndex < Tasks.Count) &&( Tasks[taskIndex].TaskType == FlightTaskType.FlyTo))
{ {
if (_copterManager.Copters.Count() > 0) if (_copterManager.Copters.Count() > 0)
{ {
//计算之前航点有没改变速度,有就取最后一次速度
if (currspeed==-1.0)
{
for (int _taskIndex = taskIndex-1; _taskIndex > 1; _taskIndex--)
{
var curWaypoint = Tasks[_taskIndex].SingleCopterInfos.FirstOrDefault();
if ((curWaypoint.IsChangeSpeed))
{
speed = curWaypoint.LevelSpeed;
break;
}
}
}
double maxDistance = 0.0f; double maxDistance = 0.0f;
string copterName = ""; string copterName = "";
double speed = 0.0f;
foreach (var copter in _copterManager.Copters) foreach (var copter in _copterManager.Copters)
{ {
var prevWaypoint = Tasks[taskIndex - 1].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter); var prevWaypoint = Tasks[taskIndex - 1].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter);
@ -1523,6 +1542,16 @@ namespace Plane.FormationCreator.Formation
Message.Show($"任务{taskIndex + 1}飞机编号:{copter.Id}是自动速度,无法计算时间!"); Message.Show($"任务{taskIndex + 1}飞机编号:{copter.Id}是自动速度,无法计算时间!");
return ; return ;
} }
//当前航点是否改变速度,有就取修改的速度
if (curWaypoint.IsChangeSpeed)
{
speed = curWaypoint.LevelSpeed;
}
double distance = GeographyUtils.CalcDistance( double distance = GeographyUtils.CalcDistance(
prevWaypoint.TargetLat, prevWaypoint.TargetLng, prevWaypoint.TargetAlt, prevWaypoint.TargetLat, prevWaypoint.TargetLng, prevWaypoint.TargetAlt,
curWaypoint.TargetLat, curWaypoint.TargetLng, curWaypoint.TargetAlt); curWaypoint.TargetLat, curWaypoint.TargetLng, curWaypoint.TargetAlt);
@ -1530,7 +1559,7 @@ namespace Plane.FormationCreator.Formation
{ {
maxDistance = distance; maxDistance = distance;
copterName = copter.Name; copterName = copter.Name;
speed = curWaypoint.LevelSpeed; // speed = curWaypoint.LevelSpeed;
} }
} }
@ -1564,7 +1593,7 @@ namespace Plane.FormationCreator.Formation
} //计算优化线路,采用米计算 } //计算优化线路,采用米计算
/// <summary> /// <summary>
/// /// 自动生成航线2D和3D都用这个--------目前使用----------------
/// </summary> /// </summary>
/// <param name="Is3d">3D计算</param> /// <param name="Is3d">3D计算</param>
/// <param name="Ischange">是否改变线路的结束点顺序--返回起飞点航线不能交换</param> /// <param name="Ischange">是否改变线路的结束点顺序--返回起飞点航线不能交换</param>
@ -2320,7 +2349,7 @@ namespace Plane.FormationCreator.Formation
} }
AvoidCrashLog.Clear(); //可能有丢失 AvoidCrashLog.Clear(); //可能有丢失
} }
catch // 林俊清, 20151102, 通常是“集合已修改”异常。 catch // 王海, 20151102, 通常是“集合已修改”异常。
{ {
} }
finally finally
@ -2351,7 +2380,7 @@ namespace Plane.FormationCreator.Formation
} }
catch // 林俊清, 20151102, 通常是“集合已修改”异常。 catch // 王海, 20151102, 通常是“集合已修改”异常。
{ {
} }
finally finally

View File

@ -13,6 +13,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Threading; using System.Windows.Threading;
@ -210,18 +211,19 @@ namespace Plane.FormationCreator.Formation
public async Task Open(string CMB_serialport) public async Task Open(string CMB_serialport)
{ {
if (CMB_serialport == "") return; if (CMB_serialport == "") return;
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
switch(CMB_serialport) switch (CMB_serialport)
{ {
case "千寻": case "千寻":
//检测原点 //检测原点
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>(); // FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0) if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0)
{ {
Alert.Show("作为参照的原点未设置无法发送RTCM", "提示"); Alert.Show("作为参照的原点未设置无法发送RTCM", "提示");
return; return;
} }
//ini里面的固定千寻账号
//千寻账号 //千寻账号
string messagetips = "格式http://差分账号:差分密码@域名:端口/坐标系\r\n例如http://account:password@rtk.ntrip.qxwz.com:8002/RTCM32_GGB"; string messagetips = "格式http://差分账号:差分密码@域名:端口/坐标系\r\n例如http://account:password@rtk.ntrip.qxwz.com:8002/RTCM32_GGB";
string url = ""; string url = "";
@ -232,6 +234,42 @@ namespace Plane.FormationCreator.Formation
//构造 //构造
comPort = new CommsNTRIP(url, _flightTaskManager.OriginLat, _flightTaskManager.OriginLng); comPort = new CommsNTRIP(url, _flightTaskManager.OriginLat, _flightTaskManager.OriginLng);
break;
case "魔方基站":
//检测原点
if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0)
{
Alert.Show("作为参照的原点未设置无法发送RTCM", "提示");
return;
}
/* //ini里面的固定千寻账号
//千寻账号
string messagetips = "格式http://差分账号:差分密码@域名:端口/坐标系\r\n例如http://account:password@rtk.ntrip.qxwz.com:8002/RTCM32_GGB";
string url = "";
IniFiles inifilse = new IniFiles();
url = inifilse.IniReadvalue("Default", "RTKurl");
if (PlaneMessageBox.OnShow(messagetips, "发送RTK", ref url) == false) return;
inifilse.IniWritevalue("Default", "RTKurl", url);
*/
//通过网络得到千寻账号
if (_copterManager.RTK_URL == "")
{
//得到千寻账号
_copterManager.GetRTKURL();
//等到返回5秒
DateTime Tthen = DateTime.Now;
do
{
Application.DoEvents();
} while ((_copterManager.RTK_URL == "") || (Tthen.AddSeconds(2) > DateTime.Now));
}
if (_copterManager.RTK_URL != "")
{
//构造
comPort = new CommsNTRIP(_copterManager.RTK_URL, _flightTaskManager.OriginLat, _flightTaskManager.OriginLng);
}
break; break;
default: default:
comPort = new SerialPort(); comPort = new SerialPort();
@ -256,11 +294,30 @@ namespace Plane.FormationCreator.Formation
} }
} }
public async Task Close() public async Task Close(string CMB_serialport)
{ {
await _commModuleManager.CloseRtcmLoop(); await _commModuleManager.CloseRtcmLoop();
Rtcmthreadrun = false; Rtcmthreadrun = false;
comPort.Close(); comPort.Close();
switch (CMB_serialport)
{
case "魔方基站":
{
//释放千寻账号
_copterManager.ReleaseRTKURL();
}
break;
}
BaseState = false;
GpsState = false;
GlonassState = false;
BeidouState = false;
rtcmInfoList.Clear();
_copterManager.RTK_URL = "";
} }
private async Task RtcmLoop() private async Task RtcmLoop()
@ -333,7 +390,7 @@ namespace Plane.FormationCreator.Formation
} }
catch(Exception ex) catch(Exception ex)
{ {
Message.Show(ex.Message); Plane.Windows.Messages.Message.Show(ex.Message);
} }
} }
} }
@ -420,7 +477,7 @@ namespace Plane.FormationCreator.Formation
} }
catch (Exception ex) catch (Exception ex)
{ {
Message.Show(ex.Message); Plane.Windows.Messages.Message.Show(ex.Message);
} }
await Task.Delay(1); await Task.Delay(1);

View File

@ -87,7 +87,7 @@
<Button Content="{Binding SwitchVelocityModeButtonContent}" <Button Content="{Binding SwitchVelocityModeButtonContent}"
Command="{Binding SwitchVelocityModeCommand}" Command="{Binding SwitchVelocityModeCommand}"
Visibility="Collapsed"/> Visibility="Collapsed"/>
<!--// 林俊清, 20150930, 不分这些模式了。 <!--// 王海, 20150930, 不分这些模式了。
<Button Content="进入任务模式" <Button Content="进入任务模式"
Command="{Binding SwitchAppModeCommand}" Command="{Binding SwitchAppModeCommand}"
CommandParameter="{x:Static m:AppMode.PreparedForRunningTasks}" CommandParameter="{x:Static m:AppMode.PreparedForRunningTasks}"

View File

@ -421,9 +421,9 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\flyBase\flyBase.csproj"> <ProjectReference Include="..\..\FlyTest\FlightRoute\FlightRoute.csproj">
<Project>{be3280e8-8c7f-4961-9685-1124c5b990cb}</Project> <Project>{705aab55-ed7a-4856-8f7b-e7a78ed9e39a}</Project>
<Name>flyBase</Name> <Name>FlightRoute</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Plane.Libraries\Plane.Logging\Plane.Logging.csproj"> <ProjectReference Include="..\..\Plane.Libraries\Plane.Logging\Plane.Logging.csproj">
<Project>{9c2cafda-cf1d-4565-b797-398376fcd346}</Project> <Project>{9c2cafda-cf1d-4565-b797-398376fcd346}</Project>

View File

@ -554,7 +554,61 @@ namespace Plane.FormationCreator.ViewModels
{ {
return _TakeOffCommand ?? (_TakeOffCommand = new RelayCommand(async () => return _TakeOffCommand ?? (_TakeOffCommand = new RelayCommand(async () =>
{ {
await Task.WhenAll(_copterManager.AcceptingControlCopters.Select(copter => copter.TakeOffAsync())); FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0)
{
Alert.Show("作为参照的原点未设置,无法开始任务!", "提示");
return;
}
//飞机用UTC时间日志用本地时间记录
DateTime MissionTime = DateTime.UtcNow.AddSeconds(5);
DateTime MissionTime_log = DateTime.Now.AddSeconds(5);
Message.Show("任务开始:" + MissionTime_log.ToString());
//循环3次 发送起飞命令 避免通信问题
for (int i = 0; i < 10; i++)
{
/*await _commModuleManager.DoMissionStartAsync(_copterManager.Copters,
MissionTime.Hour,
MissionTime.Minute,
MissionTime.Second,
_flightTaskManager.OriginLng,
_flightTaskManager.OriginLat
);
*/
await _commModuleManager.DoMissionStartAsync(_copterManager.AcceptingControlCopters,
MissionTime.Hour,
MissionTime.Minute,
MissionTime.Second,
_flightTaskManager.OriginLng,
_flightTaskManager.OriginLat
);
/* await Task.WhenAll(_copterManager.AcceptingControlCopters.Select(copter => copter.MissionStartAsync(
MissionTime.Hour,
MissionTime.Minute,
MissionTime.Second,
_flightTaskManager.OriginLng,
_flightTaskManager.OriginLat
)));
*/
await Task.Delay(10).ConfigureAwait(false);
}
//_copterManager.Net_LogStartMission(MissionTime_log, _flightTaskManager.OriginLng, _flightTaskManager.OriginLat);
Alert.Show("所有选中飞机开始执行航点任务。请勿多次开始任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
})); }));
} }
} }
@ -1337,7 +1391,7 @@ namespace Plane.FormationCreator.ViewModels
if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun) if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun)
{ {
Alert.Show("RTK数据正在发送将自动关闭", "提示"); Alert.Show("RTK数据正在发送将自动关闭", "提示");
await _RtcmInfoViewModel.RtcmManager.Close(); await _RtcmInfoViewModel.RtcmManager.Close(_RtcmInfoViewModel.SerialPortsSelectdValue);
} }
@ -1370,7 +1424,7 @@ namespace Plane.FormationCreator.ViewModels
if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun) if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun)
{ {
Alert.Show("RTK数据正在发送将自动关闭", "提示"); Alert.Show("RTK数据正在发送将自动关闭", "提示");
await _RtcmInfoViewModel.RtcmManager.Close(); await _RtcmInfoViewModel.RtcmManager.Close(_RtcmInfoViewModel.SerialPortsSelectdValue);
} }
int coptercount = _copterManager.Copters.Count; int coptercount = _copterManager.Copters.Count;
@ -1411,7 +1465,7 @@ namespace Plane.FormationCreator.ViewModels
if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun) if (_RtcmInfoViewModel.RtcmManager.Rtcmthreadrun)
{ {
Alert.Show("RTK数据正在发送将自动关闭", "提示"); Alert.Show("RTK数据正在发送将自动关闭", "提示");
await _RtcmInfoViewModel.RtcmManager.Close(); await _RtcmInfoViewModel.RtcmManager.Close(_RtcmInfoViewModel.SerialPortsSelectdValue);
} }
Alert.Show("开始写入航点,请稍等!", "提示"); Alert.Show("开始写入航点,请稍等!", "提示");
@ -1526,14 +1580,30 @@ namespace Plane.FormationCreator.ViewModels
List<IMission> missions = new List<IMission>(); List<IMission> missions = new List<IMission>();
foreach (LEDInfo ledInfo in LEDInfos) foreach (LEDInfo ledInfo in LEDInfos)
{ {
float ledinterval=0;
//拉烟的ID 老版本只有8种新固件增加了
int fireno = 8;
Color color = (Color)ColorConverter.ConvertFromString("#" + ledInfo.LEDRGB); Color color = (Color)ColorConverter.ConvertFromString("#" + ledInfo.LEDRGB);
int ledMode = ledInfo.LEDMode; int ledMode = ledInfo.LEDMode;
//拉烟任务模式ID是50需要改为50 //拉烟任务模式ID是50需要改为50
if (ledMode == 15) ledMode = 50; if (_copterManager.FC_VER_NO == 1)
{
fireno = 8;
//老版本是闪烁频率,且不能为小数
ledinterval = ledInfo.LEDInterval;
}
else
{
fireno = 15;
//新版本飞控 是闪烁间隔单位是100ms地面站还是频率可以有1位小数,用户输入0.5hz 飞控应该是(1/0.5)*10=20
ledinterval = (1/ledInfo.LEDInterval);
}
if (ledMode == fireno) ledMode = 50;
IMission LEDMission = Mission.CreateLEDControlMission( IMission LEDMission = Mission.CreateLEDControlMission(
(int)(ledInfo.Delay * 10), (int)(ledInfo.Delay * 10),
ledMode, ledMode,
ledInfo.LEDInterval, ledinterval,
0, //ledInfo.LEDTimes, 0, //ledInfo.LEDTimes,
color.R, color.R,
color.G, color.G,

View File

@ -37,7 +37,7 @@ namespace Plane.FormationCreator.ViewModels
// } // }
// } // }
//}; //};
// TODO: 林俊清, 20150803, 没什么问题就把这段以及 FlyToLat 等属性删了。 // TODO: 王海, 20150803, 没什么问题就把这段以及 FlyToLat 等属性删了。
//_flightTaskManager.PropertyChanged += (sender, e) => //_flightTaskManager.PropertyChanged += (sender, e) =>
//{ //{
// switch (e.PropertyName) // switch (e.PropertyName)
@ -66,7 +66,7 @@ namespace Plane.FormationCreator.ViewModels
//}; //};
//_copterManager.SelectedCoptersChanged += (sender, e) => //_copterManager.SelectedCoptersChanged += (sender, e) =>
//{ //{
// // TODO: 林俊清, 20150731, 处理多选飞行器时的情况。 // // TODO: 王海, 20150731, 处理多选飞行器时的情况。
// var selectedCopters = _copterManager.SelectedCopters; // var selectedCopters = _copterManager.SelectedCopters;
// if (selectedCopters.Count() > 1) // if (selectedCopters.Count() > 1)
// { // {
@ -129,13 +129,13 @@ namespace Plane.FormationCreator.ViewModels
//private void InvokeForSelectedSingleCopterInfos(Action<FlightTaskSingleCopterInfo> action) //private void InvokeForSelectedSingleCopterInfos(Action<FlightTaskSingleCopterInfo> action)
//{ //{
// var modifyingTask = _flightTaskManager.SelectedTask as FlyToFlightTask; // var modifyingTask = _flightTaskManager.SelectedTask as FlyToFlightTask;
// if (modifyingTask != null && _copterManager.SelectedCopters.Count() == 1) // 林俊清, 20150731, 目前不处理多选的情况。 // if (modifyingTask != null && _copterManager.SelectedCopters.Count() == 1) // 王海, 20150731, 目前不处理多选的情况。
// { // {
// modifyingTask.FlyToFlightTaskSingleCopterInfos // modifyingTask.FlyToFlightTaskSingleCopterInfos
// .Where(i => _copterManager.SelectedCopters.FirstOrDefault() == i.Copter) // .Where(i => _copterManager.SelectedCopters.FirstOrDefault() == i.Copter)
// .ForEach(action); // .ForEach(action);
// // TODO: 林俊清, 20150731, 添加同时改多个 SingleCopterInfo 的程序。 // // TODO: 王海, 20150731, 添加同时改多个 SingleCopterInfo 的程序。
// //.Where(i => _copterManager.SelectedCopters.Contains(i.Copter)) // //.Where(i => _copterManager.SelectedCopters.Contains(i.Copter))
// } // }
//} //}

View File

@ -32,12 +32,14 @@ namespace Plane.FormationCreator.ViewModels
public RtcmInfoViewModel(RtcmManager rtcmManager) public RtcmInfoViewModel(RtcmManager rtcmManager)
{ {
_rtcmManager = rtcmManager; _rtcmManager = rtcmManager;
serialPorts.Add("魔方基站");
serialPorts.Add("千寻");
string[] commports = _rtcmManager.GetPortNames(); string[] commports = _rtcmManager.GetPortNames();
foreach (var item in commports) foreach (var item in commports)
{ {
serialPorts.Add(item); serialPorts.Add(item);
} }
serialPorts.Add("千寻");
SerialPortsSelectdValue = serialPorts[0]; SerialPortsSelectdValue = serialPorts[0];
} }
@ -47,12 +49,13 @@ namespace Plane.FormationCreator.ViewModels
{ {
string lastSelectValue = SerialPortsSelectdValue; string lastSelectValue = SerialPortsSelectdValue;
serialPorts.Clear(); serialPorts.Clear();
serialPorts.Add("魔方基站");
serialPorts.Add("千寻");
string[] commports = _rtcmManager.GetPortNames(); string[] commports = _rtcmManager.GetPortNames();
foreach (var item in commports) foreach (var item in commports)
{ {
serialPorts.Add(item); serialPorts.Add(item);
} }
serialPorts.Add("千寻");
if (serialPorts.Contains(lastSelectValue)) if (serialPorts.Contains(lastSelectValue))
SerialPortsSelectdValue = lastSelectValue; SerialPortsSelectdValue = lastSelectValue;
} }
@ -67,7 +70,7 @@ namespace Plane.FormationCreator.ViewModels
if (!_rtcmManager.Rtcmthreadrun) if (!_rtcmManager.Rtcmthreadrun)
await _rtcmManager.Open(SerialPortsSelectdValue); await _rtcmManager.Open(SerialPortsSelectdValue);
else else
await _rtcmManager.Close(); await _rtcmManager.Close(SerialPortsSelectdValue);
})); }));
} }
} }

View File

@ -46,9 +46,9 @@ namespace Plane.FormationCreator.Views
panel2.Visibility = Visibility.Collapsed; panel2.Visibility = Visibility.Collapsed;
panel3.Visibility = Visibility.Collapsed; panel3.Visibility = Visibility.Collapsed;
} }
CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
var version = Assembly.GetExecutingAssembly().GetName().Version; var version = Assembly.GetExecutingAssembly().GetName().Version;
about_ver.Text = "版本:" + version.ToString(); about_ver.Text = "版本:" + version.ToString() + "(飞控兼容:" + _copterManager.FC_VER_STRING + ")";
about_buildtm .Text= "编译时间:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString(); about_buildtm .Text= "编译时间:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString();

View File

@ -111,7 +111,7 @@
Command="{Binding UnlockCommand}" /> Command="{Binding UnlockCommand}" />
<Button Content="加锁" <Button Content="加锁"
Command="{Binding LockCommand}" /> Command="{Binding LockCommand}" />
<Button Content="起飞" Visibility="Collapsed" <Button Content="单独任务"
Command="{Binding TakeOffCommand}" /> Command="{Binding TakeOffCommand}" />

View File

@ -17,7 +17,7 @@
<Label Margin="5,0,0,0" Content="属性设置" VerticalAlignment="Center"/> <Label Margin="5,0,0,0" Content="属性设置" VerticalAlignment="Center"/>
<Separator></Separator> <Separator></Separator>
<StackPanel Margin="5,0,0,5" Orientation="Horizontal" HorizontalAlignment="Left"> <StackPanel Margin="5,0,0,5" Orientation="Horizontal" HorizontalAlignment="Left">
<Label Margin="0" Content="摆放高度" ></Label> <Label Margin="0" Content="摆放高度(米)" ></Label>
<TextBox <TextBox
Margin="30,0" Margin="30,0"
Width="80" Width="80"

View File

@ -1,4 +1,5 @@
using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.ServiceLocation;
using Plane.FormationCreator.Formation;
using Plane.FormationCreator.ViewModels; using Plane.FormationCreator.ViewModels;
using System.Reflection; using System.Reflection;
using System.Windows; using System.Windows;
@ -20,7 +21,8 @@ namespace Plane.FormationCreator.Views
LoginViewModel loginViewModel = ServiceLocator.Current.GetInstance<LoginViewModel>(); LoginViewModel loginViewModel = ServiceLocator.Current.GetInstance<LoginViewModel>();
this.DataContext = loginViewModel; this.DataContext = loginViewModel;
var version = Assembly.GetExecutingAssembly().GetName().Version; var version = Assembly.GetExecutingAssembly().GetName().Version;
about_ver.Content = "版本:" + version.ToString(); CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
about_ver.Content = "版本:" + version.ToString() + "(飞控兼容:"+ _copterManager.FC_VER_STRING + ")";
} }
} }

View File

@ -146,7 +146,7 @@ namespace Plane.FormationCreator.Views
//var pos = map.ViewportPointToLocation(e.GetPosition(map)); //var pos = map.ViewportPointToLocation(e.GetPosition(map));
//AddOrMoveCopter(new FakeCopter(pos.Latitude, pos.Longitude)); //AddOrMoveCopter(new FakeCopter(pos.Latitude, pos.Longitude));
// 林俊清, 20150930, AppMode 存在意义已不大;只有正在运行任务的时候才不允许指点。 // 王海, 20150930, AppMode 存在意义已不大;只有正在运行任务的时候才不允许指点。
//if (AppEx.Current.AppMode != AppMode.ControllingCopters) return; //if (AppEx.Current.AppMode != AppMode.ControllingCopters) return;
if (_flightTaskManager.IsPaused == false) return; if (_flightTaskManager.IsPaused == false) return;

View File

@ -462,6 +462,7 @@
<Button Content="测试/停止" VerticalAlignment="Center" <Button Content="测试/停止" VerticalAlignment="Center"
Margin="0,5,5,0" Margin="0,5,5,0"
Grid.Column="2" Grid.Column="2"
Visibility="Collapsed"
Command="{Binding TestCopterLEDCommand}" Command="{Binding TestCopterLEDCommand}"
/> />
@ -496,36 +497,40 @@
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate x:Name="LEDTemplate">
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" > <StackPanel Margin="0,5,0,0" Orientation="Horizontal" >
<TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock> <TextBlock Text="类型" Margin="0,0,0,0" VerticalAlignment="Center" ></TextBlock>
<ComboBox Height="25" MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center" <ComboBox x:Name="cmbTemplateLEDMode" Height="25" MinWidth="125" Width="110" Margin="5,0,0,0" Foreground="White" VerticalContentAlignment="Center"
SelectedIndex="{Binding Path=LEDMode}"> SelectedIndex="{Binding Path=LEDMode}"
Loaded="OnCBLoaded" Initialized="cmbTemplateLEDMode_Initialized"
>
<ComboBox.ItemContainerStyle> <ComboBox.ItemContainerStyle>
<Style> <Style>
<Setter Property="ComboBoxItem.Foreground" Value="White"/> <Setter Property="ComboBoxItem.Foreground" Value="White"/>
</Style> </Style>
</ComboBox.ItemContainerStyle> </ComboBox.ItemContainerStyle>
<ComboBoxItem Content="常亮" /> <ComboBoxItem Content="代码里面动态添加--这里数量要够" />
<ComboBoxItem Content="同步闪烁(单色)" /> <ComboBoxItem Content="同步闪烁(单色)" />
<ComboBoxItem Content="异步闪烁(随机)" /> <ComboBoxItem Content="异步闪烁(随机)" />
<ComboBoxItem Content="同步闪烁(随机)" />
<ComboBoxItem Content="异步闪烁(单色)" />
<ComboBoxItem Content="渐亮" /> <ComboBoxItem Content="渐亮" />
<ComboBoxItem Content="渐暗" /> <ComboBoxItem Content="渐暗" />
<ComboBoxItem Content="呼吸灯(单色)" /> <ComboBoxItem Content="呼吸灯(单色)" />
<ComboBoxItem Content="呼吸灯(随机)" /> <ComboBoxItem Content="同步闪烁(随机)" />
<ComboBoxItem Content="异步呼吸(单色)" /> <ComboBoxItem Content="异步闪烁(单色)" />
<ComboBoxItem Content="异步呼吸(随机)" /> <ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="变色(单色)" /> <ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="变色(随机)" /> <ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="异步变色(单色)" /> <ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="异步变色(随机)" /> <ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="拉烟"/>
<ComboBoxItem Content="拉烟"/> <ComboBoxItem Content="拉烟"/>
</ComboBox> </ComboBox>
<TextBlock Text="时间" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock> <TextBlock Text="时间" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
@ -533,9 +538,9 @@
ToolTip="单位:秒最小设置0.1秒" ToolTip="单位:秒最小设置0.1秒"
Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding Delay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="间隔" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock> <TextBlock Text="频率" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>
<TextBox Height="25" MinWidth="35" MaxWidth="40" Margin="5,0,0,0" <TextBox Height="25" MinWidth="35" MaxWidth="40" Margin="5,0,0,0"
ToolTip="单位:最小设置0.1秒" ToolTip="单位:HZ最小设置0.1HZ"
Text="{Binding Path=LEDInterval, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding Path=LEDInterval, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="颜色" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock> <TextBlock Text="颜色" Margin="12,0,0,0" VerticalAlignment="Center"></TextBlock>

View File

@ -29,11 +29,36 @@ namespace Plane.FormationCreator.Views
{ {
private int[] defcolor= { 255, 65280, 16711680, 65535 , 16711935, 16776960,0 }; private int[] defcolor= { 255, 65280, 16711680, 65535 , 16711935, 16776960,0 };
ModifyTaskViewModel _modifyTaskViewModel = ServiceLocator.Current.GetInstance<ModifyTaskViewModel>(); ModifyTaskViewModel _modifyTaskViewModel = ServiceLocator.Current.GetInstance<ModifyTaskViewModel>();
CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
private childItem FindVisualChild<childItem>(DependencyObject obj)
where childItem : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child != null && child is childItem)
{
return (childItem)child;
}
else
{
childItem childOfChild = FindVisualChild<childItem>(child);
if (childOfChild != null)
return childOfChild;
}
}
return null;
}
public ModifyTaskView() public ModifyTaskView()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = _modifyTaskViewModel; this.DataContext = _modifyTaskViewModel;
if (!VersionControl.IsFullVersion) if (!VersionControl.IsFullVersion)
{ {
//lightDesign.Visibility = Visibility.Collapsed; //lightDesign.Visibility = Visibility.Collapsed;
@ -42,6 +67,15 @@ namespace Plane.FormationCreator.Views
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
/*
DependencyObject myListItem = LEDItems.ItemContainerGenerator.ContainerFromItem(LEDItems.Items.CurrentItem);
ContentPresenter myContentPresenter = FindVisualChild<ContentPresenter>(myListItem);
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
ComboBox ledcomb = (ComboBox)myDataTemplate.FindName("cmbTemplateLEDMode", myContentPresenter);
// ledcomb.SelectedIndex = 2;
*/
// distanceCopters.Text; // distanceCopters.Text;
/* /*
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>(); FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
@ -63,6 +97,18 @@ namespace Plane.FormationCreator.Views
} }
void OnCBLoaded(object sender, EventArgs e)
{
}
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{ {
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog(); System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
@ -87,5 +133,46 @@ namespace Plane.FormationCreator.Views
} }
} }
private void cmbTemplateLEDMode_Initialized(object sender, EventArgs e)
{
int selind = 0;
ComboBox cb = (ComboBox)sender;
selind = cb.SelectedIndex;
cb.Items.Clear();
if (_copterManager.FC_VER_NO == 1)
{
cb.Items.Add("常亮"); //0
cb.Items.Add("同步闪烁(单色)"); //1
cb.Items.Add("异步闪烁(随机)"); //2
cb.Items.Add("渐亮"); //3
cb.Items.Add("渐暗"); //4
cb.Items.Add("呼吸灯(单色)"); //5
cb.Items.Add("同步闪烁(随机)"); //6
cb.Items.Add("异步闪烁(单色)"); //7
cb.Items.Add("拉烟"); //8
}
else
{
cb.Items.Add("常亮"); //0
cb.Items.Add("同步闪烁(单色)"); //1
cb.Items.Add("异步闪烁(随机)"); //2
cb.Items.Add("同步闪烁(随机)"); //3
cb.Items.Add("异步闪烁(单色)"); //4
cb.Items.Add("渐亮"); //5
cb.Items.Add("渐暗"); //6
cb.Items.Add("同步呼吸灯(单色)"); //7
cb.Items.Add("同步呼吸灯(随机色)"); //8
cb.Items.Add("异步呼吸(单色)"); //9
cb.Items.Add("异步呼吸(随机色)"); //10
cb.Items.Add("变色(单色)"); //11
cb.Items.Add("变色(随机)"); //12
cb.Items.Add("异步变色(单色)"); //13
cb.Items.Add("异步变色(随机)"); //14
cb.Items.Add("拉烟"); //15
}
cb.SelectedIndex = selind;
}
} }
} }

View File

@ -7,7 +7,7 @@
xmlns:c="http://metro.mahapps.com/winfx/xaml/controls" xmlns:c="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="800" d:DesignHeight="300" d:DesignWidth="800"
Height="350" Width="1500" WindowStartupLocation="CenterScreen" Background="#FF2D2D2D" BorderBrush="#FF039AF0" Title="RTK控制" ResizeMode="NoResize" Topmost="True"> Height="350" Width="1500" WindowStartupLocation="CenterScreen" Background="#FF2D2D2D" BorderBrush="#FF039AF0" Title="RTK控制" ResizeMode="NoResize">
<Grid Margin="0,0,0,0"> <Grid Margin="0,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>