wmi - How refresh ManagementObject result c# -
i need read information ms queue timeout (bytesinqueue, messagesinqueue), data not refresh.
var path = string.format(@"\\{0}\root\cimv2", machine); var scope = new managementscope(path); scope.connect(); string querystring = string.format(@"select * win32_perfrawdata_msmq_msmqqueue name '%{0}%'", queuepath.remove(0, queuepath.lastindexof('\\') + 1)); var query = new objectquery(querystring); var searcher = new managementobjectsearcher(scope, query); var moitems = managementobject x in searcher.get() select x; var moitem = moitems.firstordefault(); if (moitem != null) { bytesinqueue = (uint64)moitem.getpropertyvalue("bytesinqueue"); messagesinqueue = (uint64)moitem.getpropertyvalue("messagesinqueue"); }
if use windows management instrumentation tester, data not refreshed, there button "refresh object", need.
how can actual data, or refresh it?
you not able actual data, because have query it.
if want query queue @ set intervals, need timer.
drop timer control onto form.
select timer control , go properties.
configure refresh every 5000 milliseconds (that's 5 seconds, or use whatever want).
double click timer tick event in gui. should bring code window.
paste code routine.
Comments
Post a Comment