Daksoy FirmaDY, MessengerUsrCntl

This commit is contained in:
2026-03-27 10:19:12 +01:00
parent 9079a016e8
commit 42317c6776
12 changed files with 448 additions and 22 deletions

View File

@@ -24,7 +24,6 @@ Partial Class frmMessenger
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
@@ -39,12 +38,12 @@ Partial Class frmMessenger
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMessenger))
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
Me.Panel6 = New System.Windows.Forms.Panel()
Me.Label3 = New System.Windows.Forms.Label()
Me.lblLKWChat_MsgCntInaktiv = New System.Windows.Forms.Label()
Me.cbxInaktiveChats = New System.Windows.Forms.CheckBox()
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
Me.Panel5 = New System.Windows.Forms.Panel()
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
@@ -65,7 +64,7 @@ Partial Class frmMessenger
Me.btnNeu = New System.Windows.Forms.Button()
Me.Button1 = New System.Windows.Forms.Button()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel()
Me.UsrCntlMessenger_ChatElement1 = New VERAG_PROG_ALLGEMEIN.usrCntlMessenger_ChatElement()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.btnTeilnehmer = New System.Windows.Forms.Button()
@@ -93,9 +92,9 @@ Partial Class frmMessenger
Me.btnSendAtt = New System.Windows.Forms.Button()
Me.btnSenden = New System.Windows.Forms.Button()
Me.rtbChatMessage = New System.Windows.Forms.RichTextBox()
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer(Me.components)
Me.Timer_REFRESH = New System.Windows.Forms.Timer(Me.components)
Me.cntxt = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer()
Me.Timer_REFRESH = New System.Windows.Forms.Timer()
Me.cntxt = New System.Windows.Forms.ContextMenuStrip()
Me.ChatDeaktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.toolChatReminder = New System.Windows.Forms.ToolStripMenuItem()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()

View File

@@ -1449,4 +1449,8 @@ Public Class frmMessenger
Private Sub UsrCntlChat_Art_snd_Load(ctl As usrCntlChat_Art_Btn) Handles UsrCntlChat_Art_Btn_SNDCHAT.CLICKED
End Sub
Private Sub dgvChats_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvChats.CellContentClick
End Sub
End Class

View File

@@ -0,0 +1,101 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class usrCntlMessenger_ListNewChats
Inherits System.Windows.Forms.UserControl
'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle13 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle14 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle15 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle16 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer(Me.components)
CType(Me.dgvChats, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'dgvChats
'
Me.dgvChats.AKTUALISIERUNGS_INTERVALL = -1
Me.dgvChats.AllowUserToAddRows = False
Me.dgvChats.AllowUserToDeleteRows = False
Me.dgvChats.AllowUserToResizeColumns = False
Me.dgvChats.AllowUserToResizeRows = False
Me.dgvChats.BackgroundColor = System.Drawing.Color.White
DataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle13.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
DataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
Me.dgvChats.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle13
Me.dgvChats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvChats.ColumnHeadersVisible = False
DataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Window
DataGridViewCellStyle14.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
DataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.ControlText
DataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
Me.dgvChats.DefaultCellStyle = DataGridViewCellStyle14
Me.dgvChats.Dock = System.Windows.Forms.DockStyle.Fill
Me.dgvChats.Location = New System.Drawing.Point(0, 0)
Me.dgvChats.Name = "dgvChats"
Me.dgvChats.ReadOnly = True
DataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle15.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
DataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
Me.dgvChats.RowHeadersDefaultCellStyle = DataGridViewCellStyle15
Me.dgvChats.RowHeadersVisible = False
Me.dgvChats.RowHeadersWidth = 62
DataGridViewCellStyle16.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.dgvChats.RowsDefaultCellStyle = DataGridViewCellStyle16
Me.dgvChats.RowTemplate.Height = 30
Me.dgvChats.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgvChats.Size = New System.Drawing.Size(307, 374)
Me.dgvChats.TabIndex = 1
'
'TimerNEW_MESSAGE
'
Me.TimerNEW_MESSAGE.Enabled = True
Me.TimerNEW_MESSAGE.Interval = 5000
'
'usrCntlMessenger_ListNewChats
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.dgvChats)
Me.Name = "usrCntlMessenger_ListNewChats"
Me.Size = New System.Drawing.Size(307, 374)
CType(Me.dgvChats, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents dgvChats As MyDatagridview
Friend WithEvents TimerNEW_MESSAGE As Windows.Forms.Timer
End Class

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="TimerNEW_MESSAGE.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,167 @@
Imports System.Drawing
Imports System.Windows.Forms
Imports com.sun.xml.internal.ws.resources
Public Class usrCntlMessenger_ListNewChats
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Sub intiDGVChats(Optional dgv_ChatID = -1, Optional reloadChat = True, Optional selFirst = False)
With dgvChats
'Dim loadedTmp = loaded
'If Not reloadChat Then
' loaded = False
'End If
Dim whereName = ""
'If MyTextBox1.Text.Trim <> String.Empty Then
' whereName = " WHERE y.chat_name LIKE '%" & MyTextBox1.Text.Trim & "%' "
'End If
Dim where = ""
'Select Case toggle_CHAT_ART
' Case "CHAT"
' where = " AND chat_art IN ('CHAT') "
' 'Case "LKW_CHAT"
' ' where = " AND chat_art IN ('LKW_CHAT') "
' Case Else
' where = " AND chat_art IN ('" & toggle_CHAT_ART & "') "
'End Select
Dim sqlQery_optimiced As String = " SELECT * FROM (SELECT TOP 200
c.chat_id,
c.chat_art,
CASE
WHEN ISNULL(c.chat_name, '') <> '' THEN c.chat_name
ELSE names.chat_name
END AS chat_name,
ISNULL(unread.ungelesen, 0) AS ungelesen,
c.chat_lastMsg
FROM tblMessenger_Chat c
-- ensure current user is member
INNER JOIN tblMessenger_ChatMembers m
ON m.chatMb_chatId = c.chat_id
AND m.chatMb_maId = " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRID & "
-- 🔹 get participant names (distinct!)
OUTER APPLY (
SELECT STRING_AGG(name, ', ') AS chat_name
FROM (
SELECT DISTINCT
mit.mit_vname + ' ' + mit.mit_nname AS name
FROM tblMessenger_ChatMembers m2
INNER JOIN tblMitarbeiter mit
ON mit.mit_id = m2.chatMb_maId
WHERE m2.chatMb_chatId = c.chat_id
AND m2.chatMb_maId <> " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRID & "
) x
) names
-- 🔹 unread count separated (no duplication!)
OUTER APPLY (
SELECT COUNT(*) AS ungelesen
FROM tblMessenger_ChatMessages msg
INNER JOIN tblMessenger_ChatMessageStatus s
ON s.chatMgSt_chatMsgId = msg.chatMg_id
WHERE msg.chatMg_chatId = c.chat_id
AND s.chatMgSt_MaId = " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRID & "
AND s.chatMgSt_gelesen = 0
) unread WHERE c.chat_aktiv = 1
AND ISNULL(unread.ungelesen, 0) > 0
" & where & " ORDER BY c.chat_lastMsg DESC) y " & whereName
.DataSource = SQL.loadDgvBySql(sqlQery_optimiced, "ADMIN")
If .Columns.Count = 0 Then Exit Sub
.Columns("chat_id").Visible = False
.Columns("chat_lastMsg").Visible = False
.Columns("chat_name").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("chat_art").HeaderText = "ART"
.Columns("ungelesen").Width = 30
.Columns("ungelesen").HeaderText = "neu"
.Columns("ungelesen").DefaultCellStyle.ForeColor = Color.White
.Columns("ungelesen").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
.Columns("ungelesen").DefaultCellStyle.Font = New Font(.Font.FontFamily, 7, FontStyle.Bold)
dgvChats.GetOrder()
If selFirst Then
'dgvChats.ClearSelection()
'SplitContainer1.Enabled = False
'If .Rows.Count > 0 Then
' loaded = True
' SplitContainer1.Enabled = True
' .Rows(0).Selected = True
'End If
'loaded = loadedTmp
Else
dgvChats.ClearSelection()
'If dgv_ChatID > 0 Then
' For Each r As DataGridViewRow In .Rows
' If r.Cells("chat_id").Value = dgv_ChatID Then
' dgvChats.ClearSelection()
' r.Selected = True : Exit For
' End If
' Next
'End If
'loaded = loadedTmp
End If
dgvChats.SetOrder()
If dgvChats.SelectedRows.Count > 0 Then dgvChats.FirstDisplayedCell = dgvChats.SelectedRows(0).Cells("chat_name")
'dgvChats.ClearSelection()
'SplitContainer1.Enabled = False
'If dgv_ChatID > 0 Then
' For Each r As DataGridViewRow In .Rows
' If r.Cells("chat_id").Value = dgv_ChatID Then
' dgvChats.ClearSelection()
' SplitContainer1.Enabled = True
' r.Selected = True : Exit For
' End If
' Next
'End If
End With
' If Not selFirst Then rtbChatMessage.Focus()
End Sub
Private Sub usrCntlMessenger_ListNewChats_Load(sender As Object, e As EventArgs) Handles Me.Load
intiDGVChats()
TimerNEW_MESSAGE.Enabled = True
End Sub
Private Sub TimerNEW_MESSAGE_Tick(sender As Object, e As EventArgs) Handles TimerNEW_MESSAGE.Tick
intiDGVChats()
End Sub
Private Sub MyDatagridview1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvChats.CellDoubleClick '.CellContentClick
For Each openForm In Application.OpenForms()
If TypeOf (openForm) Is VERAG_PROG_ALLGEMEIN.frmMessenger Then
CType(openForm, VERAG_PROG_ALLGEMEIN.frmMessenger).WindowState = FormWindowState.Normal
CType(openForm, VERAG_PROG_ALLGEMEIN.frmMessenger).BringToFront()
Exit Sub
End If
Next
Dim f As New VERAG_PROG_ALLGEMEIN.frmMessenger()
f.Location = Cursor.Position
f.Show()
End Sub
End Class