pre release
This commit is contained in:
parent
e28c9878fe
commit
d723288bc4
@ -12,4 +12,9 @@ public class BaseLinerEntity
|
||||
Weight = weight;
|
||||
PrimaryColor = primaryColor;
|
||||
}
|
||||
|
||||
public void SetPrimaryColor(Color color)
|
||||
{
|
||||
PrimaryColor = color;
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,9 @@ public class LinerEntity : BaseLinerEntity
|
||||
HasExtraDeck = hasExtraDeck;
|
||||
HasPool = hasPool;
|
||||
}
|
||||
|
||||
public void SetColors(Color secondaryColor)
|
||||
{
|
||||
SecondaryColor = secondaryColor;
|
||||
}
|
||||
}
|
||||
|
424
ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs
generated
Normal file
424
ProjectLiner/ProjectLiner/FormLinerConfig.Designer.cs
generated
Normal file
@ -0,0 +1,424 @@
|
||||
namespace ProjectLiner
|
||||
{
|
||||
partial class FormLinerConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBoxParameters = new GroupBox();
|
||||
labelAdvancedObject = new Label();
|
||||
labelBasicObject = new Label();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelRed = new Panel();
|
||||
comboBoxLinerType = new ComboBox();
|
||||
checkBoxPool = new CheckBox();
|
||||
checkBoxExtraDeck = new CheckBox();
|
||||
numericUpDownMaxPassengers = new NumericUpDown();
|
||||
numericUpDownCapacity = new NumericUpDown();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelPassengers = new Label();
|
||||
labelCapacity = new Label();
|
||||
labelWeight = new Label();
|
||||
labelLinerType = new Label();
|
||||
labelSpeed = new Label();
|
||||
pictureBoxLiner = new PictureBox();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
panelObject = new Panel();
|
||||
labelSecondaryColor = new Label();
|
||||
labelPrimaryColor = new Label();
|
||||
groupBoxParameters.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownMaxPassengers).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).BeginInit();
|
||||
panelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxParameters
|
||||
//
|
||||
groupBoxParameters.Controls.Add(labelAdvancedObject);
|
||||
groupBoxParameters.Controls.Add(labelBasicObject);
|
||||
groupBoxParameters.Controls.Add(groupBoxColors);
|
||||
groupBoxParameters.Controls.Add(comboBoxLinerType);
|
||||
groupBoxParameters.Controls.Add(checkBoxPool);
|
||||
groupBoxParameters.Controls.Add(checkBoxExtraDeck);
|
||||
groupBoxParameters.Controls.Add(numericUpDownMaxPassengers);
|
||||
groupBoxParameters.Controls.Add(numericUpDownCapacity);
|
||||
groupBoxParameters.Controls.Add(numericUpDownWeight);
|
||||
groupBoxParameters.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxParameters.Controls.Add(labelPassengers);
|
||||
groupBoxParameters.Controls.Add(labelCapacity);
|
||||
groupBoxParameters.Controls.Add(labelWeight);
|
||||
groupBoxParameters.Controls.Add(labelLinerType);
|
||||
groupBoxParameters.Controls.Add(labelSpeed);
|
||||
groupBoxParameters.Dock = DockStyle.Left;
|
||||
groupBoxParameters.Location = new Point(0, 0);
|
||||
groupBoxParameters.Name = "groupBoxParameters";
|
||||
groupBoxParameters.Size = new Size(594, 261);
|
||||
groupBoxParameters.TabIndex = 0;
|
||||
groupBoxParameters.TabStop = false;
|
||||
groupBoxParameters.Text = "Parameters";
|
||||
//
|
||||
// labelAdvancedObject
|
||||
//
|
||||
labelAdvancedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdvancedObject.Location = new Point(433, 214);
|
||||
labelAdvancedObject.Name = "labelAdvancedObject";
|
||||
labelAdvancedObject.Size = new Size(155, 35);
|
||||
labelAdvancedObject.TabIndex = 5;
|
||||
labelAdvancedObject.Text = "Advanced Object";
|
||||
labelAdvancedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdvancedObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelBasicObject
|
||||
//
|
||||
labelBasicObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBasicObject.Location = new Point(274, 214);
|
||||
labelBasicObject.Name = "labelBasicObject";
|
||||
labelBasicObject.Size = new Size(155, 35);
|
||||
labelBasicObject.TabIndex = 5;
|
||||
labelBasicObject.Text = "Basic Object";
|
||||
labelBasicObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelBasicObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelPurple);
|
||||
groupBoxColors.Controls.Add(panelYellow);
|
||||
groupBoxColors.Controls.Add(panelBlack);
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelGray);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelWhite);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Location = new Point(274, 19);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Size = new Size(314, 164);
|
||||
groupBoxColors.TabIndex = 4;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Colors";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(242, 95);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(67, 62);
|
||||
panelPurple.TabIndex = 0;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(242, 27);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(67, 62);
|
||||
panelYellow.TabIndex = 0;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(169, 95);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(67, 62);
|
||||
panelBlack.TabIndex = 0;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(169, 27);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(67, 62);
|
||||
panelBlue.TabIndex = 0;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(93, 95);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(67, 62);
|
||||
panelGray.TabIndex = 0;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(93, 27);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(67, 62);
|
||||
panelGreen.TabIndex = 0;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(16, 95);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(67, 62);
|
||||
panelWhite.TabIndex = 0;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(16, 27);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(67, 62);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// comboBoxLinerType
|
||||
//
|
||||
comboBoxLinerType.FormattingEnabled = true;
|
||||
comboBoxLinerType.Items.AddRange(new object[] { "Passenger", "Cargo", "Military", "Mixed" });
|
||||
comboBoxLinerType.Location = new Point(11, 43);
|
||||
comboBoxLinerType.Name = "comboBoxLinerType";
|
||||
comboBoxLinerType.Size = new Size(121, 23);
|
||||
comboBoxLinerType.TabIndex = 3;
|
||||
//
|
||||
// checkBoxPool
|
||||
//
|
||||
checkBoxPool.AutoSize = true;
|
||||
checkBoxPool.Location = new Point(138, 230);
|
||||
checkBoxPool.Name = "checkBoxPool";
|
||||
checkBoxPool.Size = new Size(90, 19);
|
||||
checkBoxPool.TabIndex = 2;
|
||||
checkBoxPool.Text = "Pool feature";
|
||||
checkBoxPool.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxExtraDeck
|
||||
//
|
||||
checkBoxExtraDeck.AutoSize = true;
|
||||
checkBoxExtraDeck.Location = new Point(11, 230);
|
||||
checkBoxExtraDeck.Name = "checkBoxExtraDeck";
|
||||
checkBoxExtraDeck.Size = new Size(121, 19);
|
||||
checkBoxExtraDeck.TabIndex = 2;
|
||||
checkBoxExtraDeck.Text = "Extra Deck feature";
|
||||
checkBoxExtraDeck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownMaxPassengers
|
||||
//
|
||||
numericUpDownMaxPassengers.Location = new Point(105, 186);
|
||||
numericUpDownMaxPassengers.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownMaxPassengers.Name = "numericUpDownMaxPassengers";
|
||||
numericUpDownMaxPassengers.Size = new Size(120, 23);
|
||||
numericUpDownMaxPassengers.TabIndex = 1;
|
||||
numericUpDownMaxPassengers.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownCapacity
|
||||
//
|
||||
numericUpDownCapacity.Location = new Point(105, 153);
|
||||
numericUpDownCapacity.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||
numericUpDownCapacity.Size = new Size(120, 23);
|
||||
numericUpDownCapacity.TabIndex = 1;
|
||||
numericUpDownCapacity.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(105, 118);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(120, 23);
|
||||
numericUpDownWeight.TabIndex = 1;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(105, 85);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(120, 23);
|
||||
numericUpDownSpeed.TabIndex = 1;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelPassengers
|
||||
//
|
||||
labelPassengers.Location = new Point(11, 188);
|
||||
labelPassengers.Name = "labelPassengers";
|
||||
labelPassengers.Size = new Size(88, 21);
|
||||
labelPassengers.TabIndex = 0;
|
||||
labelPassengers.Text = "Passengers:";
|
||||
//
|
||||
// labelCapacity
|
||||
//
|
||||
labelCapacity.Location = new Point(11, 155);
|
||||
labelCapacity.Name = "labelCapacity";
|
||||
labelCapacity.Size = new Size(88, 21);
|
||||
labelCapacity.TabIndex = 0;
|
||||
labelCapacity.Text = "Capacity:";
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.Location = new Point(11, 120);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(88, 21);
|
||||
labelWeight.TabIndex = 0;
|
||||
labelWeight.Text = "Weight:";
|
||||
//
|
||||
// labelLinerType
|
||||
//
|
||||
labelLinerType.Location = new Point(11, 19);
|
||||
labelLinerType.Name = "labelLinerType";
|
||||
labelLinerType.Size = new Size(88, 21);
|
||||
labelLinerType.TabIndex = 0;
|
||||
labelLinerType.Text = "Type of Liner";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.Location = new Point(11, 87);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(88, 21);
|
||||
labelSpeed.TabIndex = 0;
|
||||
labelSpeed.Text = "Speed:";
|
||||
//
|
||||
// pictureBoxLiner
|
||||
//
|
||||
pictureBoxLiner.Location = new Point(9, 56);
|
||||
pictureBoxLiner.Name = "pictureBoxLiner";
|
||||
pictureBoxLiner.Size = new Size(179, 123);
|
||||
pictureBoxLiner.TabIndex = 1;
|
||||
pictureBoxLiner.TabStop = false;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(609, 214);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 33);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.Text = "Add";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(713, 214);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 33);
|
||||
buttonCancel.TabIndex = 2;
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panelObject
|
||||
//
|
||||
panelObject.AllowDrop = true;
|
||||
panelObject.Controls.Add(pictureBoxLiner);
|
||||
panelObject.Controls.Add(labelSecondaryColor);
|
||||
panelObject.Controls.Add(labelPrimaryColor);
|
||||
panelObject.Location = new Point(600, 12);
|
||||
panelObject.Name = "panelObject";
|
||||
panelObject.Size = new Size(198, 196);
|
||||
panelObject.TabIndex = 3;
|
||||
panelObject.DragDrop += PanelObject_DragDrop;
|
||||
panelObject.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// labelSecondaryColor
|
||||
//
|
||||
labelSecondaryColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSecondaryColor.Location = new Point(100, 7);
|
||||
labelSecondaryColor.Name = "labelSecondaryColor";
|
||||
labelSecondaryColor.Size = new Size(88, 35);
|
||||
labelSecondaryColor.TabIndex = 5;
|
||||
labelSecondaryColor.Text = "Secondray Color";
|
||||
labelSecondaryColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSecondaryColor.DragDrop += LabelColor_DragDrop;
|
||||
labelSecondaryColor.DragEnter += LabelColor_DragEnter;
|
||||
//
|
||||
// labelPrimaryColor
|
||||
//
|
||||
labelPrimaryColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelPrimaryColor.Location = new Point(9, 7);
|
||||
labelPrimaryColor.Name = "labelPrimaryColor";
|
||||
labelPrimaryColor.Size = new Size(88, 35);
|
||||
labelPrimaryColor.TabIndex = 5;
|
||||
labelPrimaryColor.Text = "Primary Color";
|
||||
labelPrimaryColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelPrimaryColor.DragDrop += LabelColor_DragDrop;
|
||||
labelPrimaryColor.DragEnter += LabelColor_DragEnter;
|
||||
//
|
||||
// FormLinerConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(805, 261);
|
||||
Controls.Add(panelObject);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(groupBoxParameters);
|
||||
Name = "FormLinerConfig";
|
||||
Text = "FormLinerConfig";
|
||||
groupBoxParameters.ResumeLayout(false);
|
||||
groupBoxParameters.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownMaxPassengers).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).EndInit();
|
||||
panelObject.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxParameters;
|
||||
private Label labelWeight;
|
||||
private Label labelSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private NumericUpDown numericUpDownCapacity;
|
||||
private Label labelCapacity;
|
||||
private CheckBox checkBoxPool;
|
||||
private CheckBox checkBoxExtraDeck;
|
||||
private NumericUpDown numericUpDownMaxPassengers;
|
||||
private Label labelPassengers;
|
||||
private Label labelLinerType;
|
||||
private ComboBox comboBoxLinerType;
|
||||
private PictureBox pictureBoxLiner;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Label labelAdvancedObject;
|
||||
private Label labelBasicObject;
|
||||
private GroupBox groupBoxColors;
|
||||
private Panel panelPurple;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlack;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGray;
|
||||
private Panel panelGreen;
|
||||
private Panel panelWhite;
|
||||
private Panel panelRed;
|
||||
private Panel panelObject;
|
||||
private Label labelSecondaryColor;
|
||||
private Label labelPrimaryColor;
|
||||
}
|
||||
}
|
121
ProjectLiner/ProjectLiner/FormLinerConfig.cs
Normal file
121
ProjectLiner/ProjectLiner/FormLinerConfig.cs
Normal file
@ -0,0 +1,121 @@
|
||||
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 ProjectLiner.Drawnings;
|
||||
using ProjectLiner.Entities;
|
||||
|
||||
namespace ProjectLiner
|
||||
{
|
||||
public partial class FormLinerConfig : Form
|
||||
{
|
||||
private DrawingBaseLiner? _liner;
|
||||
private event LinerDelegate? _linerDelegate;
|
||||
public FormLinerConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SetLinerDelegate(LinerDelegate linerDelegate)
|
||||
{
|
||||
_linerDelegate += linerDelegate;
|
||||
}
|
||||
|
||||
private void DrawObject()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_liner?.SetPictureSize(pictureBoxLiner.Width,
|
||||
pictureBoxLiner.Height);
|
||||
_liner?.SetPosition(15, 15);
|
||||
_liner?.DrawTransport(gr);
|
||||
pictureBoxLiner.Image = bmp;
|
||||
}
|
||||
|
||||
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 "labelBasicObject":
|
||||
_liner = new DrawingBaseLiner((int)numericUpDownSpeed.Value,
|
||||
(double)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelAdvancedObject":
|
||||
_liner = new DrawingLiner((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
|
||||
Color.White, Color.Black, (Entities.LinerEntityType)comboBoxLinerType.SelectedIndex,
|
||||
(int)numericUpDownCapacity.Value, (int)numericUpDownMaxPassengers.Value,
|
||||
checkBoxExtraDeck.Checked, checkBoxPool.Checked);
|
||||
break;
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_liner != null)
|
||||
{
|
||||
_linerDelegate?.Invoke(_liner);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
private void Panel_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ?
|
||||
DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_liner == null || sender == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Label label = (Label)sender;
|
||||
Color color = (Color)e.Data?.GetData(typeof(Color));
|
||||
switch (label.Text)
|
||||
{
|
||||
case "Primary Color":
|
||||
_liner.BaseLiner?.SetPrimaryColor(color);
|
||||
break;
|
||||
case "Secondary Color":
|
||||
(_liner.BaseLiner as LinerEntity)?.SetColors(color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectLiner/ProjectLiner/FormLinerConfig.resx
Normal file
120
ProjectLiner/ProjectLiner/FormLinerConfig.resx
Normal 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>
|
@ -32,7 +32,6 @@
|
||||
panelCompanyTools = new Panel();
|
||||
buttonAddLiner = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonAddShip = new Button();
|
||||
buttonRefresh = new Button();
|
||||
buttonRemoveObject = new Button();
|
||||
buttonSu = new Button();
|
||||
@ -72,7 +71,6 @@
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonAddLiner);
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||
panelCompanyTools.Controls.Add(buttonAddShip);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Controls.Add(buttonRemoveObject);
|
||||
panelCompanyTools.Controls.Add(buttonSu);
|
||||
@ -101,16 +99,6 @@
|
||||
maskedTextBoxPosition.TabIndex = 2;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonAddShip
|
||||
//
|
||||
buttonAddShip.Location = new Point(3, 51);
|
||||
buttonAddShip.Name = "buttonAddShip";
|
||||
buttonAddShip.Size = new Size(188, 43);
|
||||
buttonAddShip.TabIndex = 1;
|
||||
buttonAddShip.Text = "Add Ship";
|
||||
buttonAddShip.UseVisualStyleBackColor = true;
|
||||
buttonAddShip.Click += ButtonAddShip_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(3, 208);
|
||||
@ -277,7 +265,6 @@
|
||||
private Button buttonRefresh;
|
||||
private Button buttonSu;
|
||||
private Button buttonRemoveObject;
|
||||
private Button buttonAddShip;
|
||||
private Button buttonAddLiner;
|
||||
private ComboBox comboBoxCompanySelector;
|
||||
private PictureBox pictureBox;
|
||||
|
@ -13,6 +13,7 @@ public partial class FormShipCollection : Form
|
||||
{
|
||||
InitializeComponent();
|
||||
_collectionStorage = new CollectionStorage<DrawingBaseLiner>();
|
||||
panelCompanyTools.Enabled = false;
|
||||
|
||||
}
|
||||
private void ComboBoxCompanySelector_SelectedIndexChanged(object sender,
|
||||
@ -20,34 +21,20 @@ public partial class FormShipCollection : Form
|
||||
{
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
private void ButtonAddLiner_Click(object sender, EventArgs e) =>
|
||||
CreateObject(nameof(DrawingBaseLiner));
|
||||
private void ButtonAddShip_Click(object sender, EventArgs e) =>
|
||||
CreateObject(nameof(DrawingLiner));
|
||||
private void CreateObject(string type)
|
||||
private void ButtonAddLiner_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormLinerConfig form = new();
|
||||
form.SetLinerDelegate(SetLiner);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void SetLiner(DrawingBaseLiner liner)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Random random = new();
|
||||
DrawingBaseLiner drawingLiner;
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawingBaseLiner):
|
||||
drawingLiner = new DrawingBaseLiner(random.Next(100, 300),
|
||||
random.Next(1000, 3000), GetColor(random));
|
||||
break;
|
||||
case nameof(DrawingLiner):
|
||||
drawingLiner = new DrawingLiner(random.Next(100, 300), random.Next(1000, 3000),
|
||||
GetColor(random), GetColor(random),
|
||||
LinerEntityType.Cargo, random.Next(1000, 10000), random.Next(10, 100),
|
||||
random.Next(0, 2) == 1, random.Next(0, 2) == 1);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (_company + drawingLiner)
|
||||
if (_company + liner)
|
||||
{
|
||||
MessageBox.Show("Object was added");
|
||||
pictureBox.Image = _company.Show();
|
||||
@ -57,17 +44,6 @@ public partial class FormShipCollection : Form
|
||||
MessageBox.Show("Couldn't add object");
|
||||
}
|
||||
}
|
||||
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 ButtonRemoveShip_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) ||
|
||||
|
5
ProjectLiner/ProjectLiner/LinerDelegate.cs
Normal file
5
ProjectLiner/ProjectLiner/LinerDelegate.cs
Normal file
@ -0,0 +1,5 @@
|
||||
using System;
|
||||
using ProjectLiner.Drawnings;
|
||||
namespace ProjectLiner;
|
||||
|
||||
public delegate void LinerDelegate(DrawingBaseLiner liner);
|
Loading…
x
Reference in New Issue
Block a user