2024-10-08 11:44:50 +03:00
|
|
|
|
using GtaVUsersInfo.Controls;
|
|
|
|
|
using GtaVUsersInfo.Helpers;
|
2024-10-10 12:30:53 +03:00
|
|
|
|
using GtaVUsersInfo.Sources;
|
2024-10-08 11:44:50 +03:00
|
|
|
|
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 GtaVUsersInfo.Forms
|
|
|
|
|
{
|
|
|
|
|
public partial class AddParameter : Form
|
|
|
|
|
{
|
2024-10-08 18:33:19 +03:00
|
|
|
|
List<ParameterControl> listControls;
|
2024-10-08 11:44:50 +03:00
|
|
|
|
ParameterControl parameter;
|
|
|
|
|
|
2024-10-08 18:33:19 +03:00
|
|
|
|
public AddParameter(List<ParameterControl> listControls, ParameterControl parameter)
|
2024-10-08 11:44:50 +03:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this.listControls = listControls;
|
|
|
|
|
this.parameter = parameter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(nameTextBox.Text))
|
|
|
|
|
{
|
|
|
|
|
ErrorsShow.ShowErrorMessage($"Вы не ввели ни одни символ!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Control foundParam = listControls.FirstOrDefault(p => (p as ParameterControl).ParamName == nameTextBox.Text);
|
|
|
|
|
if (foundParam == null)
|
|
|
|
|
{
|
|
|
|
|
parameter.ParamName = nameTextBox.Text;
|
|
|
|
|
this.Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new Exception("Такой параметр уже есть!");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorsShow.ShowErrorMessage($"Произошла неожиданная ошибка: {ex.Message}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-10 12:30:53 +03:00
|
|
|
|
|
|
|
|
|
public void ChangeFonts(FontSettings settings)
|
|
|
|
|
{
|
|
|
|
|
FontSettings.ChangeFontInControls(this, settings);
|
|
|
|
|
this.Size = new Size(this.nameLabel.Width, this.Size.Height);
|
|
|
|
|
}
|
2024-10-08 11:44:50 +03:00
|
|
|
|
}
|
|
|
|
|
}
|