ISEbd-12 Rozhkov.I.E. LabWork05 Simple #5

Closed
RozhVan wants to merge 1 commits from lab05 into lab04
31 changed files with 1242 additions and 171 deletions

25
AiSD Lab02/AiSD Lab02.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AiSD_Lab02", "AiSD Lab02\AiSD_Lab02.csproj", "{FA17B31D-8779-415E-B3A9-140812864D38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {268E47D2-9C2D-4863-BCE2-130796952BAF}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA17B31D-8779-415E-B3A9-140812864D38}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AiSD_Lab02</RootNamespace>
<AssemblyName>AiSD Lab02</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntityItem.cs" />
<Compile Include="FibNums.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,7 @@
namespace AiSD_Lab02;
public class EntityItem
{
public int Weight { get; set; }
public int Value { get; set; }
}

View File

@ -0,0 +1,64 @@
namespace AiSD_Lab02;
public class FibNums
{
public int Fib(int num)
{
if (num < 2) return 1;
else return Fib(num - 1) + Fib(num - 2);
}
public void Merge(int[] array, int lowIndex, int middleIndex, int highIndex)
{
int left = lowIndex;
int right = middleIndex + 1;
int[] tempArray = new int[highIndex - lowIndex + 1];
int index = 0;
while ((left <= middleIndex) && (right <= highIndex))
{
if (array[left] < array[right])
{
tempArray[index] = array[left];
left++;
}
else
{
tempArray[index] = array[right];
right++;
}
index++;
}
for (int i = left; i <= middleIndex; i++)
{
tempArray[index] = array[i];
index++;
}
for (int i = right; i <= highIndex; i++)
{
tempArray[index] = array[i];
index++;
}
for (int i = 0; i < tempArray.Length; i++)
{
array[lowIndex + i] = tempArray[i];
}
}
public int[] MergeSort(int[] array, int lowIndex, int highIndex)
{
if (lowIndex < highIndex)
{
int middleInd = (lowIndex + highIndex) / 2;
MergeSort(array, lowIndex, middleInd);
MergeSort(array, middleInd + 1, highIndex);
Merge(array, lowIndex, middleInd, highIndex);
}
return array;
}
}

View File

