Compare commits

...

7 Commits
main ... Lab-3

Author SHA1 Message Date
7220e5c229 added missing logic 2024-04-03 14:04:19 +04:00
f50833a276 lab-3 done 2024-03-31 11:56:01 +04:00
70f40c1f99 lab-2 done 2024-03-06 16:13:49 +04:00
f633bde48a final result 2024-02-21 16:14:29 +04:00
051f96a96e minor fix 2 2024-02-21 15:23:31 +04:00
29891204b0 minor fix 2024-02-18 13:15:36 +04:00
1d3eae1520 lab1 done 2024-02-18 12:55:30 +04:00
33 changed files with 1900 additions and 75 deletions

View File

@ -8,4 +8,19 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,67 @@
using Catamaran.Drawings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.CollectionGenericObjects
{
public abstract class AbstractCompany
{
protected readonly int _placeSizeWidth = 180;
protected readonly int _placeSizeHeight = 80;
protected readonly int _pictureWidth;
protected readonly int _pictureHeight;
protected ICollectionGenericObjects<DrawingBoat>? _collection = null;
private int GetMaxCount => (_pictureWidth / _placeSizeWidth) * (_pictureHeight / _placeSizeHeight / 2) ;
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawingBoat> collection)
{
_pictureHeight = picHeight;
_pictureWidth = picWidth;
_collection = collection;
_collection.SetMaxCount = GetMaxCount;
}
public static int operator +(AbstractCompany company, DrawingBoat boat)
{
return company._collection.Insert(boat);
}
public static DrawingBoat operator -(AbstractCompany company, int position)
{
return company._collection.Remove(position);
}
public DrawingBoat? GetRandomObject()
{
Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount));
}
public Bitmap? Show()
{
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
Graphics graphics = Graphics.FromImage(bitmap);
DrawBackground(graphics);
SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
{
DrawingBoat? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}
return bitmap;
}
protected abstract void DrawBackground(Graphics g);
protected abstract void SetObjectsPosition();
}
}

View File

@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.CollectionGenericObjects
{
public class ArrayGenericObjects<T> : ICollectionGenericObjects<T>
where T : class
{
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount
{
set
{
if (value > 0)
{
if (_collection.Length > 0)
{
Array.Resize(ref _collection, value);
}
else
{
_collection = new T[value];
}
}
}
}
public ArrayGenericObjects()
{
_collection = Array.Empty<T?>();
}
public T? Get(int position)
{
if (position >= 0 && position < Count)
{
return _collection[position];
}
return null;
}
public int Insert(T obj)
{
for (int i = 0; i < Count; i++)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
return -1;
}
public int Insert(T obj, int position)
{
if (position < Count)
{
if (_collection[position] == null)
{
_collection[position] = obj;
return position;
}
else
{
for (int i = 0; i < Count; i++)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
}
}
return -1;
}
public T? Remove(int position)
{
if (position > Count || position < 0)
{
return null;
}
T? obj = _collection[position];
_collection[position] = null;
return obj;
}
}
}

View File

