Remove Chat Controls, use only DevExpress controls in frmValidator

This commit is contained in:
Jonathan Jenne
2023-05-31 11:10:25 +02:00
parent 9da71349b2
commit 91e90ce76c
13 changed files with 343 additions and 1026 deletions

View File

@@ -349,72 +349,6 @@ Public Class frmValidator
'oErrMsgMissingInput = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.MissingInput")
oErrMsgMissingInput = S.Bitte_validieren_Sie_die_rot_markierten_Felder_
RibbonPageConversations.Visible = False
If IDB_ACTIVE Then
Dim oSQL = $"SELECT * FROM [dbo].[FNIDB_OBJECT_DYNAMIC_CONFIG] ({CURRENT_DOC_ID},{USER_ID})"
DTDYNAMIC_RIGHTS = DatabaseFallback.GetDatatableIDB(oSQL) ', CONNECTION_STRING_IDB, "FNIDB_OBJECT_DYNAMIC_CONFIG")
RibbonPageGroupConv1.Enabled = False
Dim oView As DataView = New DataView(DTDYNAMIC_RIGHTS)
oView.RowFilter = "CONF_TITLE like '%CONVERSATION_RIGHT%'"
Console.WriteLine(oView.Count, "oView after")
If oView.Count > 0 Then
LOGGER.Debug("CONVERSATION-RIGHTS EXISTING")
RibbonPageConversations.Visible = True
RibbonPageGroupConv1.Enabled = True
'ConversationQUDT_Delete = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.Conversation_Delete")
ConversationQUDT_Delete = Nothing
oView = New DataView(DTDYNAMIC_RIGHTS)
oView.RowFilter = "CONF_TITLE = 'CONVERSATION_USER_ACTIVE'"
Conversation_initialized = Conversation_init()
If oView.Count = 1 Then
Conversation_User_Active = True
Else
SplitContainer2_DV_Chat.Collapsed = True
Conversation_User_Active = False
SplitContainer2_DV_Chat.Panel2.Visible = False
End If
Else
SplitContainer2_DV_Chat.Collapsed = True
RibbonPageConversations.Visible = False
End If
'If Not IsNothing(DTConversations) Then
' If DTConversations.Rows.Count >= 1 Then
' SplitContainerMain.Collapsed = False
' Dim oConversations As List(Of String)
' oConversations = ChatControl1.GetConversations(CURRENT_DOC_ID)
' If oConversations.Count > 1 Then
' RibbonPageGroupConv_Change.Visible = True
' For Each oit As String In oConversations
' ' Dim Coll As ComboBoxItemCollection = RepositoryItemComboBox3.Properties.Items
' BarEditItem2..Items.Add(oit)
' Next
' Else
' RibbonPageGroupConv_Change.Visible = False
' End If
' Else
' End If
'Else
' SplitContainerMain.Collapsed = True
'End If
Else
SplitContainer2_DV_Chat.Collapsed = True
End If
LOGGER.Debug("frmValidation_Load finished!")
@@ -426,68 +360,8 @@ Public Class frmValidator
End Try
End Sub
Sub Conversations_Init_Rights()
RibbonPageConversations.Visible = True
bbtnitem_ConversationNew.Visibility = BarItemVisibility.Never
btnitemConversationEnd.Visibility = BarItemVisibility.Never
btnitemConversationEnd.Enabled = True
btnitemConversation_reload.Enabled = True
For Each oRow As DataRow In DTDYNAMIC_RIGHTS.Rows
If oRow.Item("CONF_TITLE").ToString = "CONVERSATION_RIGHT" Then
Select Case oRow.Item("CONF_VALUE")
Case "Admin"
bbtnitem_ConversationNew.Visibility = BarItemVisibility.Always
btnitemConversationEnd.Visibility = BarItemVisibility.Always
Right_Conversation_Add = True
Right_Conversation_Stop = True
Case "Start"
bbtnitem_ConversationNew.Visibility = BarItemVisibility.Always
Right_Conversation_Add = True
Case "Stop"
btnitemConversationEnd.Visibility = BarItemVisibility.Always
Right_Conversation_Stop = True
Case "AddMessage"
Right_Conversation_Message = True
End Select
'ElseIf oRow.Item("CONF_TITLE").ToString = "CONVERSATION_USER_ACTIVE" Then
' Conversation_User_Active = True
End If
Next
End Sub
Sub Conversations_load()
Dim oConversations As List(Of String)
oConversations = ChatControl1.GetConversations(CURRENT_DOC_ID)
RibbonPageGroupConv_Change.Visible = True
If oConversations.Count = 0 Then
RibbonPageGroupConv_Change.Visible = False
End If
RepositoryItemComboBox3.Items.Clear()
Dim oActiveConv As Boolean = False
RibbonPageGroupConv_Change.Visible = True
For Each oconv As String In oConversations
If Not oconv.Contains("Started") Then
RepositoryItemComboBox3.Items.Add(oconv)
End If
If oconv.Contains("Started") Then
oActiveConv = True
End If
Next
If oActiveConv = False Then
btnitemConversationEnd.Enabled = False
btnitemConversation_reload.Enabled = False
SplitContainer2_DV_Chat.Collapsed = True
Else
If SplitContainer2_DV_Chat.Panel2.Visible = False Then
SplitContainer2_DV_Chat.Panel2.Visible = True
End If
SplitContainer2_DV_Chat.Collapsed = False
End If
End Sub
Private Sub frmValidation_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Try
me_closing = True
@@ -1178,18 +1052,18 @@ Public Class frmValidator
Sub Clear_all_Input()
For Each inctrl As Control In Me.PanelValidatorControl.Controls
Dim Type As String = inctrl.GetType.ToString
Select Case Type
Case "DevExpress.XtraEditors.TextEdit"
Select Case inctrl.GetType
Case GetType(DevExpress.XtraEditors.TextEdit)
inctrl.Text = ""
Case "System.Windows.Forms.ComboBox"
Case GetType(System.Windows.Forms.ComboBox)
Dim cmb As ComboBox = inctrl
cmb.SelectedIndex = -1
Case "System.Windows.Forms.DataGridView"
Case GetType(System.Windows.Forms.DataGridView)
Dim dgv As DataGridView = inctrl
If dgv.Rows.Count > 0 Then
dgv.Rows.Clear()
End If
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
End Select
Next
@@ -3130,7 +3004,6 @@ Public Class frmValidator
Select form
Where form.Item("GUID") = oControlId).Single()
Dim oType As String = oControl.GetType.ToString
Dim oTyp As String = oControlRow.Item("CTRL_TYPE")
Dim oIDBTyp As String
If IDB_ACTIVE Then
@@ -3145,8 +3018,8 @@ Public Class frmValidator
Dim oLoadIndex As Boolean = oControlRow.Item("LOAD_IDX_VALUE")
LOGGER.Debug("INDEX: " & oSourceIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString)
Select Case oType
Case "DevExpress.XtraEditors.TextEdit"
Select Case oControl.GetType()
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
oControlType = "Textbox"
Dim oTextBox As TextEdit = oControl
@@ -3252,7 +3125,7 @@ Public Class frmValidator
Exit Sub
End Try
Case "System.Windows.Forms.ComboBox"
Case GetType(System.Windows.Forms.ComboBox)
oControlType = "ComboBox"
Dim oMyCombobox As Windows.Forms.ComboBox = oControl
Try
@@ -3333,7 +3206,7 @@ Public Class frmValidator
End Try
Case "DevExpress.XtraGrid.GridControl"
Case GetType(DevExpress.XtraGrid.GridControl)
oControlType = "DevExpress.XtraGrid.GridControl"
Dim oMyGridControl As GridControl = oControl
Dim oDTColumnsPerDevExGrid As DataTable = DT_COLUMNS_GRID.Clone()
@@ -3533,7 +3406,7 @@ Public Class frmValidator
LOGGER.Error(ex)
End Try
End If
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
LOGGER.Debug("Loading checkbox...")
oControlType = "CheckBox"
If oSourceIndexName = "" Then
@@ -3637,7 +3510,7 @@ Public Class frmValidator
End If
End If
Case "DigitalData.Controls.LookupGrid.LookupControl3"
Case GetType(DigitalData.Controls.LookupGrid.LookupControl3)
Try
Dim oLookup As LookupControl3 = oControl
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
@@ -3686,7 +3559,7 @@ Public Class frmValidator
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Add LookupControl3:")
End Try
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
oControlType = "DateTimePicker"
Dim DTP As DateTimePicker = oControl
If oSourceIndexName = "" Then
@@ -3950,7 +3823,7 @@ Public Class frmValidator
LOGGER.Debug("frmValidation_Shown finished!")
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Private Sub btnSave_Click(sender As Object, e As EventArgs)
btnSave.Enabled = False
' TODO: Use when working on Validation
@@ -4298,9 +4171,8 @@ Public Class frmValidator
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
'######
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "DevExpress.XtraEditors.TextEdit"
Select Case oControl.GetType
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
value_from_control = oControl.Text
Catch ex As Exception
@@ -4308,7 +4180,7 @@ Public Class frmValidator
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.ComboBox"
Case GetType(System.Windows.Forms.ComboBox)
Dim cmb As ComboBox = oControl
Try
value_from_control = cmb.Text
@@ -4316,7 +4188,7 @@ Public Class frmValidator
LOGGER.Error(ex)
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
Dim dtp As DateTimePicker = oControl
Try
value_from_control = dtp.Value.ToString
@@ -4325,7 +4197,7 @@ Public Class frmValidator
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
Dim chk As CheckBox = oControl
Try
value_from_control = chk.Checked
@@ -4595,9 +4467,8 @@ Public Class frmValidator
LOGGER.Info(" >> Indexname is unexpected empty.")
Continue For
End If
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "DigitalData.Controls.LookupGrid.LookupControl3"
Select Case oControl.GetType
Case GetType(DigitalData.Controls.LookupGrid.LookupControl3)
Try
Dim lookup As LookupControl3 = oControl
If lookup.Properties.SelectedValues.Count = 0 And oIsRequired = True Then
@@ -4782,7 +4653,7 @@ Public Class frmValidator
End Try
Case "DevExpress.XtraEditors.TextEdit"
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
'Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl")
Dim oWrongInputMessage = S.Falsche_Eingabe
@@ -4904,7 +4775,7 @@ Public Class frmValidator
Return False
End Try
Case "System.Windows.Forms.ComboBox"
Case GetType(System.Windows.Forms.ComboBox)
Try
LOGGER.Debug($"Working on Combobox...")
Dim cmb As Windows.Forms.ComboBox = oControl
@@ -5021,7 +4892,7 @@ Public Class frmValidator
Return False
End Try
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
Try
Dim dtp As DateTimePicker = oControl
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
@@ -5095,7 +4966,7 @@ Public Class frmValidator
LOGGER.Error(ex)
End Try
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
Try
Dim chk As CheckBox = oControl
oMyInput = chk.Checked.ToString
@@ -5191,7 +5062,7 @@ Public Class frmValidator
LOGGER.Error(ex)
End Try
Case "System.Windows.Forms.DataGridView"
Case GetType(System.Windows.Forms.DataGridView)
Try
Dim dgv As DataGridView = oControl
@@ -5272,11 +5143,11 @@ Public Class frmValidator
LOGGER.Error(ex)
End Try
Case "DevExpress.XtraGrid.GridControl"
Case GetType(DevExpress.XtraGrid.GridControl)
Dim oGrid As GridControl = oControl
Dim oSettings = New ControlSettings() With {
.IndexName = oIndexName,
.ControlType = Type,
.ControlType = GetType(DevExpress.XtraGrid.GridControl).ToString,
.Name = oControlName,
.IsRequired = oIsRequired,
.IDBAttributeType = oIDBTyp
@@ -5756,7 +5627,7 @@ Public Class frmValidator
End If
My.Settings.Save()
End Sub
Private Sub btnSave_MouseHover(sender As Object, e As EventArgs) Handles btnSave.MouseHover
Private Sub btnSave_MouseHover(sender As Object, e As EventArgs)
'Dim oMsg = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("F2forSave")
ToolTip1.Show(S.F2_für_Speichern, btnSave)
End Sub
@@ -5772,8 +5643,10 @@ Public Class frmValidator
bsiInformation.Caption = infotext & " " & Now.ToString
If pColor <> String.Empty Then
bsiInformation.ItemAppearance.Normal.BackColor = Color.FromName(pColor)
bsiInformation.ItemAppearance.Normal.ForeColor = GraphicsEx.GetContrastedColor(Color.FromName(pColor))
Else
bsiInformation.ItemAppearance.Normal.BackColor = Color.Transparent
bsiInformation.ItemAppearance.Normal.ForeColor = Color.Black
End If
End Sub
@@ -5907,102 +5780,6 @@ Public Class frmValidator
Dim Filename As String = String.Format($"DevExpressValidatorGridControl_{pProfilID}-{pControlID}.xml")
Return System.IO.Path.Combine(CONFIG.UserConfigPath.Replace("UserConfig.xml", ""), Filename)
End Function
Private Function Conversation_init()
Try
Dim oResult = ChatControl1.Init(LOGCONFIG, CONNECTION_STRING_IDB, IIf(CONV_IDENTIFICATION = "Email", USER_EMAIL, USER_USERNAME), USER_ID, USER_USERNAME, USER_LANGUAGE, ConversationQUDT_Delete, DTDYNAMIC_RIGHTS)
If oResult = True Then
Conversations_Init_Rights()
Conversations_load()
AddHandler ChatControl1.Conversation_Ended, AddressOf onConversationEnded
AddHandler ChatControl1.Conversation_UsersAdded_Success, AddressOf ConversationUsersAdded
End If
Return oResult
Catch ex As Exception
Return False
End Try
End Function
Private Sub bbtnitem_ConversationNew_ItemClick(sender As Object, e As ItemClickEventArgs) Handles bbtnitem_ConversationNew.ItemClick
Dim oDTUSER As DataTable
For Each oRow As DataRow In DTDYNAMIC_RIGHTS.Rows
If oRow.Item("CONF_TITLE") = "NEW_CONVERSATION_USER_SELECT" Then
Dim oSQL = oRow.Item("CONF_VALUE")
oDTUSER = DatabaseFallback.GetDatatableIDB(oSQL)
End If
Next
If Not IsNothing(oDTUSER) Then
CURRENT_CONVERSATION_NEW = 0
Dim oForm As New frmChat_NewConversation(oDTUSER, Nothing)
Dim oResult = oForm.ShowDialog()
If CURRENT_CONVERSATION_NEW <> 0 Then
If Not Conversation_initialized Then
Conversation_init()
End If
Conversations_Init_Rights()
Conversations_load()
End If
End If
End Sub
Private Sub bbtnitem_ConversationEnd_ItemClick(sender As Object, e As ItemClickEventArgs) Handles btnitemConversationEnd.ItemClick
If ChatControl1.CurrentConversationID <> 0 Then
Dim result As MsgBoxResult
result = MessageBox.Show(S.Wollen_Sie_die_Konversation_beenden_, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If result = MsgBoxResult.Yes Then
Dim oSQL = $"EXEC PRIDB_END_CONVERSATION {ChatControl1.CurrentConversationID}, '{USER_USERNAME}', '{USER_LANGUAGE}'"
If DatabaseFallback.ExecuteNonQueryIDB(oSQL) = True Then
btnitemConversationEnd.Enabled = False
SplitContainer2_DV_Chat.Collapsed = True
btnitemConversationEnd.Enabled = True
Else
MsgBox("Unexpected error in PRIDB_END_CONVERSATION - Check Your log!", MsgBoxStyle.Exclamation)
End If
End If
End If
End Sub
Private Sub BarEditItem3_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarEditItem3.ItemClick
Dim o = BarEditItem3.EditValue
End Sub
Private Sub RepositoryItemComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RepositoryItemComboBox3.SelectedIndexChanged
Try
Dim cBox As DevExpress.XtraEditors.ComboBoxEdit = sender
Dim item = cBox.EditValue
Dim oSplit() = item.ToString.Split("|")
Dim oConvID = oSplit(0)
ChatControl1.LoadConversation(oConvID)
btnitemConversationEnd.Enabled = False
If SplitContainer2_DV_Chat.IsPanelCollapsed Then
SplitContainer2_DV_Chat.Collapsed = False
If SplitContainer2_DV_Chat.Panel2.Visible = False Then
SplitContainer2_DV_Chat.Panel2.Visible = True
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
End Try
End Sub
Private Sub BarButtonItem5_ItemClick(sender As Object, e As ItemClickEventArgs) Handles btnitemConversation_reload.ItemClick
Conversations_Init_Rights()
Conversations_load()
End Sub
Sub onConversationEnded()
Conversations_load()
btnitemConversationEnd.Enabled = False
SplitContainer2_DV_Chat.Collapsed = True
btnitemConversation_reload.Enabled = False
End Sub
Sub ConversationUsersAdded()
Conversations_load()
End Sub
Private Sub BarButtonItem5_ItemClick_1(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem5.ItemClick
MsgBox("Versioning not configured! (Reasons: RightManagement, Displaying)", MsgBoxStyle.Information)