@ -0,0 +1,56 @@
using System.Collections.Generic;
using System;
namespace AiSD_Lab02;
public class Program
{
public static void Main(string[] args)
{
List<EntityItem> items = new List<EntityItem>()
{
new EntityItem { Weight = 2, Value = 10 },
new EntityItem { Weight = 3, Value = 5 },
new EntityItem { Weight = 5, Value = 15 },
new EntityItem { Weight = 7, Value = 7 },
new EntityItem { Weight = 1, Value = 6 }
};
int capacity = 10;
for (int i = 0; i < items.Count - 1; i++)
{
for (int j = 0; j < items.Count - i - 1; j++)
{
double ratio1 = items[j].Value / (double)items[j].Weight;
double ratio2 = items[j + 1].Value / (double)items[j + 1].Weight;
if (ratio1 < ratio2)
{
EntityItem temp = items[j];
items[j] = items[j + 1];
items[j + 1] = temp;
}
}
}
int totalValue = 0;
int totalWeight = 0;
foreach (EntityItem item in items)
{
if (totalWeight + item.Weight <= capacity)
{
totalValue += item.Value;
totalWeight += item.Weight;
Console.WriteLine($"Предмет: вес={item.Weight}, значение={item.Value}");
}
}
Console.WriteLine($"Суммарное значение: {totalValue}");
Console.WriteLine($"Суммарный вес: {totalWeight}");
FibNums fibNums = new FibNums();
Console.WriteLine(fibNums.Fib(5));
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные с этой сборкой.
[assembly: AssemblyTitle("AiSD Lab02")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AiSD Lab02")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM задайте для атрибута ComVisible этого типа значение true.
[assembly: ComVisible(false)]
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
[assembly: Guid("fa17b31d-8779-415e-b3a9-140812864d38")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

25
AiSD_Lab/AiSD Lab02.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AiSD Lab02", "AiSD Lab02\AiSD Lab02.csproj", "{FA17B31D-8779-415E-B3A9-140812864D38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {268E47D2-9C2D-4863-BCE2-130796952BAF}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA17B31D-8779-415E-B3A9-140812864D38}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AiSD_Lab02</RootNamespace>
<AssemblyName>AiSD Lab02</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntityItem.cs" />
<Compile Include="KnapsackGreedy.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
public class EntityItem
{
public int Weight { get; set; }
public int Value { get; set; }
public EntityItem(int weight, int value)
{
Weight = weight;
Value = value;
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AiSD_Lab02
{
internal class FibNums
{
}
}

View File

@ -0,0 +1,28 @@
using System.Collections.Generic;
using System;
public class Program
{
public static void Main(string[] args)
{
List<EntityItem> items = new List<EntityItem>()
{
new EntityItem(2, 10),
new EntityItem(3, 5),
new EntityItem(5, 15),
new EntityItem(7, 7),
new EntityItem(1, 6)
};
int capacity = 10;
List<EntityItem> result = FillKnapsack(items, capacity);
Console.WriteLine("Предмет в рюкзаке:");
foreach (EntityItem item in result)
{
Console.WriteLine($"Вес: {item.Weight}, Стоимость: {item.Value}");
}
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные с этой сборкой.
[assembly: AssemblyTitle("AiSD Lab02")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AiSD Lab02")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM задайте для атрибута ComVisible этого типа значение true.
[assembly: ComVisible(false)]
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
[assembly: Guid("fa17b31d-8779-415e-b3a9-140812864d38")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,67 @@
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace AiSD_Lab1;
public class Deque
{
Landmark first;
public Deque(string data)
{
Landmark newEl = new Landmark(data);
first = newEl;
}
public void AddFirst(string data)
{
Landmark newEl = new Landmark(data);
newEl.next = first;
first = newEl;
}
public Landmark RemoveFirst()
{
Landmark delEl = first;
first = delEl.next;
delEl.next = null;
return delEl;
}
public void RemoveLast()
{
Landmark delEl = first;
while (delEl.next.next != null)
{
delEl = delEl.next;
}
delEl.next = null;
}
public void AddLast(string data)
{
Landmark newEl = first;
while (newEl.next != null)
{
newEl = newEl.next;
}
newEl.next = new Landmark(data);
}
public string GetAll()
{
string Deque = "";
Landmark curr = first;
while (curr.next != null)
{
Deque += " " + curr.data;
curr = curr.next;
}
Deque += " " + curr.data;
return Deque;
}
}

View File

@ -0,0 +1,12 @@
namespace AiSD_Lab1;
public class Landmark
{
public String data;
public Landmark next;
public Landmark(String _data)
{
data = _data;
}
}

View File

@ -0,0 +1,27 @@
using System;
namespace AiSD_Lab1;
public class Program
{
public static void Main(String[] args)
{
Console.WriteLine("Сортировка слиянием");
Sort sort = new Sort();
sort.RandomArr();
sort.PrintArr();
sort.MergeSort(sort.arr, 0, sort.arr.Length - 1);
sort.PrintArr();
Deque deque = new Deque("Статуя свободы");
Console.WriteLine(deque.GetAll());
deque.AddFirst("Успенский собор");
Console.WriteLine(deque.GetAll());
deque.AddLast("Эйфелева башня");
Console.WriteLine(deque.GetAll());
deque.RemoveLast();
Console.WriteLine(deque.GetAll());
deque.RemoveFirst();
Console.WriteLine(deque.GetAll());
}
}

View File

@ -1,30 +0,0 @@
namespace AiSD_Lab1;
public class Deque<T> : Node<T>
{
Node<T>? head;
Node<T>? tail;
int count;
public AddFirst(T node)
{
}
public AddLast(T node)
{
}
public RemoveFirst()
{
}
public RemoveLast()
{
}
}

View File

@ -1,11 +0,0 @@
namespace AiSD_Lab1;
public class Node<T>
{
public Node(T data)
{
Data = data;
}
public T Data { get; set; }
public Node<T>? Next { get; set; }
}

View File

@ -1 +0,0 @@


View File

@ -25,4 +25,9 @@ public class EntityContainer : EntityShip
Container = container; Container = container;
Crane = crane; Crane = crane;
} }
public void ContainerColorChange(Color newColor)
{
ContainerColor = newColor;
}
} }

View File

@ -21,4 +21,9 @@ public class EntityShip
Weight = weight; Weight = weight;
ShipColor = shipColor; ShipColor = shipColor;
} }
public void ShipColorChange(Color newColor)
{
ShipColor = newColor;
}
} }

View File

@ -29,6 +29,12 @@
private void InitializeComponent() private void InitializeComponent()
{ {
groupBoxTools = new GroupBox(); groupBoxTools = new GroupBox();
panelCompanyTools = new Panel();
ButtonAddShip = new Button();
maskedTextBoxPosition = new MaskedTextBox();
ButtonRefresh = new Button();
ButtonDel = new Button();
ButtonGoToCheck = new Button();
ButtonCreateCompany = new Button(); ButtonCreateCompany = new Button();
panelStorage = new Panel(); panelStorage = new Panel();
radioButtonMassive = new RadioButton(); radioButtonMassive = new RadioButton();
@ -38,19 +44,12 @@
radioButtonList = new RadioButton(); radioButtonList = new RadioButton();
textBoxCollectionName = new TextBox(); textBoxCollectionName = new TextBox();
labelCollectionName = new Label(); labelCollectionName = new Label();
ButtonRefresh = new Button();
ButtonGoToCheck = new Button();
ButtonDel = new Button();
maskedTextBoxPosition = new MaskedTextBox();
ButtonAddCont = new Button();
ButtonAddShip = new Button();
ComboBoxSelectorCompany = new ComboBox(); ComboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox(); pictureBox = new PictureBox();
panelCompanyTools = new Panel();
groupBoxTools.SuspendLayout(); groupBoxTools.SuspendLayout();
panelCompanyTools.SuspendLayout();
panelStorage.SuspendLayout(); panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
panelCompanyTools.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// groupBoxTools // groupBoxTools
@ -67,6 +66,72 @@
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
// //
// panelCompanyTools
//
panelCompanyTools.Controls.Add(ButtonAddShip);
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
panelCompanyTools.Controls.Add(ButtonRefresh);
panelCompanyTools.Controls.Add(ButtonDel);
panelCompanyTools.Controls.Add(ButtonGoToCheck);
panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 400);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(194, 274);
panelCompanyTools.TabIndex = 9;
//
// ButtonAddShip
//
ButtonAddShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddShip.Location = new Point(6, 20);
ButtonAddShip.Name = "ButtonAddShip";
ButtonAddShip.Size = new Size(182, 40);
ButtonAddShip.TabIndex = 1;
ButtonAddShip.Text = "Добавление корабля";
ButtonAddShip.UseVisualStyleBackColor = true;
ButtonAddShip.Click += ButtonAddShip_Click;
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(6, 111);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(188, 23);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
// ButtonRefresh
//
ButtonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonRefresh.Location = new Point(6, 230);
ButtonRefresh.Name = "ButtonRefresh";
ButtonRefresh.Size = new Size(182, 39);
ButtonRefresh.TabIndex = 6;
ButtonRefresh.Text = "Обновить";
ButtonRefresh.UseVisualStyleBackColor = true;
ButtonRefresh.Click += ButtonRefresh_Click;
//
// ButtonDel
//
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonDel.Location = new Point(6, 140);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(182, 39);
ButtonDel.TabIndex = 4;
ButtonDel.Text = "Удплить контейнеровоз";
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonGoToCheck
//
ButtonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonGoToCheck.Location = new Point(6, 185);
ButtonGoToCheck.Name = "ButtonGoToCheck";
ButtonGoToCheck.Size = new Size(182, 39);
ButtonGoToCheck.TabIndex = 5;
ButtonGoToCheck.Text = "Передать на тесты";
ButtonGoToCheck.UseVisualStyleBackColor = true;
ButtonGoToCheck.Click += ButtonGoToCheck_Click;
//
// ButtonCreateCompany // ButtonCreateCompany
// //
ButtonCreateCompany.Location = new Point(6, 371); ButtonCreateCompany.Location = new Point(6, 371);
@ -159,70 +224,6 @@
labelCollectionName.TabIndex = 0; labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции:"; labelCollectionName.Text = "Название коллекции:";
// //
// ButtonRefresh
//
ButtonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonRefresh.Location = new Point(6, 230);
ButtonRefresh.Name = "ButtonRefresh";
ButtonRefresh.Size = new Size(182, 39);
ButtonRefresh.TabIndex = 6;
ButtonRefresh.Text = "Обновить";
ButtonRefresh.UseVisualStyleBackColor = true;
ButtonRefresh.Click += ButtonRefresh_Click;
//
// ButtonGoToCheck
//
ButtonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonGoToCheck.Location = new Point(6, 185);
ButtonGoToCheck.Name = "ButtonGoToCheck";
ButtonGoToCheck.Size = new Size(182, 39);
ButtonGoToCheck.TabIndex = 5;
ButtonGoToCheck.Text = "Передать на тесты";
ButtonGoToCheck.UseVisualStyleBackColor = true;
ButtonGoToCheck.Click += ButtonGoToCheck_Click;
//
// ButtonDel
//
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonDel.Location = new Point(6, 140);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(182, 39);
ButtonDel.TabIndex = 4;
ButtonDel.Text = "Удплить контейнеровоз";
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(6, 111);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(188, 23);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
// ButtonAddCont
//
ButtonAddCont.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddCont.Location = new Point(6, 66);
ButtonAddCont.Name = "ButtonAddCont";
ButtonAddCont.Size = new Size(182, 39);
ButtonAddCont.TabIndex = 2;
ButtonAddCont.Text = "Добавление контейнеровоза";
ButtonAddCont.UseVisualStyleBackColor = true;
ButtonAddCont.Click += ButtonAddCont_Click;
//
// ButtonAddShip
//
ButtonAddShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddShip.Location = new Point(6, 20);
ButtonAddShip.Name = "ButtonAddShip";
ButtonAddShip.Size = new Size(182, 40);
ButtonAddShip.TabIndex = 1;
ButtonAddShip.Text = "Добавление корабля";
ButtonAddShip.UseVisualStyleBackColor = true;
ButtonAddShip.Click += ButtonAddShip_Click;
//
// ComboBoxSelectorCompany // ComboBoxSelectorCompany
// //
ComboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; ComboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
@ -244,20 +245,6 @@
pictureBox.TabIndex = 1; pictureBox.TabIndex = 1;
pictureBox.TabStop = false; pictureBox.TabStop = false;
// //
// panelCompanyTools
//
panelCompanyTools.Controls.Add(ButtonAddShip);
panelCompanyTools.Controls.Add(ButtonAddCont);
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
panelCompanyTools.Controls.Add(ButtonRefresh);
panelCompanyTools.Controls.Add(ButtonDel);
panelCompanyTools.Controls.Add(ButtonGoToCheck);
panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 400);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(194, 274);
panelCompanyTools.TabIndex = 9;
//
// FormShipCollection // FormShipCollection
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@ -268,11 +255,11 @@
Name = "FormShipCollection"; Name = "FormShipCollection";
Text = "Коллекция кораблей"; Text = "Коллекция кораблей";
groupBoxTools.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
panelStorage.ResumeLayout(false); panelStorage.ResumeLayout(false);
panelStorage.PerformLayout(); panelStorage.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
} }
@ -280,7 +267,6 @@
private GroupBox groupBoxTools; private GroupBox groupBoxTools;
private ComboBox ComboBoxSelectorCompany; private ComboBox ComboBoxSelectorCompany;
private Button ButtonAddCont;
private Button ButtonAddShip; private Button ButtonAddShip;
private PictureBox pictureBox; private PictureBox pictureBox;
private MaskedTextBox maskedTextBoxPosition; private MaskedTextBox maskedTextBoxPosition;

