revert последний коммит

revert файлы лабораторной
This commit is contained in:
Ivan_Starostin 2023-12-19 19:31:20 +04:00
parent a29254945d
commit 60f34c49b3
2 changed files with 29 additions and 60 deletions

View File

@ -1,15 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ProjectLainer.DrawningObjects;
using ProjectLainer.DrawningObjects;
using ProjectLainer.Generics;
using ProjectLainer.MovementStrategy;
@ -21,23 +10,25 @@ namespace ProjectLainer
public FormLainerCollection()
{
InitializeComponent();
_storage = new LainersGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
_storage = new LainersGenericStorage(pictureBoxCollection.Width,
pictureBoxCollection.Height);
}
private void ReloadObjects()
{
int index = listBoxStorages.SelectedIndex;
listBoxStorages.Items.Clear();
for (int i = 0; i < _storage.Keys.Count; i++)
foreach (string key in _storage.Keys)
{
listBoxStorages.Items.Add(_storage.Keys[i]);
}
if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count))
{
listBoxStorages.SelectedIndex = 0;
}
else if (listBoxStorages.Items.Count > 0 && index > -1 && index < listBoxStorages.Items.Count)
{
listBoxStorages.SelectedIndex = index;
listBoxStorages.Items.Add(key);
if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count))
{
listBoxStorages.SelectedIndex = 0;
}
else if (listBoxStorages.Items.Count > 0 && index > -1 && index < listBoxStorages.Items.Count)
{
listBoxStorages.SelectedIndex = index;
}
}
}
private void ButtonAddObject_Click(object sender, EventArgs e)
@ -75,9 +66,19 @@ namespace ProjectLainer
{
return;
}
var formLinerConfig = new FormLainerConfig();
formLinerConfig.AddEvent(AddLainer);
formLinerConfig.Show();
LainerForm form = new();
if (form.ShowDialog() == DialogResult.OK)
{
if (obj + form.SelectedLainer)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowLainers();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
}
private void ButtonRemove_Click(object sender, EventArgs e)
{
@ -85,7 +86,8 @@ namespace ProjectLainer
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
@ -124,26 +126,5 @@ namespace ProjectLainer
{
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowLainers();
}
private void AddLainer(DrawingEntity lainer)
{
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
if (obj + lainer)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowLainers();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProjectLainer.DrawningObjects;
namespace Lainers
{
public delegate void LainerDelegate(DrawingEntity car);
}