修改添加新飞机排序和显示id可能和之前不一致问题
This commit is contained in:
parent
7c71016e0c
commit
bbb7804831
@ -201,7 +201,7 @@ namespace Plane.FormationCreator
|
||||
Name = vIPID // ip.Substring(ip.LastIndexOf('.') + 1)
|
||||
};
|
||||
int _index;
|
||||
_index = copters.AddCopter(copter);
|
||||
_index = copters.AddCopter(copter, _copterManager.SortType);
|
||||
copterStatus.Insert(_index, false);
|
||||
copter.TextReceived += Copter_TextReceived;
|
||||
|
||||
@ -282,7 +282,7 @@ namespace Plane.FormationCreator
|
||||
};
|
||||
copter.VirtualId = 0;
|
||||
int _index;
|
||||
_index = _copterManager.Copters.AddCopter(copter);
|
||||
_index = _copterManager.Copters.AddCopter(copter, _copterManager.SortType);
|
||||
copterStatus.Insert(_index, false);
|
||||
copter.TextReceived += Copter_TextReceived;
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ namespace Plane.FormationCreator.Formation
|
||||
/// 实现排序插入
|
||||
/// </summary>
|
||||
/// <param name="baseSemObjects"></param>
|
||||
public int AddCopter(ICopter entityObject,bool sortbyid=true)
|
||||
public int AddCopter(ICopter entityObject, CopterManager.CopterSortType vSortType)
|
||||
{
|
||||
////给第三方时候限制数量和时间用
|
||||
DateTime dateTime2019 = DateTime.Parse("2020-06-01");
|
||||
DateTime dateTime2019 = DateTime.Parse("2020-08-01");
|
||||
|
||||
//新增飞机区域限制:内蒙
|
||||
// if (entityObject.Latitude < 37.4307185218 || entityObject.Latitude > 45.6754821756
|
||||
@ -95,7 +95,7 @@ namespace Plane.FormationCreator.Formation
|
||||
// {
|
||||
for (int i = 0; i < this.Count; i++)
|
||||
{
|
||||
if (sortbyid)
|
||||
if (vSortType == CopterManager.CopterSortType.ByID)
|
||||
{
|
||||
if (int.Parse(this[i].Id) == int.Parse(entityObject.Id))
|
||||
{
|
||||
@ -133,7 +133,7 @@ namespace Plane.FormationCreator.Formation
|
||||
for (int i = 0; i < this.Count; i++)
|
||||
{
|
||||
//按ID排序插入
|
||||
if (sortbyid)
|
||||
if (vSortType == CopterManager.CopterSortType.ByID)
|
||||
{
|
||||
if (int.Parse(this[i].Id) > int.Parse(entityObject.Id))
|
||||
{
|
||||
@ -141,14 +141,12 @@ namespace Plane.FormationCreator.Formation
|
||||
isInsret = true;
|
||||
_index = i;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
//按VID排序插入
|
||||
{
|
||||
|
||||
if (this[i].VirtualId > entityObject.VirtualId)
|
||||
if (this[i].VirtualId > entityObject.VirtualId)
|
||||
{
|
||||
|
||||
InsertItem(i, entityObject);
|
||||
@ -164,7 +162,13 @@ namespace Plane.FormationCreator.Formation
|
||||
Add(entityObject);
|
||||
_index = this.Count()-1 ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
entityObject.DisplayID = ((vSortType == CopterManager.CopterSortType.ByID) || (vSortType == CopterManager.CopterSortType.ByVIDShowAll));
|
||||
entityObject.DisplayVirtualId = ((vSortType == CopterManager.CopterSortType.ByVID) || (vSortType == CopterManager.CopterSortType.ByVIDShowAll));
|
||||
|
||||
return _index;
|
||||
}
|
||||
}
|
||||
@ -715,15 +719,7 @@ namespace Plane.FormationCreator.Formation
|
||||
tempCopters.AddRange(Copters);
|
||||
Copters.Clear();
|
||||
foreach (var copter in tempCopters)
|
||||
Copters.AddCopter(copter,false);
|
||||
|
||||
foreach (var copter in Copters)
|
||||
{
|
||||
copter.DisplayVirtualId = true;
|
||||
copter.DisplayID = displayid;
|
||||
}
|
||||
|
||||
|
||||
Copters.AddCopter(copter,SortType);
|
||||
}
|
||||
/// <summary>
|
||||
/// 按原始ID重新排序飞机
|
||||
@ -734,12 +730,8 @@ namespace Plane.FormationCreator.Formation
|
||||
tempCopters.AddRange(Copters);
|
||||
Copters.Clear();
|
||||
foreach (var copter in tempCopters)
|
||||
Copters.AddCopter(copter);
|
||||
foreach (var copter in Copters)
|
||||
{
|
||||
copter.DisplayVirtualId = false;
|
||||
copter.DisplayID = true;
|
||||
}
|
||||
Copters.AddCopter(copter,SortType);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
copter.VirtualId = _virtualCopterId;
|
||||
await copter.ConnectAsync();
|
||||
await copter.GetCopterDataAsync();
|
||||
_copterManager.Copters.AddCopter(copter);
|
||||
_copterManager.Copters.AddCopter(copter, _copterManager.SortType);
|
||||
_copterManager.CopterStatus.Add(false);
|
||||
}
|
||||
}
|
||||
|
@ -269,16 +269,24 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
}
|
||||
|
||||
if (Copter.DisplayVirtualId)
|
||||
switch (_copterManager.SortType)
|
||||
{
|
||||
CopterText.Text = Copter.VirtualId.ToString();
|
||||
CopterText.Foreground = new SolidColorBrush(Colors.Yellow);
|
||||
}
|
||||
else
|
||||
{
|
||||
CopterText.Text = Copter.Name;
|
||||
CopterText.Foreground = new SolidColorBrush(Colors.White);
|
||||
case CopterManager.CopterSortType.ByID:
|
||||
CopterText.Text = Copter.Name;
|
||||
CopterText.Foreground = new SolidColorBrush(Colors.White);
|
||||
break;
|
||||
case CopterManager.CopterSortType.ByVID:
|
||||
case CopterManager.CopterSortType.ByVIDShowAll:
|
||||
CopterText.Text = Copter.VirtualId.ToString();
|
||||
CopterText.Foreground = new SolidColorBrush(Colors.Yellow);
|
||||
break;
|
||||
default:
|
||||
CopterText.Text = Copter.Name;
|
||||
CopterText.Foreground = new SolidColorBrush(Colors.White);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Copter.GetShowLEDAsync())
|
||||
|
Loading…
Reference in New Issue
Block a user