EnvelopeGenerator/EnvelopeGenerator.Form/frmEnvelopeMainData.vb
2023-12-13 11:36:48 +01:00

69 lines
2.3 KiB
VB.net

Imports EnvelopeGenerator.Common
Imports EnvelopeGenerator.Common.My
Imports EnvelopeGenerator.Common.Constants
Public Class frmEnvelopeMainData
Public Property EnvelopeTitle As String
Public Property EnvelopeContractType As ContractType = ContractType.Contract
Public Property NewEnvelopeMode As Boolean = True
Public Property State As State
Public Sub New()
InitializeComponent()
End Sub
Private Sub frmEnvelopeMainData_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If NewEnvelopeMode = True Then
Me.Text = Resources.Envelope.New_Envelope
Else
Me.Text = Resources.Envelope.Edit_Envelope
cmbContractType.ReadOnly = True
End If
groupAllOptions.Expanded = False
Dim contractTypeList = [Enum].GetValues(GetType(ContractType)).Cast(Of ContractType)()
Dim oTranslatedList = contractTypeList.Select(AddressOf TranslateContractType).ToList()
cmbContractType.Properties.Items.AddRange(oTranslatedList)
txtTitle.EditValue = EnvelopeTitle
cmbContractType.EditValue = TranslateContractType(EnvelopeContractType)
End Sub
Private Function TranslateContractType(pType As ContractType) As String
Return Resources.Model.ResourceManager.GetString(pType.ToString())
End Function
Private Sub btOK_Click(sender As Object, e As EventArgs) Handles btOK.Click
Dim Validator As Validator = New Validator(State.LogConfig, AdornerUIManager1)
Dim oMissingParams = Validator.Validate(txtTitle)
If oMissingParams = True Then
Me.DialogResult = DialogResult.None
txtTitle.Focus()
Return
End If
EnvelopeTitle = txtTitle.EditValue
EnvelopeContractType = cmbContractType.SelectedIndex + 1
End Sub
Private Sub frmEnvelopeMainData_Shown(sender As Object, e As EventArgs) Handles Me.Shown
SetFormHeight()
End Sub
Private Sub SetFormHeight()
ClientSize = New Size(ClientSize.Width, LayoutControl1.Root.MinSize.Height)
End Sub
Private Sub LayoutControl1_GroupExpandChanged(sender As Object, e As DevExpress.XtraLayout.Utils.LayoutGroupEventArgs) Handles LayoutControl1.GroupExpandChanged
If e.Group.Name = groupAllOptions.Name Then
SetFormHeight()
End If
End Sub
End Class