View File

@ -20,30 +20,21 @@ public partial class FormShipCollection : Form
panelCompanyTools.Enabled = false; panelCompanyTools.Enabled = false;
} }
private void CreateObject(string type) private void ButtonAddShip_Click(object sender, EventArgs e)
{ {
if (_company == null) FormShipConfig form = new();
form.AddEvent(SetShip);
form.Show();
}
private void SetShip(DrawningShip? ship)
{
if (_company == null || ship == null)
{ {
return; return;
} }
if (_company + ship != -1)
Random random = new Random();
DrawningShip drawShip;
switch (type)
{
case nameof(DrawningShip):
drawShip = new DrawningShip(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
break;
case nameof(DrawCont):
drawShip = new DrawCont(random.Next(100, 300), random.Next(1000, 3000),
GetColor(random), GetColor(random), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
if (_company + drawShip != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show(); pictureBox.Image = _company.Show();
@ -54,21 +45,6 @@ public partial class FormShipCollection : Form
} }
} }
private static Color GetColor(Random random)
{
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
return color;
}
private void ButtonAddShip_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningShip));
private void ButtonAddCont_Click(object sender, EventArgs e) => CreateObject(nameof(DrawCont));
private void ButtonDel_Click(object sender, EventArgs e) private void ButtonDel_Click(object sender, EventArgs e)
{ {
@ -136,11 +112,6 @@ public partial class FormShipCollection : Form
pictureBox.Image = _company.Show(); pictureBox.Image = _company.Show();
} }
private void RadioButtonMassive_CheckedChanged(object sender, EventArgs e)
{
}
private void RerfreshListBoxItems() private void RerfreshListBoxItems()
{ {
listBoxCollection.Items.Clear(); listBoxCollection.Items.Clear();
@ -154,7 +125,6 @@ public partial class FormShipCollection : Form
} }
} }
private void ButtonCollectionAdd_Click(object sender, EventArgs e) private void ButtonCollectionAdd_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked)) if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))

