Настройка работы стравнения. 8-я лабораторная.

This commit is contained in:
Programmist73 2022-12-05 19:25:49 +04:00
parent 519ba5ef7a
commit f5fb433b76
5 changed files with 17 additions and 20 deletions

View File

@ -89,7 +89,7 @@
this.buttonSortByColor.TabIndex = 12;
this.buttonSortByColor.Text = "Сортировка по цвету";
this.buttonSortByColor.UseVisualStyleBackColor = true;
this.buttonSortByColor.Click += new System.EventHandler(this.buttonSortByColor_Click);
this.buttonSortByColor.Click += new System.EventHandler(this.ButtonSortByColor_Click);
//
// buttonSortByType
//
@ -99,7 +99,7 @@
this.buttonSortByType.TabIndex = 11;
this.buttonSortByType.Text = "Сортировка по типу";
this.buttonSortByType.UseVisualStyleBackColor = true;
this.buttonSortByType.Click += new System.EventHandler(this.buttonSortByType_Click);
this.buttonSortByType.Click += new System.EventHandler(this.ButtonSortByType_Click);
//
// groupBoxMaps
//

View File

@ -294,7 +294,7 @@ namespace Airbus
}
//сортировка по типу
private void buttonSortByType_Click(object sender, EventArgs e)
private void ButtonSortByType_Click(object sender, EventArgs e)
{
if(listBoxMaps.SelectedIndex == -1)
{
@ -306,7 +306,7 @@ namespace Airbus
}
//сортировка по цвету
private void buttonSortByColor_Click(object sender, EventArgs e)
private void ButtonSortByColor_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{

View File

@ -20,7 +20,7 @@ namespace Airbus
return 1;
}
if (x != null && y != null)
if (x != null && y == null)
{
return -1;
}
@ -40,28 +40,25 @@ namespace Airbus
if (xPlane != null && yPlane == null)
{
return 1;
return -1;
}
var xEntity = xPlane.GetPlane.Airbus;
var yEntity = yPlane.GetPlane.Airbus;
var colorCompare = xEntity.CorpusColor.ToArgb().CompareTo(yEntity.CorpusColor.ToArgb());
int i = xEntity.CorpusColor.ToArgb();
int j = yEntity.CorpusColor.ToArgb();
var xEntityPlane = xPlane.GetPlane.Airbus;
var yEntityPlane = yPlane.GetPlane.Airbus;
var colorCompare = xEntityPlane.CorpusColor.ToArgb().CompareTo(yEntityPlane.CorpusColor.ToArgb());
if (colorCompare != 0)
{
return colorCompare;
}
if (xEntity is EntitySuperAirbus xEntityAirbus && yEntity is EntitySuperAirbus yEntityAirbus)
if (xEntityPlane is EntitySuperAirbus xAirbus && yEntityPlane is EntitySuperAirbus yAirbus)
{
var addColorCompare = xEntityAirbus.AddColor.ToArgb().CompareTo(yEntityAirbus.AddColor.ToArgb());
var dopColorCompare = xAirbus.AddColor.ToArgb().CompareTo(yAirbus.AddColor.ToArgb());
if(addColorCompare != 0)
if (dopColorCompare != 0)
{
return addColorCompare;
return dopColorCompare;
}
}

View File

@ -21,7 +21,7 @@ namespace Airbus
return 1;
}
if(x != null && y != null)
if(x != null && y == null)
{
return -1;
}
@ -41,7 +41,7 @@ namespace Airbus
if(xPlane != null && yPlane == null)
{
return 1;
return -1;
}
if(xPlane.GetPlane.GetType().Name != yPlane.GetPlane.GetType().Name)
@ -51,7 +51,7 @@ namespace Airbus
return -1;
}
return -1;
return 1;
}
var speedCompare = xPlane.GetPlane.Airbus.Speed.CompareTo(yPlane.GetPlane.Airbus.Speed);

View File

@ -1,2 +1,2 @@
MapsCollection
345|DesertStormMap|1000:750:Black:Yellow:False:True;1010:760:Yellow;1005:755:Lime;
345|DesertStormMap|1000:750:White:Gray:True:True;1000:750:DeepPink:Yellow:False:True;1001:751:Red;1000:750:Red;1005:755:Lime;1010:760:Yellow;1000:750:Black:Yellow:True:False;