@ -0,0 +1,60 @@
using Catamaran.Drawings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.CollectionGenericObjects
{
public class Harbor : AbstractCompany
{
public Harbor(int picWidth, int picHeight, ICollectionGenericObjects<DrawingBoat> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackground(Graphics g)
{
Pen pen = new Pen(Color.Black, 4f);
for (int i = 0; i < _pictureHeight / _placeSizeHeight / 2; i++)
{
g.DrawLine(pen, 0, _pictureHeight - i * _placeSizeHeight * 2, _placeSizeWidth * (_pictureWidth / _placeSizeWidth), _pictureHeight - i * _placeSizeHeight * 2);
for (int j = 0; j < _pictureWidth / _placeSizeWidth + 1; j++)
{
g.DrawLine(pen, _placeSizeWidth * j, _pictureHeight - i * _placeSizeHeight * 2, _placeSizeWidth * j, _pictureHeight - i * _placeSizeHeight * 2 - _placeSizeHeight);
}
}
}
protected override void SetObjectsPosition()
{
int curPosX = 0;
int curPosY = 0;
for (int i = 0; i < (_collection?.Count ?? 0); i++)
{
if (curPosX > _pictureWidth / _placeSizeWidth)
{
return;
}
if (_collection?.Get(i) != null)
{
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection?.Get(i)?.SetPosition(curPosX * _placeSizeWidth + 20, curPosY * _placeSizeHeight * -2 + (_pictureHeight - 60) );
}
if (curPosX < _pictureWidth / _placeSizeWidth - 1)
{
curPosX++;
}
else
{
curPosX = 0;
curPosY++;
}
}
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.CollectionGenericObjects
{
public interface ICollectionGenericObjects<T>
where T : class
{
int Count { get; }
int SetMaxCount { set; }
int Insert(T obj);
int Insert(T obj, int position);
T? Remove(int position);
T? Get(int position);
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.Drawings
{
public enum DirectionType
{
Unknown = -1,
Up = 1,
Down = 2,
Left = 3,
Right = 4
}
}

View File

@ -0,0 +1,180 @@
using Catamaran.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.Drawings
{
public class DrawingBoat
{
public EntityBoat? EntityBoat { get; protected set; }
private int? _pictureWidth;
private int? _pictureHeight;
protected int? _startPosX;
protected int? _startPosY;
private readonly int _drawingCatamaranWidth = 100;
private readonly int _drawingCatamaranHeight = 40;
public int? GetPosX => _startPosX;
public int? GetPosY => _startPosY;
public int GetWidth => _drawingCatamaranWidth;
public int GetHeight => _drawingCatamaranHeight;
private DrawingBoat()
{
_pictureHeight = null;
_pictureWidth = null;
_startPosX = null;
_startPosY = null;
}
public DrawingBoat(int speed, double weight, Color bodyColor) : this()
{
EntityBoat = new EntityBoat(speed, weight, bodyColor);
}
protected DrawingBoat(int drawingCatamaranWidth, int drawingCatamaranHeight) : this()
{
_drawingCatamaranWidth = drawingCatamaranWidth;
_drawingCatamaranHeight = drawingCatamaranHeight;
}
public bool SetPictureSize(int width, int height)
{
if (width > _drawingCatamaranWidth && height > _drawingCatamaranHeight)
{
_pictureWidth = width;
_pictureHeight = height;
if (_startPosX != null && _startPosY != null)
{
if (_startPosX.Value < 0) _startPosX = 0;
if (_startPosY.Value < 0) _startPosY = 0;
if (_startPosX.Value + _drawingCatamaranWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingCatamaranWidth;
}
if (_startPosY.Value + _drawingCatamaranHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingCatamaranHeight;
}
}
return true;
}
return false;
}
public void SetPosition(int x, int y)
{
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
{
return;
}
else
{
_startPosX = x;
_startPosY = y;
if (_startPosX.Value < 0) _startPosX = 0;
if (_startPosY.Value < 0) _startPosY = 0;
if (_startPosX.Value + _drawingCatamaranWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingCatamaranWidth;
}
if (_startPosY.Value + _drawingCatamaranHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingCatamaranHeight;
}
}
}
public bool MoveTransport(DirectionType direction)
{
if (EntityBoat == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return false;
}
switch (direction)
{
//влево
case DirectionType.Left:
if (_startPosX.Value - EntityBoat.Step > 0)
{
_startPosX -= (int)EntityBoat.Step;
}
return true;
//вверх
case DirectionType.Up:
if (_startPosY.Value - EntityBoat.Step > 0)
{
_startPosY -= (int)EntityBoat.Step;
}
return true;
// вправо
case DirectionType.Right:
if (_startPosX.Value + _drawingCatamaranWidth + EntityBoat.Step < _pictureWidth)
{
_startPosX += (int)EntityBoat.Step;
}
return true;
//вниз
case DirectionType.Down:
if (_startPosY.Value + _drawingCatamaranHeight + EntityBoat.Step < _pictureHeight)
{
_startPosY += (int)EntityBoat.Step;
}
return true;
default:
return false;
}
}
public virtual void DrawTransport(Graphics g)
{
if (EntityBoat == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
Brush baseBrush = new SolidBrush(EntityBoat.BodyColor);
Brush brBrush = new SolidBrush(Color.Brown);
// начало отрисовки
Point[] body =
{
new Point(_startPosX.Value + 10, _startPosY.Value + 10),
new Point(_startPosX.Value + 75, _startPosY.Value + 10),
new Point(_startPosX.Value + 95, _startPosY.Value + 25),
new Point(_startPosX.Value + 75, _startPosY.Value + 40),
new Point(_startPosX.Value + 10, _startPosY.Value + 40),
new Point(_startPosX.Value + 10, _startPosY.Value + 10)
};
g.FillPolygon(baseBrush, body);
g.DrawPolygon(pen, body);
g.FillEllipse(brBrush, _startPosX.Value + 15, _startPosY.Value + 15, 60, 20);
g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 15, 60, 20);
// конец отрисовки
}
}
}

View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Catamaran.Entities;
namespace Catamaran.Drawings
{
public class DrawingCatamaran : DrawingBoat
{
public DrawingCatamaran(int speed, double weight, Color bodyColor, Color additionalColor, bool leftBobber, bool rightBobber, bool sail) : base(120, 90)
{
EntityBoat = new EntityCatamaran(speed, weight, bodyColor, additionalColor, leftBobber, rightBobber, sail);
}
public override void DrawTransport(Graphics g)
{
if (EntityBoat == null || EntityBoat is not EntityCatamaran EntityCatamaran || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
Brush baseBrush = new SolidBrush(EntityCatamaran.BodyColor);
Brush additionalBrush = new SolidBrush(EntityCatamaran.AdditionalColor);
Brush brBrush = new SolidBrush(Color.Brown);
// левый поплавок
if (EntityCatamaran.LeftBobber)
{
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 8, 100, 15);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 8, 100, 15);
}
// правый поплавок
if (EntityCatamaran.RightBobber)
{
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 37, 100, 15);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 37, 100, 15);
}
// начало отрисовки
_startPosX += 5;
_startPosY += 5;
base.DrawTransport(g);
_startPosX -= 5;
_startPosY -= 5;
// конец отрисовки
// парус
if (EntityCatamaran.Sail)
{
Point[] sail =
{
new Point(_startPosX.Value + 50, _startPosY.Value + 30),
new Point(_startPosX.Value + 50, _startPosY.Value + 5),
new Point(_startPosX.Value + 80, _startPosY.Value + 25),
new Point(_startPosX.Value + 50, _startPosY.Value + 25),
};
g.FillPolygon(additionalBrush, sail);
g.DrawPolygon(pen, sail);
}
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.Entities
{
public class EntityCatamaran : EntityBoat
{
public Color AdditionalColor { get; private set; }
public bool LeftBobber { get; private set; }
public bool RightBobber { get; private set; }
public bool Sail { get; private set; }
public double Step => Speed * 100 / Weight;
public EntityCatamaran(int speed, double weight, Color bodyColor, Color additionalColor, bool leftBobber, bool rightBobber, bool sail) : base(speed, weight, bodyColor)
{
AdditionalColor = additionalColor;
LeftBobber = leftBobber;
RightBobber = rightBobber;
Sail = sail;
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.Entities
{
public class EntityBoat
{
public int Speed { get; private set; }
public double Weight { get; private set; }
public Color BodyColor { get; private set; }
public double Step => Speed * 100 / Weight;
public EntityBoat(int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
}
}
}

View File

@ -1,39 +0,0 @@
namespace Catamaran
{
partial class Form1
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace Catamaran
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,169 @@
namespace Catamaran
{
partial class FormBoatColletion
{
/// <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()
{
groupBox1 = new GroupBox();
UpdateButton = new Button();
GoToTestButton = new Button();
DeleteButton = new Button();
maskedTextBox = new MaskedTextBox();
AddCatamaranButton = new Button();
AddBoatButton = new Button();
InstrumentBox = new ComboBox();
pictureBox = new PictureBox();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(UpdateButton);
groupBox1.Controls.Add(GoToTestButton);
groupBox1.Controls.Add(DeleteButton);
groupBox1.Controls.Add(maskedTextBox);
groupBox1.Controls.Add(AddCatamaranButton);
groupBox1.Controls.Add(AddBoatButton);
groupBox1.Controls.Add(InstrumentBox);
groupBox1.Dock = DockStyle.Right;
groupBox1.Location = new Point(809, 0);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(237, 642);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Инструменты";
//
// UpdateButton
//
UpdateButton.Location = new Point(6, 565);
UpdateButton.Name = "UpdateButton";
UpdateButton.Size = new Size(225, 38);
UpdateButton.TabIndex = 6;
UpdateButton.Text = "Обновить";
UpdateButton.UseVisualStyleBackColor = true;
UpdateButton.Click += UpdateButton_Click;
//
// GoToTestButton
//
GoToTestButton.Location = new Point(12, 355);
GoToTestButton.Name = "GoToTestButton";
GoToTestButton.Size = new Size(225, 38);
GoToTestButton.TabIndex = 5;
GoToTestButton.Text = "Передать на тесты";
GoToTestButton.UseVisualStyleBackColor = true;
GoToTestButton.Click += GoToTestButton_Click;
//
// DeleteButton
//
DeleteButton.Location = new Point(6, 238);
DeleteButton.Name = "DeleteButton";
DeleteButton.Size = new Size(225, 38);
DeleteButton.TabIndex = 4;
DeleteButton.Text = "Удалить лодку";
DeleteButton.UseVisualStyleBackColor = true;
DeleteButton.Click += DeleteButton_Click;
//
// maskedTextBox
//
maskedTextBox.Location = new Point(6, 205);
maskedTextBox.Mask = "00";
maskedTextBox.Name = "maskedTextBox";
maskedTextBox.Size = new Size(225, 27);
maskedTextBox.TabIndex = 3;
maskedTextBox.ValidatingType = typeof(int);
//
// AddCatamaranButton
//
AddCatamaranButton.Location = new Point(6, 104);
AddCatamaranButton.Name = "AddCatamaranButton";
AddCatamaranButton.Size = new Size(225, 38);
AddCatamaranButton.TabIndex = 2;
AddCatamaranButton.Text = "Добавить катамаран";
AddCatamaranButton.UseVisualStyleBackColor = true;
AddCatamaranButton.Click += AddCatamaranButton_Click;
//
// AddBoatButton
//
AddBoatButton.Location = new Point(6, 60);
AddBoatButton.Name = "AddBoatButton";
AddBoatButton.Size = new Size(225, 38);
AddBoatButton.TabIndex = 1;
AddBoatButton.Text = "Добавить лодку";
AddBoatButton.UseVisualStyleBackColor = true;
AddBoatButton.Click += AddBoatButton_Click;
//
// InstrumentBox
//
InstrumentBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
InstrumentBox.AutoCompleteCustomSource.AddRange(new string[] { "Хранилище" });
InstrumentBox.DropDownStyle = ComboBoxStyle.DropDownList;
InstrumentBox.FormattingEnabled = true;
InstrumentBox.Items.AddRange(new object[] { "Хранилище" });
InstrumentBox.Location = new Point(6, 26);
InstrumentBox.Name = "InstrumentBox";
InstrumentBox.Size = new Size(225, 28);
InstrumentBox.TabIndex = 0;
InstrumentBox.SelectedIndexChanged += InstrumentBox_SelectedIndexChanged;
//
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(809, 642);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
// FormBoatColletion
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1046, 642);
Controls.Add(pictureBox);
Controls.Add(groupBox1);
Name = "FormBoatColletion";
Text = "Коллекция лодок";
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBox1;
private ComboBox InstrumentBox;
private Button AddBoatButton;
private Button AddCatamaranButton;
private PictureBox pictureBox;
private MaskedTextBox maskedTextBox;
private Button DeleteButton;
private Button GoToTestButton;
private Button UpdateButton;
}
}

View File

@ -0,0 +1,156 @@
using Catamaran.CollectionGenericObjects;
using Catamaran.Drawings;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Catamaran
{
public partial class FormBoatColletion : Form
{
private AbstractCompany? _company = null;
public FormBoatColletion()
{
InitializeComponent();
}
private void InstrumentBox_SelectedIndexChanged(object sender, EventArgs e)
{
switch (InstrumentBox.Text)
{
case "Хранилище":
_company = new Harbor(pictureBox.Width, pictureBox.Height, new ArrayGenericObjects<DrawingBoat>());
break;
}
}
private void CreateObject(string type)
{
if (_company == null)
{
return;
}
DrawingBoat drawingBoat;
Random random = new();
switch (type)
{
case nameof(DrawingBoat):
drawingBoat = new DrawingBoat(random.Next(100, 500), random.Next(1000, 3000), GetColor(random));
break;
case nameof(DrawingCatamaran):
drawingBoat = new DrawingCatamaran(random.Next(100, 500), random.Next(1000, 3000), GetColor(random), GetColor(random),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
if (_company + drawingBoat >= 0)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void AddBoatButton_Click(object sender, EventArgs e)
{
CreateObject(nameof(DrawingBoat));
}
private void AddCatamaranButton_Click(object sender, EventArgs e)
{
CreateObject(nameof(DrawingCatamaran));
}
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 DeleteButton_Click(object sender, EventArgs e)
{
if (_company == null || string.IsNullOrEmpty(maskedTextBox.Text))
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
int pos = Convert.ToInt32(maskedTextBox.Text);
if (_company - pos != null)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
private void UpdateButton_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
pictureBox.Image = _company.Show();
}
private void GoToTestButton_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
DrawingBoat? boat = null;
int counter = 100;
while (boat == null)
{
boat = _company.GetRandomObject();
counter--;
if (counter <= 0) break;
}
if (boat == null)
{
return;
}
FormCatamaran form = new()
{
SetBoat = boat
};
form.ShowDialog();
}
}
}

View File

@ -1,17 +1,17 @@
<?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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -0,0 +1,149 @@
namespace Catamaran
{
partial class FormCatamaran
{
/// <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()
{
pictureBox1 = new PictureBox();
buttonLeft = new Button();
buttonDown = new Button();
buttonRight = new Button();
buttonUp = new Button();
StrategyBox = new ComboBox();
StepButton = new Button();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
// pictureBox1
//
pictureBox1.Dock = DockStyle.Fill;
pictureBox1.Location = new Point(0, 0);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(668, 497);
pictureBox1.TabIndex = 0;
pictureBox1.TabStop = false;
//
// buttonLeft
//
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = Properties.Resources.leftArrow;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
buttonLeft.Location = new Point(494, 435);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(50, 50);
buttonLeft.TabIndex = 2;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += ButtonMove_Click;
//
// buttonDown
//
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = Properties.Resources.downArrow;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
buttonDown.Location = new Point(550, 435);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(50, 50);
buttonDown.TabIndex = 3;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += ButtonMove_Click;
//
// buttonRight
//
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = Properties.Resources.rightArrow;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
buttonRight.Location = new Point(606, 435);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(50, 50);
buttonRight.TabIndex = 4;
buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += ButtonMove_Click;
//
// buttonUp
//
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = Properties.Resources.upArrow;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
buttonUp.Location = new Point(550, 379);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(50, 50);
buttonUp.TabIndex = 5;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.Click += ButtonMove_Click;
//
// StrategyBox
//
StrategyBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
StrategyBox.DropDownStyle = ComboBoxStyle.DropDownList;
StrategyBox.FormattingEnabled = true;
StrategyBox.Items.AddRange(new object[] { "В центр", "К краю" });
StrategyBox.Location = new Point(505, 12);
StrategyBox.Name = "StrategyBox";
StrategyBox.Size = new Size(151, 28);
StrategyBox.TabIndex = 7;
//
// StepButton
//
StepButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
StepButton.Location = new Point(562, 46);
StepButton.Name = "StepButton";
StepButton.Size = new Size(94, 29);
StepButton.TabIndex = 8;
StepButton.Text = "Шаг";
StepButton.UseVisualStyleBackColor = true;
StepButton.Click += StepButton_Click;
//
// FormCatamaran
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(668, 497);
Controls.Add(StepButton);
Controls.Add(StrategyBox);
Controls.Add(buttonUp);
Controls.Add(buttonRight);
Controls.Add(buttonDown);
Controls.Add(buttonLeft);
Controls.Add(pictureBox1);
Name = "FormCatamaran";
Text = "Катамаран";
SizeChanged += FormCatamaran_SizeChanged;
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
ResumeLayout(false);
}
#endregion
private PictureBox pictureBox1;
private Button buttonLeft;
private Button buttonDown;
private Button buttonRight;
private Button buttonUp;
private ComboBox StrategyBox;
private Button StepButton;
}
}

View File

@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Catamaran.Drawings;
using Catamaran.Entities;
using Catamaran.MovementStrategy;
namespace Catamaran
{
public partial class FormCatamaran : Form
{
private DrawingBoat? _drawingBoat;
private AbstractStrategy? _strategy;
public FormCatamaran()
{
InitializeComponent();
_strategy = null;
}
public DrawingBoat SetBoat
{
set
{
_drawingBoat = value;
_drawingBoat.SetPictureSize(pictureBox1.Width, pictureBox1.Height);
StrategyBox.Enabled = true;
_strategy = null;
Draw();
}
}
private void Draw()
{
if (_drawingBoat == null) return;
Bitmap bmp = new(pictureBox1.Width, pictureBox1.Height);
Graphics gr = Graphics.FromImage(bmp);
_drawingBoat.DrawTransport(gr);
pictureBox1.Image = bmp;
}
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawingBoat == null) return;
string name = ((Button)sender)?.Name ?? string.Empty;
bool result = false;
switch (name)
{
case "buttonUp":
result = _drawingBoat.MoveTransport(DirectionType.Up); break;
case "buttonDown":
result = _drawingBoat.MoveTransport(DirectionType.Down); break;
case "buttonLeft":
result = _drawingBoat.MoveTransport(DirectionType.Left); break;
case "buttonRight":
result = _drawingBoat.MoveTransport(DirectionType.Right); break;
}
if (result)
{
Draw();
}
}
private void FormCatamaran_SizeChanged(object sender, EventArgs e)
{
if (_drawingBoat == null) return;
_drawingBoat.SetPictureSize(pictureBox1.Width, pictureBox1.Height);
if (_drawingBoat.SetPictureSize(pictureBox1.Width, pictureBox1.Height))
{
Draw();
}
}
private void StepButton_Click(object sender, EventArgs e)
{
if (_drawingBoat == null)
{
return;
}
if (StrategyBox.Enabled)
{
_strategy = StrategyBox.SelectedIndex switch
{
0 => new MoveToCenter(),
1 => new MoveToBorder(),
_ => null,
};
if (_strategy == null)
{
return;
}
_strategy.SetData(new MoveableBoat(_drawingBoat), pictureBox1.Width, pictureBox1.Height);
}
if (_strategy == null)
{
return;
}
StrategyBox.Enabled = false;
_strategy.MakeStep();
Draw();
if (_strategy.GetStatus() == StrategyStatus.Finish)
{
StrategyBox.Enabled = true;
_strategy = null;
}
}
}
}

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,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public abstract class AbstractStrategy
{
private IMoveableObject? _moveableObject;
private StrategyStatus _state = StrategyStatus.NotInit;
protected int FieldWidth { get; private set; }
protected int FieldHeight { get; private set; }
public StrategyStatus GetStatus() { return _state; }
public void SetData(IMoveableObject moveableObject, int width, int height)
{
if (moveableObject == null)
{
_state = StrategyStatus.NotInit;
return;
}
_state = StrategyStatus.InProgress;
_moveableObject = moveableObject;
FieldWidth = width;
FieldHeight = height;
}
public void MakeStep()
{
if (_state != StrategyStatus.InProgress)
{
return;
}
if (IsTargetDestination())
{
_state = StrategyStatus.Finish;
return;
}
MoveToTarget();
}
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
protected bool MoveRight() => MoveTo(MovementDirection.Right);
protected bool MoveUp() => MoveTo(MovementDirection.Up);
protected bool MoveDown() => MoveTo(MovementDirection.Down);
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
protected abstract void MoveToTarget();
protected abstract bool IsTargetDestination();
protected int? GetStep()
{
if (_state != StrategyStatus.InProgress)
{
return null;
}
return _moveableObject?.GetStep;
}
private bool MoveTo(MovementDirection direction)
{
if (_state != StrategyStatus.InProgress)
{
return false;
}
return _moveableObject?.TryMoveObject(direction) ?? false;
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public interface IMoveableObject
{
ObjectParameters? GetObjectPosition { get; }
int GetStep { get; }
bool TryMoveObject(MovementDirection direction);
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public class MoveToBorder : AbstractStrategy
{
protected override bool IsTargetDestination()
{
ObjectParameters? objParams = GetObjectParameters;
if (objParams == null)
{
return false;
}
return objParams.RightBorder + GetStep() >= FieldWidth &&
objParams.DownBorder + GetStep() >= FieldHeight;
}
protected override void MoveToTarget()
{
ObjectParameters? objParams = GetObjectParameters;
if (objParams == null)
{
return;
}
int diffX = objParams.RightBorder - FieldWidth;
if (Math.Abs(diffX) > GetStep())
{
MoveRight();
}
int diffY = objParams.DownBorder - FieldHeight;
if (Math.Abs(diffY) > GetStep())
{
MoveDown();
}
}
}
}

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public class MoveToCenter : AbstractStrategy
{
protected override bool IsTargetDestination()
{
ObjectParameters? objParams = GetObjectParameters;
if (objParams == null)
{
return false;
}
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 &&
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 &&
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
}
protected override void MoveToTarget()
{
ObjectParameters? objParams = GetObjectParameters;
if (objParams == null)
{
return;
}
int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
if (Math.Abs(diffX) > GetStep())
{
if (diffX > 0)
{
MoveLeft();
}
else
{
MoveRight();
}
}
int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
if (Math.Abs(diffY) > GetStep())
{
if (diffY > 0)
{
MoveUp();
}
else
{
MoveDown();
}
}
}
}
}

View File

@ -0,0 +1,55 @@
using Catamaran.Drawings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
internal class MoveableBoat : IMoveableObject
{
private readonly DrawingBoat? _boat = null;
public MoveableBoat(DrawingBoat boat)
{
_boat = boat;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_boat == null || _boat.EntityBoat == null || !_boat.GetPosX.HasValue || !_boat.GetPosY.HasValue)
{
return null;
}
return new ObjectParameters(_boat.GetPosX.Value, _boat.GetPosY.Value, _boat.GetWidth, _boat.GetHeight);
}
}
public int GetStep => (int)(_boat?.EntityBoat?.Step ?? 0);
public bool TryMoveObject(MovementDirection direction)
{
if (_boat == null || _boat.EntityBoat == null)
{
return false;
}
return _boat.MoveTransport(GetDirectionType(direction));
}
private static DirectionType GetDirectionType(MovementDirection direction)
{
return direction switch
{
MovementDirection.Left => DirectionType.Left,
MovementDirection.Right => DirectionType.Right,
MovementDirection.Up => DirectionType.Up,
MovementDirection.Down => DirectionType.Down,
_ => DirectionType.Unknown
};
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public enum MovementDirection
{
//Unknown = -1,
Up = 1,
Down = 2,
Left = 3,
Right = 4
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public class ObjectParameters
{
private readonly int _x;
private readonly int _y;
private readonly int _width;
private readonly int _height;
public int LeftBorder => _x;
public int TopBorder => _y;
public int RightBorder => _x + _width;
public int DownBorder => _y + _height;
public int ObjectMiddleHorizontal => _x + _width / 2;
public int ObjectMiddleVertical => _y + _height / 2;
public ObjectParameters(int x, int y, int width, int height)
{
_x = x;
_y = y;
_width = width;
_height = height;
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran.MovementStrategy
{
public enum StrategyStatus
{
NotInit,
InProgress,
Finish
}
}

View File

@ -11,7 +11,7 @@ namespace Catamaran
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new FormBoatColletion());
}
}
}

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Catamaran.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Catamaran.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap downArrow {
get {
object obj = ResourceManager.GetObject("downArrow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap leftArrow {
get {
object obj = ResourceManager.GetObject("leftArrow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap rightArrow {
get {
object obj = ResourceManager.GetObject("rightArrow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap upArrow {
get {
object obj = ResourceManager.GetObject("upArrow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="leftArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\leftArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="upArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\upArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="downArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\downArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="rightArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\rightArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB