ChatControl + Test
This commit is contained in:
parent
79736df064
commit
068f660451
@ -134,6 +134,10 @@
|
||||
<Project>{1f278760-4f6b-42e8-b82d-01d4c8618340}</Project>
|
||||
<Name>ChatControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@ -1,3 +1,11 @@
|
||||
Public Class Form1
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Form1
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath)
|
||||
Dim oConnectionString = "Server=sDD-VMP04-SQL17\DD_DEVELOP01;Database=IDB_TEST;User Id=sa;Password=dd;"
|
||||
|
||||
ChatControl1.Init(oLogConfig, oConnectionString, "JenneJ")
|
||||
ChatControl1.LoadConversations(10070)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
66
Controls.ChatControl/ChatControl.Designer.vb
generated
66
Controls.ChatControl/ChatControl.Designer.vb
generated
@ -43,39 +43,50 @@ Partial Class ChatControl
|
||||
Dim TableColumnDefinition12 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition()
|
||||
Dim TableRowDefinition11 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim TableRowDefinition12 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim EditorButtonImageOptions2 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
|
||||
Dim SerializableAppearanceObject5 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
|
||||
Dim SerializableAppearanceObject6 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
|
||||
Dim SerializableAppearanceObject7 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
|
||||
Dim SerializableAppearanceObject8 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ChatControl))
|
||||
Me.columnUsername = New DevExpress.XtraGrid.Columns.TileViewColumn()
|
||||
Me.columnMessage = New DevExpress.XtraGrid.Columns.TileViewColumn()
|
||||
Me.columnDate = New DevExpress.XtraGrid.Columns.TileViewColumn()
|
||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.GridChat = New DevExpress.XtraGrid.GridControl()
|
||||
Me.ChatView = New DevExpress.XtraGrid.Views.Tile.TileView()
|
||||
Me.lookupConversations = New DigitalData.Controls.LookupGrid.LookupControl2()
|
||||
Me.LookupControl21View = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
Me.txtMessage = New DevExpress.XtraEditors.MemoEdit()
|
||||
Me.btnSendMessage = New DevExpress.XtraEditors.SimpleButton()
|
||||
Me.ChatSource = New System.Windows.Forms.BindingSource(Me.components)
|
||||
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainerControl1.SuspendLayout()
|
||||
CType(Me.GridChat, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.ChatView, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.lookupConversations.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.txtMessage.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.ChatSource, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'columnUsername
|
||||
'
|
||||
Me.columnUsername.FieldName = "USERNAME"
|
||||
Me.columnUsername.FieldName = "USER_FROM"
|
||||
Me.columnUsername.Name = "columnUsername"
|
||||
Me.columnUsername.Visible = True
|
||||
Me.columnUsername.VisibleIndex = 1
|
||||
'
|
||||
'columnMessage
|
||||
'
|
||||
Me.columnMessage.FieldName = "MESSAGE"
|
||||
Me.columnMessage.FieldName = "MESSAGE_TEXT"
|
||||
Me.columnMessage.Name = "columnMessage"
|
||||
Me.columnMessage.Visible = True
|
||||
Me.columnMessage.VisibleIndex = 0
|
||||
'
|
||||
'columnDate
|
||||
'
|
||||
Me.columnDate.FieldName = "DATE"
|
||||
Me.columnDate.FieldName = "ADDED_WHEN"
|
||||
Me.columnDate.Name = "columnDate"
|
||||
Me.columnDate.Visible = True
|
||||
Me.columnDate.VisibleIndex = 2
|
||||
@ -89,8 +100,10 @@ Partial Class ChatControl
|
||||
Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.SplitContainerControl1.Name = "SplitContainerControl1"
|
||||
Me.SplitContainerControl1.Panel1.Controls.Add(Me.GridChat)
|
||||
Me.SplitContainerControl1.Panel1.Controls.Add(Me.lookupConversations)
|
||||
Me.SplitContainerControl1.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl1.Panel2.Controls.Add(Me.txtMessage)
|
||||
Me.SplitContainerControl1.Panel2.Controls.Add(Me.btnSendMessage)
|
||||
Me.SplitContainerControl1.Panel2.Text = "Panel2"
|
||||
Me.SplitContainerControl1.Size = New System.Drawing.Size(317, 314)
|
||||
Me.SplitContainerControl1.SplitterPosition = 50
|
||||
@ -100,10 +113,10 @@ Partial Class ChatControl
|
||||
'
|
||||
Me.GridChat.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.GridChat.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||
Me.GridChat.Location = New System.Drawing.Point(0, 0)
|
||||
Me.GridChat.Location = New System.Drawing.Point(0, 20)
|
||||
Me.GridChat.MainView = Me.ChatView
|
||||
Me.GridChat.Name = "GridChat"
|
||||
Me.GridChat.Size = New System.Drawing.Size(317, 254)
|
||||
Me.GridChat.Size = New System.Drawing.Size(317, 234)
|
||||
Me.GridChat.TabIndex = 0
|
||||
Me.GridChat.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ChatView})
|
||||
'
|
||||
@ -120,7 +133,7 @@ Partial Class ChatControl
|
||||
Me.ChatView.OptionsTiles.LayoutMode = DevExpress.XtraGrid.Views.Tile.TileViewLayoutMode.List
|
||||
Me.ChatView.OptionsTiles.Orientation = System.Windows.Forms.Orientation.Vertical
|
||||
Me.ChatView.OptionsTiles.RowCount = 0
|
||||
Me.ChatView.OptionsTiles.ScrollMode = DevExpress.XtraEditors.TileControlScrollMode.ScrollButtons
|
||||
Me.ChatView.OptionsTiles.ScrollMode = DevExpress.XtraEditors.TileControlScrollMode.ScrollBar
|
||||
TableColumnDefinition7.Length.Value = 250.0R
|
||||
TableColumnDefinition8.Length.Value = 100.0R
|
||||
ItemTemplate3.Columns.Add(TableColumnDefinition7)
|
||||
@ -193,6 +206,29 @@ Partial Class ChatControl
|
||||
Me.ChatView.TileRows.Add(TableRowDefinition11)
|
||||
Me.ChatView.TileRows.Add(TableRowDefinition12)
|
||||
'
|
||||
'lookupConversations
|
||||
'
|
||||
Me.lookupConversations.AllowAddNewValues = False
|
||||
Me.lookupConversations.DataSource = Nothing
|
||||
Me.lookupConversations.Dock = System.Windows.Forms.DockStyle.Top
|
||||
Me.lookupConversations.Location = New System.Drawing.Point(0, 0)
|
||||
Me.lookupConversations.MultiSelect = False
|
||||
Me.lookupConversations.Name = "lookupConversations"
|
||||
Me.lookupConversations.PreventDuplicates = False
|
||||
Me.lookupConversations.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions2, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject5, SerializableAppearanceObject6, SerializableAppearanceObject7, SerializableAppearanceObject8, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
|
||||
Me.lookupConversations.Properties.NullText = ""
|
||||
Me.lookupConversations.Properties.PopupView = Me.LookupControl21View
|
||||
Me.lookupConversations.SelectedValues = CType(resources.GetObject("lookupConversations.SelectedValues"), System.Collections.Generic.List(Of String))
|
||||
Me.lookupConversations.Size = New System.Drawing.Size(317, 20)
|
||||
Me.lookupConversations.TabIndex = 1
|
||||
'
|
||||
'LookupControl21View
|
||||
'
|
||||
Me.LookupControl21View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus
|
||||
Me.LookupControl21View.Name = "LookupControl21View"
|
||||
Me.LookupControl21View.OptionsSelection.EnableAppearanceFocusedCell = False
|
||||
Me.LookupControl21View.OptionsView.ShowGroupPanel = False
|
||||
'
|
||||
'txtMessage
|
||||
'
|
||||
Me.txtMessage.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
@ -200,9 +236,20 @@ Partial Class ChatControl
|
||||
Me.txtMessage.Name = "txtMessage"
|
||||
Me.txtMessage.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||
Me.txtMessage.Properties.Appearance.Options.UseFont = True
|
||||
Me.txtMessage.Size = New System.Drawing.Size(317, 50)
|
||||
Me.txtMessage.Size = New System.Drawing.Size(275, 50)
|
||||
Me.txtMessage.TabIndex = 1
|
||||
'
|
||||
'btnSendMessage
|
||||
'
|
||||
Me.btnSendMessage.Dock = System.Windows.Forms.DockStyle.Right
|
||||
Me.btnSendMessage.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleCenter
|
||||
Me.btnSendMessage.ImageOptions.SvgImage = CType(resources.GetObject("SimpleButton1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnSendMessage.Location = New System.Drawing.Point(275, 0)
|
||||
Me.btnSendMessage.Name = "btnSendMessage"
|
||||
Me.btnSendMessage.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light
|
||||
Me.btnSendMessage.Size = New System.Drawing.Size(42, 50)
|
||||
Me.btnSendMessage.TabIndex = 2
|
||||
'
|
||||
'ChatControl
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@ -214,6 +261,8 @@ Partial Class ChatControl
|
||||
Me.SplitContainerControl1.ResumeLayout(False)
|
||||
CType(Me.GridChat, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.ChatView, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.lookupConversations.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.txtMessage.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.ChatSource, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
@ -228,4 +277,7 @@ Partial Class ChatControl
|
||||
Friend WithEvents columnUsername As DevExpress.XtraGrid.Columns.TileViewColumn
|
||||
Friend WithEvents columnDate As DevExpress.XtraGrid.Columns.TileViewColumn
|
||||
Friend WithEvents ChatSource As BindingSource
|
||||
Friend WithEvents lookupConversations As LookupGrid.LookupControl2
|
||||
Friend WithEvents LookupControl21View As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Friend WithEvents btnSendMessage As DevExpress.XtraEditors.SimpleButton
|
||||
End Class
|
||||
|
||||
@ -117,6 +117,31 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="lookupConversations.SelectedValues" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
|
||||
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
|
||||
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
|
||||
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
|
||||
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="DevExpress.Data.v19.2" name="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<data name="SimpleButton1.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAALcBAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iTmV4dCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzIg
|
||||
MzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KPC9zdHls
|
||||
ZT4NCiAgPHBhdGggZD0iTTguOSw0LjFDOC40LDMuOCw4LDQuMSw4LDQuNnYyMC43YzAsMC42LDAuNCww
|
||||
LjgsMC45LDAuNWwxNi44LTEwLjNjMC41LTAuMywwLjUtMC44LDAtMS4xTDguOSw0LjF6IiBjbGFzcz0i
|
||||
Qmx1ZSIgLz4NCjwvc3ZnPgs=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="ChatSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
||||
@ -3,10 +3,10 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ChatControl
|
||||
Private ReadOnly IdColumn As String = "ID"
|
||||
Private ReadOnly UsernameColumn As String = "USERNAME"
|
||||
Private ReadOnly MessageColumn As String = "MESSAGE"
|
||||
Private ReadOnly DateColumn As String = "DATE"
|
||||
Private ReadOnly IdColumn As String = "GUID"
|
||||
Private ReadOnly UsernameColumn As String = "USER_FROM"
|
||||
Private ReadOnly MessageColumn As String = "MESSAGE_TEXT"
|
||||
Private ReadOnly DateColumn As String = "ADDED_WHEN"
|
||||
|
||||
Private Db As MSSQLServer
|
||||
Private LogConfig As LogConfig
|
||||
@ -22,50 +22,31 @@ Public Class ChatControl
|
||||
|
||||
Public IDBObjectId As Long
|
||||
Public ConnectionString As String
|
||||
Public CurrentUser As String
|
||||
Public CurrentConversation As Long
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Public Sub Init(ConnectionString As String, IDBObjectId As Long, CurrentUser As String)
|
||||
|
||||
Public Sub Init(LogConfig As LogConfig, ConnectionString As String, CurrentUser As String)
|
||||
Me.LogConfig = LogConfig
|
||||
Me.Logger = LogConfig.GetLogger()
|
||||
Me.ConnectionString = ConnectionString
|
||||
Me.CurrentUser = CurrentUser
|
||||
Me.Db = New MSSQLServer(LogConfig, ConnectionString)
|
||||
End Sub
|
||||
|
||||
Public Function InitData() As DataTable
|
||||
Dim oDatatable As New DataTable()
|
||||
Dim oColumns As New List(Of DataColumn) From {
|
||||
New DataColumn(IdColumn, New Integer.GetType),
|
||||
New DataColumn(UsernameColumn),
|
||||
New DataColumn(MessageColumn),
|
||||
New DataColumn(DateColumn, New Date.GetType)
|
||||
}
|
||||
oDatatable.Columns.AddRange(oColumns.ToArray)
|
||||
Public Sub LoadConversations(IDBObjectId As Long)
|
||||
Dim oSQL As String = $"SELECT * FROM VWIDB_CONVERSATION WHERE IDB_OBJ_ID = {IDBObjectId}"
|
||||
Dim oDatatable As DataTable = Db.GetDatatable(oSQL)
|
||||
|
||||
Dim oRow1 = oDatatable.NewRow()
|
||||
With oRow1
|
||||
.Item(IdColumn) = 0
|
||||
.Item(UsernameColumn) = "Jonathan"
|
||||
.Item(MessageColumn) = "Hi"
|
||||
.Item(DateColumn) = Now.AddMinutes(-10).ToShortTimeString
|
||||
End With
|
||||
lookupConversations.DataSource = oDatatable
|
||||
End Sub
|
||||
|
||||
Dim oRow2 = oDatatable.NewRow()
|
||||
With oRow2
|
||||
.Item(IdColumn) = 0
|
||||
.Item(UsernameColumn) = "Marlon"
|
||||
.Item(MessageColumn) = "Was geht?"
|
||||
.Item(DateColumn) = Now.ToShortTimeString
|
||||
End With
|
||||
|
||||
oDatatable.Rows.Add(oRow1)
|
||||
oDatatable.Rows.Add(oRow2)
|
||||
oDatatable.AcceptChanges()
|
||||
|
||||
Return oDatatable
|
||||
End Function
|
||||
|
||||
Private Sub ChatControl_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim oDatatable = InitData()
|
||||
Public Sub LoadConversation(ConversationId As Long)
|
||||
Dim oSQL As String = $"SELECT * FROM VWIDB_CONV_MESSAGES WHERE CONV_ID = {ConversationId} ORDER BY GUID"
|
||||
Dim oDatatable As DataTable = Db.GetDatatable(oSQL)
|
||||
|
||||
BuildUsernameColorDict(oDatatable)
|
||||
|
||||
@ -73,9 +54,22 @@ Public Class ChatControl
|
||||
ChatSource.DataSource = oDatatable
|
||||
End Sub
|
||||
|
||||
Public Sub SendMessage(MessageText As String)
|
||||
Try
|
||||
Dim oSQL As String = $"EXEC [PRIDB_NEW_CONVERSATION_MESSAGE] {CurrentConversation},'{MessageText}', '{CurrentUser}'"
|
||||
Dim oResult = Db.GetScalarValue(oSQL)
|
||||
LoadConversation(CurrentConversation)
|
||||
txtMessage.Text = String.Empty
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub BuildUsernameColorDict(Datatable As DataTable)
|
||||
Dim oIndex = 0
|
||||
|
||||
UsernameColorsDict.Clear()
|
||||
|
||||
Datatable.AsEnumerable().
|
||||
Select(Function(Row) Row.Item(UsernameColumn)).
|
||||
Distinct().ToList().
|
||||
@ -85,11 +79,11 @@ Public Class ChatControl
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
Private Sub ChatView_CustomItemTemplate(sender As Object, e As DevExpress.XtraGrid.Views.Tile.TileViewCustomItemTemplateEventArgs) Handles ChatView.CustomItemTemplate
|
||||
Private Sub ChatView_CustomItemTemplate(sender As Object, e As TileViewCustomItemTemplateEventArgs) Handles ChatView.CustomItemTemplate
|
||||
Dim oRow As DataRow = ChatView.GetDataRow(e.RowHandle)
|
||||
Dim oUsername As String = oRow.Item(UsernameColumn)
|
||||
|
||||
If oUsername = "Jonathan" Then
|
||||
If oUsername = CurrentUser Then
|
||||
e.Template = e.Templates.Item("ChatRight")
|
||||
Else
|
||||
e.Template = e.Templates.Item("ChatLeft")
|
||||
@ -101,15 +95,29 @@ Public Class ChatControl
|
||||
Dim oUsername As String = oRow.Item(UsernameColumn)
|
||||
Dim oColor As Color = UsernameColorsDict.Item(oUsername)
|
||||
|
||||
If oUsername = "Jonathan" Then
|
||||
e.Item.AppearanceItem.Normal.BackColor = Color.LightGray
|
||||
If oUsername = CurrentUser Then
|
||||
e.Item.AppearanceItem.Normal.BackColor = Color.PaleTurquoise
|
||||
End If
|
||||
e.Item.AppearanceItem.Focused.BackColor = Color.Turquoise
|
||||
e.Item.Item(UsernameColumn).Appearance.Normal.ForeColor = oColor
|
||||
End Sub
|
||||
|
||||
Private Sub txtMessage_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMessage.KeyUp
|
||||
If e.Control And e.KeyCode = Keys.Enter Then
|
||||
If e.Control And e.KeyCode = Keys.Enter And txtMessage.Text.Count > 0 Then
|
||||
SendMessage(txtMessage.Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub lookupConversations_SelectedValuesChanged(sender As Object, SelectedValues As List(Of String)) Handles lookupConversations.SelectedValuesChanged
|
||||
If SelectedValues.Count > 0 Then
|
||||
CurrentConversation = SelectedValues.First()
|
||||
LoadConversation(CurrentConversation)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnSendMessage.Click
|
||||
If txtMessage.Text.Count > 0 Then
|
||||
SendMessage(txtMessage.Text)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -53,12 +53,24 @@
|
||||
<Reference Include="DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DigitalData.Controls.LookupGrid">
|
||||
<HintPath>..\Controls.LookupGrid\obj\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.2\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
@ -126,6 +138,7 @@
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
4
Controls.ChatControl/packages.config
Normal file
4
Controls.ChatControl/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.7.2" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -312,6 +312,14 @@ Global
|
||||
{9713484C-6EE3-4D7E-B6E6-F32CF6B6BB6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9713484C-6EE3-4D7E-B6E6-F32CF6B6BB6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9713484C-6EE3-4D7E-B6E6-F32CF6B6BB6C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1F278760-4F6B-42E8-B82D-01D4C8618340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F278760-4F6B-42E8-B82D-01D4C8618340}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F278760-4F6B-42E8-B82D-01D4C8618340}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F278760-4F6B-42E8-B82D-01D4C8618340}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A726345-FD6B-4E1C-9E5D-18C9043D7714}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A726345-FD6B-4E1C-9E5D-18C9043D7714}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A726345-FD6B-4E1C-9E5D-18C9043D7714}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A726345-FD6B-4E1C-9E5D-18C9043D7714}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -363,6 +371,8 @@ Global
|
||||
{5FDEC007-7AE0-4829-B1AE-6165E29375DA} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||
{C8F9C3DD-9328-49E3-8530-48E6A4C82CAF} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
|
||||
{9713484C-6EE3-4D7E-B6E6-F32CF6B6BB6C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||
{1F278760-4F6B-42E8-B82D-01D4C8618340} = {F98C0329-C004-417F-B2AB-7466E88D8220}
|
||||
{4A726345-FD6B-4E1C-9E5D-18C9043D7714} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user