View File

@ -0,0 +1,365 @@
namespace ProjectPlane
{
partial class FormShipConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
groupBoxConfig = new GroupBox();
groupBoxColors = new GroupBox();
panelPurple = new Panel();
panelYellow = new Panel();
panelBlack = new Panel();
panelBlue = new Panel();
panelGray = new Panel();
panelWhite = new Panel();
panelGreen = new Panel();
panelRed = new Panel();
checkBoxCrane = new CheckBox();
checkBoxContainer = new CheckBox();
numericUpDownWeight = new NumericUpDown();
numericUpDownSpeed = new NumericUpDown();
labelWeight = new Label();
labelSpeed = new Label();
labelModifiedObject = new Label();
labelSimpleObject = new Label();
pictureBoxObject = new PictureBox();
buttonAdd = new Button();
buttonCancel = new Button();
panelObject = new Panel();
labelContainerColor = new Label();
labelShipColor = new Label();
groupBoxConfig.SuspendLayout();
groupBoxColors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
panelObject.SuspendLayout();
SuspendLayout();
//
// groupBoxConfig
//
groupBoxConfig.Controls.Add(groupBoxColors);
groupBoxConfig.Controls.Add(checkBoxCrane);
groupBoxConfig.Controls.Add(checkBoxContainer);
groupBoxConfig.Controls.Add(numericUpDownWeight);
groupBoxConfig.Controls.Add(numericUpDownSpeed);
groupBoxConfig.Controls.Add(labelWeight);
groupBoxConfig.Controls.Add(labelSpeed);
groupBoxConfig.Controls.Add(labelModifiedObject);
groupBoxConfig.Controls.Add(labelSimpleObject);
groupBoxConfig.Dock = DockStyle.Left;
groupBoxConfig.Location = new Point(0, 0);
groupBoxConfig.Name = "groupBoxConfig";
groupBoxConfig.Size = new Size(571, 222);
groupBoxConfig.TabIndex = 0;
groupBoxConfig.TabStop = false;
groupBoxConfig.Text = "Параметры";
//
// groupBoxColors
//
groupBoxColors.Controls.Add(panelPurple);
groupBoxColors.Controls.Add(panelYellow);
groupBoxColors.Controls.Add(panelBlack);
groupBoxColors.Controls.Add(panelBlue);
groupBoxColors.Controls.Add(panelGray);
groupBoxColors.Controls.Add(panelWhite);
groupBoxColors.Controls.Add(panelGreen);
groupBoxColors.Controls.Add(panelRed);
groupBoxColors.Location = new Point(266, 30);
groupBoxColors.Name = "groupBoxColors";
groupBoxColors.Size = new Size(253, 119);
groupBoxColors.TabIndex = 8;
groupBoxColors.TabStop = false;
groupBoxColors.Text = "Цвета";
//
// panelPurple
//
panelPurple.BackColor = Color.Purple;
panelPurple.Location = new Point(190, 70);
panelPurple.Name = "panelPurple";
panelPurple.Size = new Size(43, 40);
panelPurple.TabIndex = 3;
panelPurple.MouseDown += Panel_MouseDown;
//
// panelYellow
//
panelYellow.BackColor = Color.Yellow;
panelYellow.Location = new Point(190, 22);
panelYellow.Name = "panelYellow";
panelYellow.Size = new Size(43, 40);
panelYellow.TabIndex = 1;
panelYellow.MouseDown += Panel_MouseDown;
//
// panelBlack
//
panelBlack.BackColor = Color.Black;
panelBlack.Location = new Point(129, 70);
panelBlack.Name = "panelBlack";
panelBlack.Size = new Size(43, 40);
panelBlack.TabIndex = 4;
panelBlack.MouseDown += Panel_MouseDown;
//
// panelBlue
//
panelBlue.BackColor = Color.Blue;
panelBlue.Location = new Point(129, 22);
panelBlue.Name = "panelBlue";
panelBlue.Size = new Size(43, 40);
panelBlue.TabIndex = 1;
panelBlue.MouseDown += Panel_MouseDown;
//
// panelGray
//
panelGray.BackColor = Color.Gray;
panelGray.Location = new Point(71, 70);
panelGray.Name = "panelGray";
panelGray.Size = new Size(43, 40);
panelGray.TabIndex = 5;
panelGray.MouseDown += Panel_MouseDown;
//
// panelWhite
//
panelWhite.BackColor = Color.White;
panelWhite.Location = new Point(14, 70);
panelWhite.Name = "panelWhite";
panelWhite.Size = new Size(43, 40);
panelWhite.TabIndex = 2;
panelWhite.MouseDown += Panel_MouseDown;
//
// panelGreen
//
panelGreen.BackColor = Color.Green;
panelGreen.Location = new Point(71, 22);
panelGreen.Name = "panelGreen";
panelGreen.Size = new Size(43, 40);
panelGreen.TabIndex = 1;
panelGreen.MouseDown += Panel_MouseDown;
//
// panelRed
//
panelRed.BackColor = Color.Red;
panelRed.Location = new Point(14, 22);
panelRed.Name = "panelRed";
panelRed.Size = new Size(43, 40);
panelRed.TabIndex = 0;
panelRed.MouseDown += Panel_MouseDown;
//
// checkBoxCrane
//
checkBoxCrane.AutoSize = true;
checkBoxCrane.Location = new Point(37, 160);
checkBoxCrane.Name = "checkBoxCrane";
checkBoxCrane.Size = new Size(158, 19);
checkBoxCrane.TabIndex = 7;
checkBoxCrane.Text = "Признак наличия крана";
checkBoxCrane.UseVisualStyleBackColor = true;
//
// checkBoxContainer
//
checkBoxContainer.AutoSize = true;
checkBoxContainer.Location = new Point(37, 121);
checkBoxContainer.Name = "checkBoxContainer";
checkBoxContainer.Size = new Size(190, 19);
checkBoxContainer.TabIndex = 6;
checkBoxContainer.Text = "Признак наличия контейнера";
checkBoxContainer.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
numericUpDownWeight.Location = new Point(105, 59);
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownWeight.Name = "numericUpDownWeight";
numericUpDownWeight.Size = new Size(122, 23);
numericUpDownWeight.TabIndex = 5;
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// numericUpDownSpeed
//
numericUpDownSpeed.Location = new Point(105, 30);
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownSpeed.Name = "numericUpDownSpeed";
numericUpDownSpeed.Size = new Size(122, 23);
numericUpDownSpeed.TabIndex = 4;
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelWeight
//
labelWeight.AutoSize = true;
labelWeight.Location = new Point(37, 59);
labelWeight.Name = "labelWeight";
labelWeight.Size = new Size(29, 15);
labelWeight.TabIndex = 3;
labelWeight.Text = "Вес:";
//
// labelSpeed
//
labelSpeed.AutoSize = true;
labelSpeed.Location = new Point(37, 30);
labelSpeed.Name = "labelSpeed";
labelSpeed.Size = new Size(62, 15);
labelSpeed.TabIndex = 2;
labelSpeed.Text = "Скорость:";
//
// labelModifiedObject
//
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
labelModifiedObject.Location = new Point(419, 160);
labelModifiedObject.Name = "labelModifiedObject";
labelModifiedObject.Size = new Size(100, 38);
labelModifiedObject.TabIndex = 1;
labelModifiedObject.Text = "Продвинутый";
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
labelModifiedObject.MouseDown += LabelObject_MouseDown;
//
// labelSimpleObject
//
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
labelSimpleObject.Location = new Point(266, 160);
labelSimpleObject.Name = "labelSimpleObject";
labelSimpleObject.Size = new Size(100, 38);
labelSimpleObject.TabIndex = 0;
labelSimpleObject.Text = "Простой";
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
labelSimpleObject.MouseDown += LabelObject_MouseDown;
//
// pictureBoxObject
//
pictureBoxObject.Location = new Point(11, 47);
pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new Size(209, 110);
pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false;
//
// buttonAdd
//
buttonAdd.Location = new Point(588, 187);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(75, 23);
buttonAdd.TabIndex = 2;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(722, 187);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
//
// panelObject
//
panelObject.AllowDrop = true;
panelObject.Controls.Add(labelContainerColor);
panelObject.Controls.Add(labelShipColor);
panelObject.Controls.Add(pictureBoxObject);
panelObject.Location = new Point(577, 12);
panelObject.Name = "panelObject";
panelObject.Size = new Size(229, 167);
panelObject.TabIndex = 4;
panelObject.DragDrop += PanelObject_DragDrop;
panelObject.DragEnter += PanelObject_DragEnter;
//
// labelContainerColor
//
labelContainerColor.AllowDrop = true;
labelContainerColor.BorderStyle = BorderStyle.FixedSingle;
labelContainerColor.Location = new Point(117, 8);
labelContainerColor.Name = "labelContainerColor";
labelContainerColor.Size = new Size(100, 33);
labelContainerColor.TabIndex = 3;
labelContainerColor.Text = "Доп цвет";
labelContainerColor.TextAlign = ContentAlignment.MiddleCenter;
labelContainerColor.DragDrop += LabelAdditionalColor_DragDrop;
labelContainerColor.DragEnter += LabelAdditionalColor_DragEnter;
//
// labelShipColor
//
labelShipColor.AllowDrop = true;
labelShipColor.BorderStyle = BorderStyle.FixedSingle;
labelShipColor.Location = new Point(11, 8);
labelShipColor.Name = "labelShipColor";
labelShipColor.Size = new Size(100, 33);
labelShipColor.TabIndex = 2;
labelShipColor.Text = "Цвет";
labelShipColor.TextAlign = ContentAlignment.MiddleCenter;
labelShipColor.DragDrop += LabelBodyColor_DragDrop;
labelShipColor.DragEnter += LabelBodyColor_DragEnter;
//
// FormShipConfig
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(809, 222);
Controls.Add(panelObject);
Controls.Add(buttonCancel);
Controls.Add(buttonAdd);
Controls.Add(groupBoxConfig);
Name = "FormShipConfig";
Text = "Создание объекта";
groupBoxConfig.ResumeLayout(false);
groupBoxConfig.PerformLayout();
groupBoxColors.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
panelObject.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private GroupBox groupBoxConfig;
private Label labelModifiedObject;
private Label labelSimpleObject;
private Label labelSpeed;
private NumericUpDown numericUpDownWeight;
private NumericUpDown numericUpDownSpeed;
private Label labelWeight;
private CheckBox checkBoxCrane;
private CheckBox checkBoxContainer;
private GroupBox groupBoxColors;
private Panel panelRed;
private Panel panelPurple;
private Panel panelYellow;
private Panel panelBlack;
private Panel panelBlue;
private Panel panelGray;
private Panel panelWhite;
private Panel panelGreen;
private PictureBox pictureBoxObject;
private Button buttonAdd;
private Button buttonCancel;
private Panel panelObject;
private Label labelContainerColor;
private Label labelShipColor;
}
}

