private void lblComputer_DoubleClick(object sender, EventArgs e) { try { if (txtComputer.Text.Length > 0) { string versionInfo = CollectorEntryRelay.GetRemoteAgentHostVersion(txtComputer.Text, (int)remoteportNumericUpDown.Value); MessageBox.Show("Version Info: " + versionInfo, "Version", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Version", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void RefreshItem(object o) { ListViewItem lvi = (ListViewItem)o; try { try { bool hostExists = false; RemoteAgentInfo ri = (RemoteAgentInfo)lvi.Tag; CollectorEntry ce = new CollectorEntry(); ce.EnableRemoteExecute = true; ce.RemoteAgentHostAddress = ri.Computer; ce.RemoteAgentHostPort = ri.PortNumber; ce.CollectorRegistrationName = "PingCollector"; ce.CollectorRegistrationDisplayName = "Ping Collector"; ce.InitialConfiguration = "<config><hostAddress><entry pingMethod=\"Ping\" address=\"localhost\" description=\"\" maxTimeMS=\"1000\" timeOutMS=\"5000\" httpProxyServer=\"\" socketPort=\"23\" receiveTimeoutMS=\"30000\" sendTimeoutMS=\"30000\" useTelnetLogin=\"False\" userName=\"\" password=\"\" /></hostAddress></config>"; hostExists = System.Net.Dns.GetHostAddresses(ri.Computer).Count() != 0; if (!hostExists) { UpdateListViewItem(lvi, 3, "N/A"); } else { MonitorState testState = CollectorEntryRelay.GetRemoteAgentState(ce); if (testState.State == CollectorState.Good) { try { string versionInfo = CollectorEntryRelay.GetRemoteAgentHostVersion(ri.Computer, ri.PortNumber); UpdateListViewItem(lvi, 0, versionInfo); } catch (Exception ex) { if (ex.Message.Contains("ContractFilter")) { UpdateListViewItem(lvi, 2, "Remote host does not support version info query! Check that QuickMon 3.13 or later is installed."); } else { UpdateListViewItem(lvi, 2, ex.Message); } } } else { UpdateListViewItem(lvi, 2, "N/A"); } } } catch (Exception delegateEx) { if (delegateEx.Message.Contains("The formatter threw an exception while trying to deserialize the message")) { UpdateListViewItem(lvi, 3, "Old version of Remote agent host does not support query or format does not match! Please update remote agent host version."); } else { UpdateListViewItem(lvi, 3, delegateEx.Message); } } } catch (Exception riEx) { UpdateListViewItem(lvi, 1, riEx.ToString()); } }