加入通讯模块类型,初步支持wifi通讯
This commit is contained in:
parent
776b9cfe62
commit
3d2a3b10fb
@ -30,6 +30,7 @@ namespace Plane.FormationCreator
|
||||
{
|
||||
public App()
|
||||
{
|
||||
VersionControl.GetSettingFromIni();
|
||||
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
|
||||
|
||||
ServiceLocatorConfigurer.Instance.Configure();
|
||||
@ -69,7 +70,7 @@ namespace Plane.FormationCreator
|
||||
};
|
||||
//new Test().Prepare().Run();
|
||||
|
||||
VersionControl.GetSettingFromIni();
|
||||
|
||||
}
|
||||
|
||||
private ILogger _logger;
|
||||
@ -133,20 +134,25 @@ namespace Plane.FormationCreator
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
UdpServerConnectionManager.Instance.ExceptionThrown += (sender, e1) =>
|
||||
{
|
||||
_logger.Log(e1.Exception);
|
||||
};
|
||||
UdpServerConnectionManager.Instance.ConnectionEstablished += ConnectionManager_ConnectionEstablished;
|
||||
UdpServerConnectionManager.Instance.StartReceiving();
|
||||
*/
|
||||
|
||||
//初始化地面站连接
|
||||
CommModuleManager.Instance.CommunicationReceived += CommtionReceivedCopterInfo;
|
||||
CommModuleManager.Instance.CommunicationCopterDisconnect += CommCopterDisconnect;
|
||||
CommModuleManager.Instance.CommunicationConnected += CommCopterconnected;
|
||||
CommModuleManager.Instance.Connect();
|
||||
if (VersionControl.ConType == 1)
|
||||
{
|
||||
CommModuleManager.Instance.UseTransModule = false;
|
||||
UdpServerConnectionManager.Instance.ExceptionThrown += (sender, e1) =>
|
||||
{
|
||||
_logger.Log(e1.Exception);
|
||||
};
|
||||
UdpServerConnectionManager.Instance.ConnectionEstablished += ConnectionManager_ConnectionEstablished;
|
||||
UdpServerConnectionManager.Instance.StartReceiving();
|
||||
}
|
||||
else
|
||||
{
|
||||
CommModuleManager.Instance.UseTransModule = true;
|
||||
//初始化地面站连接
|
||||
CommModuleManager.Instance.CommunicationReceived += CommtionReceivedCopterInfo;
|
||||
CommModuleManager.Instance.CommunicationCopterDisconnect += CommCopterDisconnect;
|
||||
CommModuleManager.Instance.CommunicationConnected += CommCopterconnected;
|
||||
CommModuleManager.Instance.Connect();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -196,7 +202,8 @@ namespace Plane.FormationCreator
|
||||
{
|
||||
copter.Connection = Connection;
|
||||
}
|
||||
await copter.ConnectAsync().ConfigureAwait(false);
|
||||
if (copter!=null)
|
||||
await copter.ConnectAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void ConnectionManager_ConnectionEstablished(object sender, ConnectionEstablishedEventArgs e)
|
||||
|
@ -29,6 +29,8 @@ namespace Plane.FormationCreator.Util
|
||||
|
||||
public static string ServerURL = "";
|
||||
|
||||
public static int ConType = 0; //通讯模块
|
||||
|
||||
public static void SetUserLever(int vuserlever)
|
||||
{
|
||||
if (vuserlever==0)
|
||||
@ -78,13 +80,11 @@ namespace Plane.FormationCreator.Util
|
||||
else
|
||||
ServerURL = DefaultServrURL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
readvalue = iniFiles.IniReadvalue("Default", "ConType");
|
||||
if (readvalue != "")
|
||||
ConType = int.Parse(readvalue);
|
||||
else
|
||||
ConType = 0;
|
||||
}
|
||||
|
||||
public static void SaveLogininfoToIni(string username,string password,bool issavepassword)
|
||||
|
Loading…
Reference in New Issue
Block a user