Fixed bad practice issues with sessions
This commit is contained in:
+30
-17
@@ -1,9 +1,8 @@
|
|||||||
Public Class clsSession
|
Public Class clsSession
|
||||||
|
|
||||||
Private sMonitorID As String
|
Private sMonitorID As String
|
||||||
Private dStart As DateTime
|
Private iStart As Int64
|
||||||
Private dEnd As DateTime
|
Private iEnd As Int64
|
||||||
Private sComputerName As String = My.Computer.Name
|
|
||||||
|
|
||||||
Public Property MonitorID As String
|
Public Property MonitorID As String
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
@@ -14,31 +13,45 @@
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Property SessionStart As DateTime
|
Public Property SessionStart As Int64
|
||||||
|
Set(value As Int64)
|
||||||
|
iStart = value
|
||||||
|
End Set
|
||||||
|
Get
|
||||||
|
Return iStart
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public WriteOnly Property SessionStartFromDate As DateTime
|
||||||
Set(value As DateTime)
|
Set(value As DateTime)
|
||||||
dStart = value
|
iStart = mgrCommon.DateToUnix(value)
|
||||||
End Set
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property SessionStartFormatted As DateTime
|
||||||
Get
|
Get
|
||||||
Return dStart
|
Return mgrCommon.UnixToDate(iStart)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Property SessionEnd As DateTime
|
Public Property SessionEnd As Int64
|
||||||
|
Set(value As Int64)
|
||||||
|
iEnd = value
|
||||||
|
End Set
|
||||||
|
Get
|
||||||
|
Return iEnd
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public WriteOnly Property SessionEndFromDate As DateTime
|
||||||
Set(value As DateTime)
|
Set(value As DateTime)
|
||||||
dEnd = value
|
iEnd = mgrCommon.DateToUnix(value)
|
||||||
End Set
|
End Set
|
||||||
Get
|
|
||||||
Return dEnd
|
|
||||||
End Get
|
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Property ComputerName As String
|
Public ReadOnly Property SessionEndFormatted As DateTime
|
||||||
Set(value As String)
|
|
||||||
sComputerName = value
|
|
||||||
End Set
|
|
||||||
Get
|
Get
|
||||||
Return sComputerName
|
Return mgrCommon.UnixToDate(iEnd)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -722,8 +722,8 @@ Public Class frmMain
|
|||||||
'Record Session
|
'Record Session
|
||||||
oSession = New clsSession
|
oSession = New clsSession
|
||||||
oSession.MonitorID = oProcess.GameInfo.ID
|
oSession.MonitorID = oProcess.GameInfo.ID
|
||||||
oSession.SessionStart = oProcess.StartTime
|
oSession.SessionStartFromDate = oProcess.StartTime
|
||||||
oSession.SessionEnd = oProcess.EndTime
|
oSession.SessionEndFromDate = oProcess.EndTime
|
||||||
|
|
||||||
mgrSessions.AddSession(oSession)
|
mgrSessions.AddSession(oSession)
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -7,13 +7,14 @@ Public Class frmSessions
|
|||||||
Private bInitFinished As Boolean = False
|
Private bInitFinished As Boolean = False
|
||||||
Private WithEvents tmFilterTimer As Timer
|
Private WithEvents tmFilterTimer As Timer
|
||||||
Private bStartSortAsc As Boolean = True
|
Private bStartSortAsc As Boolean = True
|
||||||
Private iStartSortCol As Integer = 2
|
Private iStartDataCol As Integer
|
||||||
Private iStartDisplayCol As Integer = 3
|
Private iStartDisplayCol As Integer
|
||||||
Private bEndSortAsc As Boolean = True
|
Private bEndSortAsc As Boolean = True
|
||||||
Private iEndSortCol As Integer = 4
|
Private iEndDataCol As Integer
|
||||||
Private iEndDisplayCol As Integer = 5
|
Private iEndDisplayCol As Integer
|
||||||
|
|
||||||
Private Sub FormatGrid()
|
Private Sub FormatGrid()
|
||||||
|
'Build Columns
|
||||||
dgSessions.Columns.Add("MonitorID", frmSessions_ColumnMonitorID)
|
dgSessions.Columns.Add("MonitorID", frmSessions_ColumnMonitorID)
|
||||||
dgSessions.Columns.Add("Name", frmSessions_ColumnGameName)
|
dgSessions.Columns.Add("Name", frmSessions_ColumnGameName)
|
||||||
dgSessions.Columns.Add("StartUnix", frmSessions_ColumnStart)
|
dgSessions.Columns.Add("StartUnix", frmSessions_ColumnStart)
|
||||||
@@ -21,6 +22,12 @@ Public Class frmSessions
|
|||||||
dgSessions.Columns.Add("EndUnix", frmSessions_ColumnEnd)
|
dgSessions.Columns.Add("EndUnix", frmSessions_ColumnEnd)
|
||||||
dgSessions.Columns.Add("End", frmSessions_ColumnEnd)
|
dgSessions.Columns.Add("End", frmSessions_ColumnEnd)
|
||||||
|
|
||||||
|
'Get Column Indexes
|
||||||
|
iStartDataCol = dgSessions.Columns.IndexOf(dgSessions.Columns("StartUnix"))
|
||||||
|
iStartDisplayCol = dgSessions.Columns.IndexOf(dgSessions.Columns("Start"))
|
||||||
|
iEndDataCol = dgSessions.Columns.IndexOf(dgSessions.Columns("EndUnix"))
|
||||||
|
iEndDisplayCol = dgSessions.Columns.IndexOf(dgSessions.Columns("End"))
|
||||||
|
|
||||||
'Set Sorting
|
'Set Sorting
|
||||||
dgSessions.Columns("Start").SortMode = DataGridViewColumnSortMode.Programmatic
|
dgSessions.Columns("Start").SortMode = DataGridViewColumnSortMode.Programmatic
|
||||||
dgSessions.Columns("End").SortMode = DataGridViewColumnSortMode.Programmatic
|
dgSessions.Columns("End").SortMode = DataGridViewColumnSortMode.Programmatic
|
||||||
@@ -116,8 +123,8 @@ Public Class frmSessions
|
|||||||
For Each dgvRow As DataGridViewRow In dgSessions.SelectedRows
|
For Each dgvRow As DataGridViewRow In dgSessions.SelectedRows
|
||||||
oSession = New clsSession
|
oSession = New clsSession
|
||||||
oSession.MonitorID = dgvRow.Cells(0).Value
|
oSession.MonitorID = dgvRow.Cells(0).Value
|
||||||
oSession.SessionStart = dgvRow.Cells(iStartDisplayCol).Value
|
oSession.SessionStart = CInt(dgvRow.Cells(iStartDataCol).Value)
|
||||||
oSession.SessionEnd = dgvRow.Cells(iEndDisplayCol).Value
|
oSession.SessionEnd = CInt(dgvRow.Cells(iEndDataCol).Value)
|
||||||
oSessions.Add(oSession)
|
oSessions.Add(oSession)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -151,10 +158,10 @@ Public Class frmSessions
|
|||||||
Select Case iCol
|
Select Case iCol
|
||||||
Case iStartDisplayCol
|
Case iStartDisplayCol
|
||||||
bStartSortAsc = Not bStartSortAsc
|
bStartSortAsc = Not bStartSortAsc
|
||||||
dgSessions.Sort(dgSessions.Columns(iStartSortCol), GetSortOrder(bStartSortAsc, iCol))
|
dgSessions.Sort(dgSessions.Columns(iCol), GetSortOrder(bStartSortAsc, iCol))
|
||||||
Case iEndDisplayCol
|
Case iEndDisplayCol
|
||||||
bEndSortAsc = Not bEndSortAsc
|
bEndSortAsc = Not bEndSortAsc
|
||||||
dgSessions.Sort(dgSessions.Columns(iEndSortCol), GetSortOrder(bEndSortAsc, iCol))
|
dgSessions.Sort(dgSessions.Columns(iCol), GetSortOrder(bEndSortAsc, iCol))
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
Dim oSession As New clsSession
|
Dim oSession As New clsSession
|
||||||
|
|
||||||
oSession.MonitorID = CStr(dr("MonitorID"))
|
oSession.MonitorID = CStr(dr("MonitorID"))
|
||||||
oSession.SessionStart = mgrCommon.UnixToDate(CInt(dr("Start")))
|
oSession.SessionStart = CInt(dr("Start"))
|
||||||
oSession.SessionEnd = mgrCommon.UnixToDate(CInt(dr("End")))
|
oSession.SessionEnd = CInt(dr("End"))
|
||||||
|
|
||||||
Return oSession
|
Return oSession
|
||||||
End Function
|
End Function
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
|
|
||||||
hshParams.Add("MonitorID", oSession.MonitorID)
|
hshParams.Add("MonitorID", oSession.MonitorID)
|
||||||
hshParams.Add("Start", mgrCommon.DateToUnix(oSession.SessionStart))
|
hshParams.Add("Start", oSession.SessionStart)
|
||||||
hshParams.Add("End", mgrCommon.DateToUnix(oSession.SessionEnd))
|
hshParams.Add("End", oSession.SessionEnd)
|
||||||
|
|
||||||
Return hshParams
|
Return hshParams
|
||||||
End Function
|
End Function
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
For Each oSession As clsSession In oSessions
|
For Each oSession As clsSession In oSessions
|
||||||
hshParams = New Hashtable
|
hshParams = New Hashtable
|
||||||
hshParams.Add("MonitorID", oSession.MonitorID)
|
hshParams.Add("MonitorID", oSession.MonitorID)
|
||||||
hshParams.Add("Start", mgrCommon.DateToUnix(oSession.SessionStart))
|
hshParams.Add("Start", oSession.SessionStart)
|
||||||
oParamList.Add(hshParams)
|
oParamList.Add(hshParams)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user