/// <summary> /// Initializes object instance /// </summary> /// <param name="logClient">log client object</param> public LogClient(CNetLogClient logClient) { if (logClient == null) { throw new ArgumentNullException("logClient"); } _logClient = logClient; }
/// <summary> /// Client found event handler from GUI thread /// </summary> /// <param name="client"></param> void logViewer_OnClientFoundSync(CNetLogClient client) { try { clientsListBox.Items.Add(new LogClient(client)); } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Client found event handler /// </summary> /// <param name="client">found client</param> void _logViewer_OnClientFound(CNetLogClient client) { try { if (client == null) { throw new ArgumentNullException("client"); } clientsListBox.Invoke(new DelegateClientFound(this.logViewer_OnClientFoundSync), new object[] { client }); } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Client timed out event handler /// </summary> /// <param name="client">timed out client</param> void _logViewer_OnClientTimedOut(CNetLogClient client) { try { if (client == null) { throw new ArgumentNullException("client"); } clientsListBox.Items.Remove(new LogClient(client)); } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// refresh client list event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void refreshBtn_Click(object sender, EventArgs e) { try { clientsListBox.Items.Clear(); System.Collections.IEnumerable clientList = _logViewer.GetClientsList(); if (clientList == null) { throw new System.Exception("GetClientsList returned null enumerable"); } foreach (Object obj in clientList) { CNetLogClient logClient = obj as CNetLogClient; if (logClient != null) { clientsListBox.Items.Add(new LogClient(logClient)); } } } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Initializes object instance /// </summary> /// <param name="logClient">log client object</param> public LogClient(CNetLogClient logClient) { if (logClient == null) throw new ArgumentNullException("logClient"); _logClient = logClient; }
/// <summary> /// Client timed out event handler /// </summary> /// <param name="client">timed out client</param> void _logViewer_OnClientTimedOut(CNetLogClient client) { try { if (client == null) throw new ArgumentNullException("client"); clientsListBox.Items.Remove(new LogClient(client)); } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Client found event handler /// </summary> /// <param name="client">found client</param> void _logViewer_OnClientFound(CNetLogClient client) { try { if (client == null) throw new ArgumentNullException("client"); clientsListBox.Invoke(new DelegateClientFound(this.logViewer_OnClientFoundSync), new object[] { client }); } catch (System.Exception exception) { System.Windows.Forms.MessageBox.Show(exception.ToString(), "Error gettint clients", MessageBoxButtons.OK, MessageBoxIcon.Error); } }