Compare commits
No commits in common. "3d5e3f3cdc16d70bd49dad0a6ed8a8c9e50fd21e" and "0e0b3745215fe4a76d60eab942fa836f42a9a57b" have entirely different histories.
3d5e3f3cdc
...
0e0b374521
@ -48,7 +48,7 @@ namespace ProjectLiner.CollectionGenericObjects
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = collection;
|
||||
_collection.MaxCount = GetMaxCount;
|
||||
_collection.SetMaxCount = GetMaxCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -15,7 +15,7 @@
|
||||
/// <summary>
|
||||
/// Установка максимального количества элементов
|
||||
/// </summary>
|
||||
int MaxCount { get; set; }
|
||||
int SetMaxCount { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию
|
||||
@ -45,16 +45,5 @@
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>Объект</returns>
|
||||
T? Get(int position);
|
||||
|
||||
/// <summary>
|
||||
/// Получение типа коллекции
|
||||
/// </summary>
|
||||
CollectionType GetCollectionType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции по одному
|
||||
/// </summary>
|
||||
/// <returns>Поэлементый вывод элементов коллекции</returns>
|
||||
IEnumerable<T?> GetItems();
|
||||
}
|
||||
}
|
@ -16,24 +16,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
/// </summary>
|
||||
private int _maxCount;
|
||||
public int Count => _collection.Keys.Count;
|
||||
public int MaxCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _maxCount;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
_maxCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.List;
|
||||
|
||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -65,12 +48,4 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
_collection.Remove(position);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Count; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
@ -15,13 +15,8 @@ namespace ProjectLiner.CollectionGenericObjects
|
||||
|
||||
public int Count => _collection.Length;
|
||||
|
||||
public int MaxCount
|
||||
public int SetMaxCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _collection.Length;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
@ -38,8 +33,6 @@ namespace ProjectLiner.CollectionGenericObjects
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.Massive;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -112,13 +105,5 @@ namespace ProjectLiner.CollectionGenericObjects
|
||||
_collection[position] = null;
|
||||
return temp;
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Length; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +1,26 @@
|
||||
using ProjectLiner.CollectionGenericObjects;
|
||||
using ProjectLiner.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-хранилище коллекций
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class StorageCollection<T>
|
||||
where T : DrawningCommonLiner
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Словарь (хранилище) с коллекциями
|
||||
/// </summary>
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
/// <summary>
|
||||
/// Возвращение списка названий коллекций
|
||||
/// </summary>
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Ключевое слово, с которого должен начинаться файл
|
||||
/// </summary>
|
||||
private readonly string _collectionKey = "CollectionsStorage";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private readonly string _separatorForKeyValue = "|";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly string _separatorItems = ";";
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление коллекции в хранилище
|
||||
@ -84,125 +65,4 @@ public class StorageCollection<T>
|
||||
return _storages[name];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение информации по лайнерам в хранилище в файл
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
public bool SaveData(string filename)
|
||||
{
|
||||
if (_storages.Count == 0)
|
||||
return false;
|
||||
|
||||
if (File.Exists(filename))
|
||||
File.Delete(filename);
|
||||
|
||||
using FileStream fs = new(filename, FileMode.Create);
|
||||
using StreamWriter sw = new StreamWriter(fs);
|
||||
sw.Write(_collectionKey);
|
||||
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> value in _storages)
|
||||
{
|
||||
sw.Write(Environment.NewLine);
|
||||
if (value.Value.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sw.Write(value.Key);
|
||||
sw.Write(_separatorForKeyValue);
|
||||
sw.Write(value.Value.GetCollectionType);
|
||||
sw.Write(_separatorForKeyValue);
|
||||
sw.Write(value.Value.MaxCount);
|
||||
sw.Write(_separatorForKeyValue);
|
||||
|
||||
foreach (T? item in value.Value.GetItems())
|
||||
{
|
||||
string data = item?.GetDataForSave() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sw.Write(data);
|
||||
sw.Write(_separatorItems);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка информации по лайнерам в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public bool LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
using (FileStream fs = new(filename, FileMode.Open))
|
||||
{
|
||||
using StreamReader sr = new StreamReader(fs);
|
||||
|
||||
string str = sr.ReadLine();
|
||||
if (str == null || str.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!str.Equals(_collectionKey))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_storages.Clear();
|
||||
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string[] record = sr.ReadLine().Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
||||
if (collection == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
collection.MaxCount = Convert.ToInt32(record[2]);
|
||||
|
||||
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
if (elem?.CreateDrawningCommonLiner() is T commonLiner)
|
||||
{
|
||||
if (collection.Insert(commonLiner) == -1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_storages.Add(record[0], collection);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание коллекции по типу
|
||||
/// </summary>
|
||||
/// <param name="collectionType"></param>
|
||||
/// <returns></returns>
|
||||
private static ICollectionGenericObjects<T>? CreateCollection(CollectionType collectionType)
|
||||
{
|
||||
return collectionType switch
|
||||
{
|
||||
CollectionType.Massive => new MassiveGenericObjects<T>(),
|
||||
CollectionType.List => new ListGenericObjects<T>(),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
@ -98,17 +98,6 @@ public class DrawningCommonLiner
|
||||
_drawningLinerWidth = drawningLinerWight;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор для метода создания объекта из строки (ExtentionDrawningCommonLiner)
|
||||
/// </summary>
|
||||
/// <param name="CommonLiner"></param>
|
||||
public DrawningCommonLiner(EntityCommonLiner? CommonLiner) : this()
|
||||
{
|
||||
EntityCommonLiner = CommonLiner;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
/// </summary>
|
||||
|
@ -23,16 +23,6 @@ public class DrawningLiner : DrawningCommonLiner
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор для метода создания объекта из строки (ExtentionDrawningAirplane)
|
||||
/// </summary>
|
||||
/// <param name="airplane"></param>
|
||||
public DrawningLiner(EntityCommonLiner? liner) : base(liner)
|
||||
{
|
||||
if (liner != null)
|
||||
EntityCommonLiner = liner;
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityCommonLiner == null || EntityCommonLiner is not EntityLiner liner || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
|
@ -1,53 +0,0 @@
|
||||
using ProjectLiner.Entities;
|
||||
|
||||
namespace ProjectLiner.Drawnings;
|
||||
|
||||
public static class ExtentionDrawningLiner
|
||||
{
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly string _separatorForObject = ":";
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из строки
|
||||
/// </summary>
|
||||
/// <param name="info">Строка с данными для создания объекта</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawningCommonLiner? CreateDrawningCommonLiner(this string info)
|
||||
{
|
||||
string[] strs = info.Split(_separatorForObject);
|
||||
EntityCommonLiner? CommonLiner = EntityLiner.CreateEntityLiner(strs);
|
||||
|
||||
if (CommonLiner != null)
|
||||
{
|
||||
return new DrawningLiner(CommonLiner);
|
||||
}
|
||||
|
||||
CommonLiner = EntityCommonLiner.CreateEntityCommonLiner(strs);
|
||||
|
||||
if (CommonLiner != null)
|
||||
{
|
||||
return new DrawningCommonLiner(CommonLiner);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение данных для сохранения в файл
|
||||
/// </summary>
|
||||
/// <param name="drawningCommonLiner">Сохраняемый объект</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawningCommonLiner drawningCommonLiner)
|
||||
{
|
||||
string[]? array = drawningCommonLiner?.EntityCommonLiner?.GetStringRepresentation();
|
||||
|
||||
if (array == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Join(_separatorForObject, array);
|
||||
}
|
||||
}
|
@ -55,27 +55,5 @@ namespace ProjectLiner.Entities
|
||||
{
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение строк со значениями свойств объекта класса-сущности
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityCommonLiner), Speed.ToString(), Weight.ToString(), BodyColor.Name };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityCommonLiner? CreateEntityCommonLiner(string[] strs)
|
||||
{
|
||||
if (strs.Length != 4 || strs[0] != nameof(EntityCommonLiner))
|
||||
return null;
|
||||
|
||||
return new EntityCommonLiner(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectLiner.Entities;
|
||||
namespace ProjectLiner.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Лайнер"
|
||||
@ -53,29 +51,4 @@ public class EntityLiner: EntityCommonLiner
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Переопределение метода создания объекта из массива строк
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityLiner), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, Anchor.ToString(), Boats.ToString(), Pipe.ToString() };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityLiner? CreateEntityLiner(string[] strs)
|
||||
{
|
||||
if (strs.Length != 8 || strs[0] != nameof(EntityLiner))
|
||||
return null;
|
||||
|
||||
return new EntityLiner(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]),
|
||||
Color.FromName(strs[3]), Color.FromName(strs[4]),
|
||||
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7]));
|
||||
}
|
||||
|
||||
}
|
@ -46,17 +46,10 @@
|
||||
button5 = new Button();
|
||||
button3 = new Button();
|
||||
button4 = new Button();
|
||||
menuStrip = new MenuStrip();
|
||||
файлToolStripMenuItem = new ToolStripMenuItem();
|
||||
saveToolStripMenuItem = new ToolStripMenuItem();
|
||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
||||
openFileDialog = new OpenFileDialog();
|
||||
saveFileDialog = new SaveFileDialog();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
@ -65,9 +58,9 @@
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(1052, 49);
|
||||
groupBoxTools.Location = new Point(1052, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(272, 1014);
|
||||
groupBoxTools.Size = new Size(272, 1063);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
@ -190,9 +183,9 @@
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Bottom;
|
||||
pictureBox.Enabled = false;
|
||||
pictureBox.Location = new Point(0, 51);
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(1052, 1012);
|
||||
pictureBox.Size = new Size(1052, 1063);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
@ -204,10 +197,10 @@
|
||||
panelCompanyTools.Controls.Add(button5);
|
||||
panelCompanyTools.Controls.Add(button3);
|
||||
panelCompanyTools.Controls.Add(button4);
|
||||
panelCompanyTools.Location = new Point(1052, 592);
|
||||
panelCompanyTools.Location = new Point(1052, 567);
|
||||
panelCompanyTools.Margin = new Padding(5);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(272, 470);
|
||||
panelCompanyTools.Size = new Size(272, 495);
|
||||
panelCompanyTools.TabIndex = 9;
|
||||
//
|
||||
// buttonAddLiner
|
||||
@ -262,48 +255,6 @@
|
||||
button4.UseVisualStyleBackColor = true;
|
||||
button4.Click += ButtonGoToCheck_Click;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(26, 26);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(1324, 49);
|
||||
menuStrip.TabIndex = 10;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// файлToolStripMenuItem
|
||||
//
|
||||
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
||||
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
файлToolStripMenuItem.Size = new Size(104, 45);
|
||||
файлToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
saveToolStripMenuItem.Size = new Size(399, 50);
|
||||
saveToolStripMenuItem.Text = "Сохранение";
|
||||
saveToolStripMenuItem.Click += saveToolStripMenuItem_Click;
|
||||
//
|
||||
// loadToolStripMenuItem
|
||||
//
|
||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
|
||||
loadToolStripMenuItem.Size = new Size(399, 50);
|
||||
loadToolStripMenuItem.Text = "Загрузка";
|
||||
loadToolStripMenuItem.Click += loadToolStripMenuItem_Click;
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.FileName = "openFileDialog1";
|
||||
openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormLinerCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(17F, 41F);
|
||||
@ -312,8 +263,6 @@
|
||||
Controls.Add(panelCompanyTools);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormLinerCollection";
|
||||
Text = "Коллекция автомобилей";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
@ -322,10 +271,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -352,11 +298,5 @@
|
||||
private Button button3;
|
||||
private Button button4;
|
||||
private Button buttonAddLiner;
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem файлToolStripMenuItem;
|
||||
private ToolStripMenuItem saveToolStripMenuItem;
|
||||
private ToolStripMenuItem loadToolStripMenuItem;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
|
||||
using ProjectLiner.CollectionGenericObjects;
|
||||
using ProjectLiner.Drawnings;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectLiner;
|
||||
/// <summary>
|
||||
@ -223,45 +222,4 @@ public partial class FormLinerCollection : Form
|
||||
panelCompanyTools.Enabled = true;
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.SaveData(saveFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Загрузка"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,13 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>228, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>519, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,7 +1,6 @@
|
||||
|
||||
using ProjectLiner.Drawnings;
|
||||
using ProjectLiner.Entities;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
||||
|
||||
namespace ProjectLiner;
|
||||
|
Loading…
Reference in New Issue
Block a user