Откат: e5ff429fd00796353d4b32b6b19c3400e18d4ff0
This commit is contained in:
parent
e5ff429fd0
commit
e38cf2d1ec
@ -18,17 +18,15 @@ public interface ICollectionGenericObjects<T>
|
|||||||
/// Добавление объекта в коллекцию
|
/// Добавление объекта в коллекцию
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">Добавляемый объект</param>
|
/// <param name="obj">Добавляемый объект</param>
|
||||||
/// <param name="comparer"> Сравнение двух объектов </param>
|
|
||||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||||
int Insert(T obj, IEqualityComparer<T?>? comparer = null);
|
int Insert(T obj);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в коллекцию на конкретную позицию
|
/// Добавление объекта в коллекцию на конкретную позицию
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">Добавляемый объект</param>
|
/// <param name="obj">Добавляемый объект</param>
|
||||||
/// <param name="comparer"> Сравнение двух объектов </param>
|
|
||||||
/// <param name="position">Позиция</param>
|
/// <param name="position">Позиция</param>
|
||||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||||
int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null);
|
int Insert(T obj, int position);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта из коллекции с конкретной позиции
|
/// Удаление объекта из коллекции с конкретной позиции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -51,14 +51,14 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
if (_collection[position] == null) throw new ObjectNotFoundException();
|
if (_collection[position] == null) throw new ObjectNotFoundException();
|
||||||
return _collection[position];
|
return _collection[position];
|
||||||
}
|
}
|
||||||
public int Insert(T obj, IEqualityComparer<T?>? comparer = null)
|
public int Insert(T obj)
|
||||||
{
|
{
|
||||||
if (Count == _maxCount) throw new CollectionOverflowException(Count);
|
if (Count == _maxCount) throw new CollectionOverflowException(Count);
|
||||||
_collection.Add(obj);
|
_collection.Add(obj);
|
||||||
return Count;
|
return Count;
|
||||||
|
|
||||||
}
|
}
|
||||||
public int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null)
|
public int Insert(T obj, int position)
|
||||||
{
|
{
|
||||||
if (Count == _maxCount) throw new CollectionOverflowException(Count);
|
if (Count == _maxCount) throw new CollectionOverflowException(Count);
|
||||||
if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position);
|
if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position);
|
||||||
|
@ -44,7 +44,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
if (position < 0 || position >= Count) throw new PositionOutOfCollectionException();
|
if (position < 0 || position >= Count) throw new PositionOutOfCollectionException();
|
||||||
return _collection[position];
|
return _collection[position];
|
||||||
}
|
}
|
||||||
public int Insert(T obj, IEqualityComparer<T?>? comparer = null)
|
public int Insert(T obj)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
}
|
}
|
||||||
throw new CollectionOverflowException();
|
throw new CollectionOverflowException();
|
||||||
}
|
}
|
||||||
public int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null)
|
public int Insert(T obj, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count)
|
if (position < 0 || position >= Count)
|
||||||
{
|
{
|
||||||
@ -66,6 +66,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
{
|
{
|
||||||
_collection[position] = obj;
|
_collection[position] = obj;
|
||||||
return position;
|
return position;
|
||||||
|
|
||||||
}
|
}
|
||||||
int temp = position + 1;
|
int temp = position + 1;
|
||||||
while (temp < Count)
|
while (temp < Count)
|
||||||
|
@ -46,6 +46,10 @@ public partial class FormBoatCollection : Form
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonAddBoat_Click(object sender, EventArgs e)
|
private void ButtonAddBoat_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
FormBoatConfig form = new();
|
FormBoatConfig form = new();
|
||||||
form.AddEvent(SetBoat);
|
form.AddEvent(SetBoat);
|
||||||
form.Show();
|
form.Show();
|
||||||
@ -195,6 +199,10 @@ public partial class FormBoatCollection : Form
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// TODO прописать логику удаления элемента из коллекции
|
||||||
|
// нужно убедиться, что есть выбранная коллекция
|
||||||
|
// спросить у пользователя через MessageBox, что он подтверждает, что хочет удалить запись
|
||||||
|
// удалить и обновить ListBox
|
||||||
if (listBoxCollection.SelectedIndex < 0)
|
if (listBoxCollection.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
MessageBox.Show("Коллекция не выбрана");
|
||||||
|
@ -9,15 +9,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.10" />
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -29,9 +23,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="serilogConfig.json">
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
</None>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -42,4 +42,4 @@ namespace MotorBoat
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}<EFBFBD>
|
Loading…
x
Reference in New Issue
Block a user