private void updateData(SystemLogData data) { Application.Current.Dispatcher.Invoke(() => { //mts.MessageText = message; mts.SystemLogData = data; }); }
public ServerService() { InitializeComponent(); // VMSServerServiceEventLog logAccess = new SystemLogData(); moduleAccess = new ModuleData(); trackingAccess = new TrackingData(); }
public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { try { string currentTimpstamp = mts.DoubleToTimeString(mts.GetTime()); // Focused IntPtr foregroundWindowHandle = WindowHelper.GetForegroundWindowPointer(); string moduleName = WindowHelper.GetProcessModuleName(foregroundWindowHandle); string windowName = WindowHelper.GetWindowText(foregroundWindowHandle); string[] logArray; SystemLogData data; string foregroundWindowLogInfo = FormatWindowInfo(moduleName, windowName); if (foregroundWindowLogInfo == null || foregroundWindowLogInfo.Length == 0 || foregroundWindowLogInfo.Equals(_previousWindowTitle) || _ignoreStringHelper.shouldIgnoreThisString(foregroundWindowLogInfo)) { return; } _previousWindowTitle = foregroundWindowLogInfo; //ystemLogData data = new SystemLogData(); string foregroundWindowLog = currentTimpstamp + "," + foregroundWindowLogInfo + ",focused"; logArray = foregroundWindowLog.Split(','); data = new SystemLogData(logArray[0], logArray[1], logArray[2], logArray[3]); //_logger.Info(foregroundWindowLog); updateData(data); // visible List <string> listOfVisibleWindow = WindowHelper.GetAllVisibleWindowExcludingForegroundWindow(foregroundWindowHandle); foreach (string windowInfo in listOfVisibleWindow) { if (!_ignoreStringHelper.shouldIgnoreThisString(windowInfo)) { string log = currentTimpstamp + "," + windowInfo + ",visible"; logArray = log.Split(','); data = new SystemLogData(logArray[0], logArray[1], logArray[2], logArray[3]); //_logger.Info(log); updateData(data); } } } catch (Exception e) { // _logger.Warn(e.Message); Debug.WriteLine(e); //updateMessage(e.Message); } }