2021-03-28 19:15:55 +04:00
|
|
|
|
using ModuleTools.Enums;
|
2021-03-27 23:50:29 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace DesktopTools.Controls
|
|
|
|
|
{
|
2021-03-30 22:34:31 +04:00
|
|
|
|
public abstract partial class AbstractControlViewEntityList : UserControl
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Событие, вызываемое при закрытии контрола
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected event Action<Guid> CloseEvent;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Событие, вызываемое при закрытии контрола
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event Action<Guid> CloseEventAdd { add { CloseEvent += value; } remove { CloseEvent -= value; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Открытие формы
|
|
|
|
|
/// </summary>
|
2021-03-30 22:34:31 +04:00
|
|
|
|
public abstract void Open();
|
2021-03-27 23:50:29 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Закрытие формы
|
|
|
|
|
/// </summary>
|
2021-03-30 22:34:31 +04:00
|
|
|
|
public void Close()
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
2021-03-29 23:16:11 +04:00
|
|
|
|
CloseEvent?.Invoke(ControlId);
|
2021-03-30 22:34:31 +04:00
|
|
|
|
if (FormForSelected != null)
|
|
|
|
|
{
|
|
|
|
|
FormForSelected.DialogResult = DialogResult.Cancel;
|
|
|
|
|
FormForSelected.Close();
|
|
|
|
|
}
|
2021-03-27 23:50:29 +04:00
|
|
|
|
Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Дубликат контрола
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2021-03-30 22:34:31 +04:00
|
|
|
|
public abstract AbstractControlViewEntityList Clone();
|
2021-03-27 23:50:29 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Идентификатор контрола
|
|
|
|
|
/// </summary>
|
2021-03-29 23:16:11 +04:00
|
|
|
|
public Guid ControlId { get; protected set; }
|
2021-03-27 23:50:29 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Заголовок контрола
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Title { get; protected set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Порядок контрола в меню
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Order { get; protected set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Операция в системе
|
|
|
|
|
/// </summary>
|
|
|
|
|
public AccessOperation AccessOperation { get; protected set; }
|
|
|
|
|
|
2021-03-30 22:34:31 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Идентификатор выбранной записи
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Guid? SelectedId { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Название выбранной записи
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string SelectedText { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ссылка на форму, в который открыевается контрол для выбора значения
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Form FormForSelected { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение названиия объекта по его идентификатору
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
public abstract string GetTitleFromId(Guid id);
|
2021-03-27 23:50:29 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Констркутор
|
|
|
|
|
/// </summary>
|
2021-03-30 22:34:31 +04:00
|
|
|
|
public AbstractControlViewEntityList()
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|