View File

@ -0,0 +1,126 @@
using ProjectPlane.Drawnings;
using ProjectPlane.Entities;
namespace ProjectPlane;
public partial class FormShipConfig : Form
{
private DrawningShip? _ship;
private event Action<DrawningShip>? ShipDelegate;
public FormShipConfig()
{
InitializeComponent();
panelRed.MouseDown += Panel_MouseDown;
panelGreen.MouseDown += Panel_MouseDown;
panelBlue.MouseDown += Panel_MouseDown;
panelYellow.MouseDown += Panel_MouseDown;
panelWhite.MouseDown += Panel_MouseDown;
panelGray.MouseDown += Panel_MouseDown;
panelBlack.MouseDown += Panel_MouseDown;
panelPurple.MouseDown += Panel_MouseDown;
buttonCancel.Click += (sender, e) => Close();
}
private void DrawObject()
{
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp);
_ship?.SetPictureSize(pictureBoxObject.Width,
pictureBoxObject.Height);
_ship?.SetPosition(15, 15);
_ship?.DrawTransport(gr);
pictureBoxObject.Image = bmp;
}
public void AddEvent(Action<DrawningShip> shipDelegate)
{
ShipDelegate += shipDelegate;
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
}
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text)?.ToString())
{
case "labelSimpleObject":
_ship = new DrawningShip((int)numericUpDownSpeed.Value,
(double)numericUpDownWeight.Value, Color.White);
break;
case "labelModifiedObject":
_ship = new
DrawCont((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
Color.White,
Color.Black, checkBoxContainer.Checked,
checkBoxCrane.Checked);
break;
}
DrawObject();
}
private void Panel_MouseDown(object? sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.Black, DragDropEffects.Move | DragDropEffects.Copy);
}
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
}
/// <summary>
/// Действия при приеме перетаскиваемой информации(Основной цвет)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
{
_ship?.EntityShip?.ShipColorChange((Color)e.Data?.GetData(typeof(Color)));
DrawObject();
}
/// <summary>
/// Проверка получаемой информации(Доп. цвет) (ее типа на соответствие требуемому)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
}
/// <summary>
/// Действия при приеме перетаскиваемой информации(Доп. цвет)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{
if (_ship?.EntityShip is EntityContainer _container)
{
_container.ContainerColorChange((Color)e.Data?.GetData(typeof(Color)));
}
DrawObject();
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
if (_ship != null)
{
ShipDelegate?.Invoke(_ship);
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,5 @@
using ProjectPlane.Drawnings;
namespace ProjectPlane;
public delegate void ShipDelegate(DrawningShip ship);