RemoteIdListView trigger button
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -37,13 +38,6 @@ namespace UCS.RemoteIDList
|
||||
[DisplayName("Connectie status")]
|
||||
bool ConnectionState { get; }
|
||||
|
||||
//[DisplayName("Reset Timer")]
|
||||
//DataGridViewButtonCell ResetButton { get; }
|
||||
|
||||
//[DisplayName("Reset Timer")]
|
||||
//DataGridViewButtonColumn ResetButtonColumn { get; }
|
||||
|
||||
|
||||
event EventHandler<object> SendDataEvent;
|
||||
event EventHandler OnlineEvent;
|
||||
event EventHandler OfflineEvent;
|
||||
@@ -51,7 +45,7 @@ namespace UCS.RemoteIDList
|
||||
void SendStartupMessage();
|
||||
void SetLastData(string data);
|
||||
void StopMonitor();
|
||||
|
||||
void TriggerTimer();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,6 @@ namespace UCS.RemoteIDList
|
||||
public DateTime LastDataDate { get; private set; }
|
||||
public bool ConnectionState { get; private set; }
|
||||
|
||||
//public DataGridViewButtonCell ResetButton { get; private set; }
|
||||
//public DataGridViewButtonColumn ResetButtonColumn { get; private set; }
|
||||
|
||||
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
|
||||
|
||||
public event EventHandler<object> SendDataEvent;
|
||||
@@ -87,5 +84,11 @@ namespace UCS.RemoteIDList
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
|
||||
public void TriggerTimer()
|
||||
{
|
||||
Timer_Elapsed(null, null);
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace UCS.RemoteIDList
|
||||
{
|
||||
private DateTime m_dueTime;
|
||||
|
||||
|
||||
public RemoteIdListTimer() : base() => this.Elapsed += this.ElapsedAction;
|
||||
|
||||
protected new void Dispose()
|
||||
@@ -30,6 +31,6 @@ namespace UCS.RemoteIDList
|
||||
{
|
||||
if (this.AutoReset)
|
||||
this.m_dueTime = DateTime.Now.AddMilliseconds(this.Interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<HintPath>..\packages\NLog.4.7.11\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
|
||||
@@ -26,9 +26,6 @@ namespace UCS.RemoteIDList
|
||||
public DateTime LastDataDate { get; private set; }
|
||||
public bool ConnectionState { get; private set; }
|
||||
|
||||
//public DataGridViewButtonCell ResetButton => new DataGridViewButtonCell();
|
||||
//public DataGridViewButtonColumn ResetButtonColumn => new DataGridViewButtonColumn();
|
||||
|
||||
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
|
||||
|
||||
public event EventHandler<object> SendDataEvent;
|
||||
@@ -99,5 +96,11 @@ namespace UCS.RemoteIDList
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
|
||||
public void TriggerTimer()
|
||||
{
|
||||
Timer_Elapsed(null, null);
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ namespace UCS.RemoteIDList
|
||||
public DateTime LastDataDate { get; private set; }
|
||||
public bool ConnectionState { get; private set; }
|
||||
|
||||
//public DataGridViewButtonCell ResetButton { get; private set; }
|
||||
//public DataGridViewButtonColumn ResetButtonColumn { get; private set; }
|
||||
|
||||
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
|
||||
|
||||
public event EventHandler<object> SendDataEvent;
|
||||
@@ -88,5 +85,11 @@ namespace UCS.RemoteIDList
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
|
||||
public void TriggerTimer()
|
||||
{
|
||||
Timer_Elapsed(null, null);
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Reflection
|
||||
Imports UCS.RemoteIDList
|
||||
|
||||
Public Class RemoteIdListView
|
||||
Public Overrides Property SettingsName As String = "RemoteIdListView"
|
||||
@@ -18,13 +19,43 @@ Public Class RemoteIdListView
|
||||
ScreenRefreshTimer.Interval = 1000 '1 seconden
|
||||
ScreenRefreshTimer.Enabled = True
|
||||
|
||||
RemoteIDListDataGrid.AutoGenerateColumns = True
|
||||
RemoteIDListDataGrid.DataSource = RemoteIDList.RemoteIDList.GetRemoteIdList()
|
||||
|
||||
Dim column As New DataGridViewButtonColumn With {
|
||||
.DataPropertyName = "TriggerTimer",
|
||||
.Name = "Trigger Timer",
|
||||
.Text = "Trigger",
|
||||
.UseColumnTextForButtonValue = True
|
||||
}
|
||||
RemoteIDListDataGrid.Columns.Add(column)
|
||||
|
||||
RemoteIDListDataGrid.AutoResizeColumns()
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.ToString)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteIDListDataGrid_CellFormatting(ByVal Sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles RemoteIDListDataGrid.CellFormatting
|
||||
With RemoteIDListDataGrid.Columns(e.ColumnIndex)
|
||||
If .ValueType = GetType(DateTime) Then
|
||||
If DirectCast(e.Value, DateTime) <> DateTime.MinValue Then
|
||||
e.CellStyle.Format = "dd-MM-yyyy hh:mm:ss"
|
||||
End If
|
||||
End If
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteIDListDataGrid_CellContentClick(sender As System.Object, e As DataGridViewCellEventArgs) Handles RemoteIDListDataGrid.CellContentClick
|
||||
Dim senderGrid = DirectCast(sender, DataGridView)
|
||||
If TypeOf senderGrid.Columns(e.ColumnIndex) Is DataGridViewButtonColumn AndAlso e.RowIndex >= 0 Then
|
||||
'Console.WriteLine($"click {e.ColumnIndex} - {e.RowIndex}")
|
||||
Dim row As DataGridViewRow = RemoteIDListDataGrid.Rows(e.RowIndex)
|
||||
Dim monitorobject As IMonitorObject = DirectCast(row.DataBoundItem, IMonitorObject)
|
||||
monitorobject.TriggerTimer()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteIdListView_FormClosing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
|
||||
FrmMain.RemoteIDListToolStripMenuItem.Checked = False
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user