예제 #1
0
        private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
        {
            string eventType = e.NewEvent.ClassPath.ClassName;
            WMI.Win32.Process proc = new WMI.Win32.Process(e.NewEvent["TargetInstance"] as ManagementBaseObject);

            switch (eventType)
            {
                case "__InstanceCreationEvent":
                    if (ProcessCreated != null)
                    {
                        ProcessCreated(proc);
                    }
                    break;

                case "__InstanceDeletionEvent":
                    if (ProcessDeleted != null)
                    {
                        ProcessDeleted(proc);
                    }
                    break;

                case "__InstanceModificationEvent":
                    if (ProcessModified != null)
                    {
                        ProcessModified(proc);
                    }
                    break;
            }
        }
예제 #2
0
        private void WatcherOnEventArrived(object sender, EventArrivedEventArgs eventArrivedEventArgs)
        {
            Console.WriteLine("Event arrived");

            CheckKeyboardPlugging();
            SetzeNumLock();
        }
예제 #3
0
파일: Program.cs 프로젝트: tqtam/LUANVAN
 static void DeviceRemovedEvent(object sender, EventArrivedEventArgs e)
 {
     ManagementBaseObject instance = (ManagementBaseObject)e.NewEvent["TargetInstance"];
     Console.Write("Remove - ");
     var tmpQuery = new ManagementObjectSearcher("select Description,Name from Win32_LogicalDisk").Get();
     var currDrives = new List<string>();
     foreach (var drive in tmpQuery)
     {
         if (drive["Description"].ToString().Contains("Removable"))
         {
             currDrives.Add(drive["Name"].ToString());
         }
     }
     for (int i = 0; i < drives.Count; i++)
     {
         if (currDrives.IndexOf(drives[i]) == -1)
         {
             Console.WriteLine(drives[i]);
             //drives.RemoveAt(i);
             drives.Clear();
             drives.AddRange(currDrives);
             break;
         }
     }
 }
 void OnRegistryWatcher_EventArrived(object sender, EventArrivedEventArgs e)
 {
     if (this.RegistryKeyChanged != null)
     {
         this.RegistryKeyChanged(this, new RegistryKeyChangedEventArgs(e.NewEvent));
     }
 }
예제 #5
0
 private void ReportEventMessage(EventArrivedEventArgs e)
 {
     ManagementBaseObject o = e.NewEvent; //__InstanceCreationEvent
     ManagementBaseObject mo = (ManagementBaseObject)o["TargetInstance"];//Win32_Process
     Console.WriteLine("Name={0},ExecPath={1},CommandLine={2}",
         mo["Name"], mo["ExecutablePath"], mo["CommandLine"]);
 }
예제 #6
0
        private void OnEventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            try
            {
                string eventName = e.NewEvent.ClassPath.ClassName;

                if (eventName.CompareTo("__InstanceCreationEvent") == 0)
                {
                    // Started
                    if (Started != null)
                    {
                        Started(this, e);
                    }
                }
                else if (eventName.CompareTo("__InstanceDeletionEvent") == 0)
                {
                    // Terminated
                    if (Terminated != null)
                    {
                        Terminated(this, e);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
예제 #7
0
        /*
         *      public static DataTable RunningProcesses()
         *      {
         *  //One way of constructing a query
         *  //string className = "Win32_Process";
         *  //string condition = "";
         *  //string[] selectedProperties = new string[] {"Name", "ProcessId", "Caption", "ExecutablePath"};
         *  //SelectQuery query = new SelectQuery(className, condition, selectedProperties);
         *
         *              // The second way of constructing a query
         *              string queryString =
         *                      "SELECT Name, ProcessId, Caption, ExecutablePath" +
         *                      "  FROM Win32_Process";
         *
         *              SelectQuery query = new SelectQuery(queryString);
         *              ManagementScope scope = new System.Management.ManagementScope(@"\\.\root\CIMV2");
         *
         *              ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
         *              ManagementObjectCollection processes = searcher.Get();
         *
         *              DataTable result = new DataTable();
         *              result.Columns.Add("Name", Type.GetType("System.String"));
         *              result.Columns.Add("ProcessId", Type.GetType("System.Int32"));
         *              result.Columns.Add("Caption", Type.GetType("System.String"));
         *              result.Columns.Add("Path", Type.GetType("System.String"));
         *
         *              foreach(ManagementObject mo in processes)
         *              {
         *                      DataRow row = result.NewRow();
         *                      row["Name"] = mo["Name"].ToString();
         *                      row["ProcessId"] = Convert.ToInt32(mo["ProcessId"]);
         *                      if (mo["Caption"]!= null)
         *                              row["Caption"] = mo["Caption"].ToString();
         *                      if (mo["ExecutablePath"]!= null)
         *                              row["Path"] = mo["ExecutablePath"].ToString();
         *                      result.Rows.Add( row );
         *              }
         *              return result;
         *      }
         */

        private void OnEventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            try
            {
                string eventName = e.NewEvent.ClassPath.ClassName;

                if (eventName.CompareTo("__InstanceCreationEvent") == 0)
                {
                    // Started
                    if (Started != null && count == 0)
                    {
                        Started(this, e);
                    }

                    count++;
                }
                else if (eventName.CompareTo("__InstanceDeletionEvent") == 0)
                {
                    // Terminated
                    count = (count > 0) ? count - 1 : 0;

                    if (Terminated != null && count == 0)
                    {
                        Terminated(this, e);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Trace.TraceInformation(ex.StackTrace);
                Trace.Flush();
            }
        }
        private void HandleEvent(object sender, EventArrivedEventArgs e)
        {
            ManagementBaseObject info = e.NewEvent;

            log.Info("Event arrived ! " + info.ClassPath);
            log.Debug(info.GetText(TextFormat.Mof));
        }
예제 #9
0
        private void OnEventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            log.Debug("EventArrived: " + e);
            try
            {
                string eventName = e.NewEvent.ClassPath.ClassName;

                if (eventName.CompareTo("__InstanceCreationEvent") == 0)
                {
                    if (Started != null)
                    {
                        Started(this, e);
                    }
                }
                else if (eventName.CompareTo("__InstanceDeletionEvent") == 0)
                {
                    if (Terminated != null)
                    {
                        Terminated(this, e);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Debug("EventArrived Exception", ex);
            }
        }
예제 #10
0
 private void KeyValueChanged(object sender, EventArrivedEventArgs e)
 {
     string programName = (string)Registry.GetValue(FullPath,
         ValueName,
         InvalidShow);
     Console.Out.WriteLine("Found program {0}", programName);
 }
예제 #11
0
 public void delegate_EventArrived(object sender, EventArrivedEventArgs e)
 {
     lock (eventsCollectionLock)
     {
         eventsReceived.Add(e.NewEvent);
     }
 }
예제 #12
0
        private void EventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            foreach (PropertyData pd in e.NewEvent.Properties)
            {
                ManagementBaseObject mbo = null;
                if ((mbo = pd.Value as ManagementBaseObject) != null)
                {
                    foreach (PropertyData prop in mbo.Properties)
                    {
                        string info = string.Format("{0} - {1}", prop.Name, prop.Value);

                        if ((info.Contains("USB Serial Port")) || info.Contains("ELMO GMAS"))
                        {
                            currentEventUsb = DateTime.Now;
                            TimeSpan ts           = currentEventUsb - lastEventUsb;
                            double   TimeInSecond = ts.TotalSeconds;
                            lastEventUsb = currentEventUsb;
                            if (TimeInSecond > 5.0)
                            {
                                if (DeviceEvent != null)
                                {
                                    DeviceEvent(this, EventArgs.Empty);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void OnProcessStarted(object sender, EventArrivedEventArgs e)
        {
            try
                {
                    uint processId = (uint)(e.NewEvent["TargetInstance"] as ManagementBaseObject).GetPropertyValue("ProcessId");
                    string eventType = e.NewEvent.ClassPath.ClassName;

                    ProcessEventArgs args = new ProcessEventArgs(Process.GetProcessById((int)processId));
                    EventHandler<ProcessEventArgs> handler;

                    switch (eventType)
                    {
                        case "__InstanceCreationEvent":
                            handler = this.ProcessStarted;
                            if (handler != null)
                                this.ProcessStarted(this, args);
                            break;

                        case "__InstanceDeletionEvent":
                            break;

                        case "__InstanceModificationEvent":
                            break;

                        default:
                            break;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.ToString());
                }
        }
        private void HandleProcessDeletion(object sender, EventArrivedEventArgs e)
        {
            //Console.WriteLine("Event arrived !");
            CLogger.WriteLog(ELogLevel.DEBUG, "Process killed arrived: # " + count++);
            try
            {
                // Get the Event object
                Win32ProcessInfo newInfo = new Win32ProcessInfo();
                newInfo.processID = Convert.ToInt32(e.NewEvent.Properties["ProcessId"].Value.ToString());
                newInfo.timeStamp = DateTime.Now;

                //CLogger.WriteLog(ELogLevel.DEBUG, managementObject.GetText(TextFormat.Mof));
                //MessageBox.Show("Here");
                //Win32ProcessInfo newInfo = processProcDeleteObject(managementObject);

                lock (killedProcessList)
                {
                    killedProcessList.Add(newInfo);
                }
            }
            catch (Exception ex)
            {
                //throw (new System.Exception(ex.Message));
                CLogger.WriteLog(ELogLevel.ERROR, ex.Message + "\n" + ex.StackTrace);
            }
        }
예제 #15
0
        static void mgmtWtch_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            PropertyData processName = e.NewEvent.Properties["ProcessName"];
            string       test        = "nichts";

            if (processName.Value.ToString() != null)
            {
                test = processName.Value.ToString();
            }

            Console.WriteLine(test);
            if (test.Contains("League of Lege"))
            {
                if (e.NewEvent.ClassPath.ToString().Equals("Win32_ProcessStartTrace"))
                {
                    Console.WriteLine("League of Legends launched");
                    ApiFetcher.getData(0, 3);
                }
                else
                {
                    Console.WriteLine("League of Legends stopped");
                    FileWriter.WriteToFile("Not Ingame");
                    ApiFetcher.getData();
                }
            }
        }
예제 #16
0
 private static void OnFolderChanged(object source, EventArrivedEventArgs e)
 {
     using (StreamWriter F = new StreamWriter("C:\\LABA4\\Laba-4.log", true))
     {
         F.WriteLine(DateTime.Now + " C:\\LABA4\\TEST changed");
     }
 }
예제 #17
0
 private static void OnRegChanged(object source, EventArrivedEventArgs e)
 {
     using (StreamWriter F = new StreamWriter("C:\\LABA4\\Laba-4.log", true))
     {
         F.WriteLine(DateTime.Now + " HKEY_LOCAL_MACHINE\\Software\\LABA4 changed");
     }
 }
예제 #18
0
 static void HandleEvent(object sender, 
     EventArrivedEventArgs e)
 {
     ManagementBaseObject targetInstance =
         (ManagementBaseObject)e.NewEvent["TargetInstance"];
     Console.WriteLine(targetInstance["Name"]);
 }
예제 #19
0
 private static void OnDNSCacheChanged(object source, EventArrivedEventArgs e)
 {
     using (StreamWriter F = new StreamWriter("C:\\LABA4\\Laba-4.log", true))
     {
         F.WriteLine(DateTime.Now + " DNSCache.exe proccess changed");
     }
 }
예제 #20
0
파일: usb.cs 프로젝트: icprog/WinDiagnostic
        private void USBWatcher_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            try
            {
                ManagementBaseObject newEvent = e.NewEvent, newEventTarget = (newEvent["TargetInstance"] as ManagementBaseObject);
                if (newEventTarget["InterfaceType"].ToString() == "USB")
                {
                    switch (newEvent.ClassPath.ClassName)
                    {
                    case "__InstanceCreationEvent":
                        BeginInvoke(updateDelegate, new object[] { Convert.ToString(newEventTarget["Caption"]) + " has been plugged in." });
                        Console.WriteLine(Convert.ToString(newEventTarget["Caption"]) + " has been plugged in.");
                        break;

                    case "__InstanceDeletionEvent":
                        BeginInvoke(updateDelegate, new object[] { Convert.ToString(newEventTarget["Caption"]) + " has been plugged out." });
                        Console.WriteLine(Convert.ToString(newEventTarget["Caption"]) + " has been plugged out.");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #21
0
 void DeviceArrived(object sender, EventArrivedEventArgs e)
 {
     List<Descriptor> arrivedDevices =
         Enumerator.AllDevices.Except(Devices).ToList();
     if (arrivedDevices.Count > 0)
         App.Invoke(() => Devices.AddRange(arrivedDevices));
 }
        private static void ProcessStopDetected(object source, EventArrivedEventArgs e)
        {
            ManagementBaseObject process = (ManagementBaseObject)((ManagementBaseObject)e.NewEvent)["TargetInstance"];

            //Last three arguements of the new data point call here are filler data. Should be replaced when we actually know how to get the data.
            ProcessDataPoint pdp = new ProcessDataPoint(process["Name"].ToString(), ProcessDataPoint.PROCESS_TERMINATED, parseCIM(process["CreationDate"].ToString()), process["PeakWorkingSetSize"].ToString());
            controller.addDataPoint(container, pdp);
        }
        private void WatcherEventArrived(object sender, EventArrivedEventArgs e)
        {
            string eventType = e.NewEvent.ClassPath.ClassName;
            System.Console.WriteLine("Process "+eventType);
            var proc = new Win32_Process(e.NewEvent["TargetInstance"] as ManagementBaseObject);

            ProcessCreated.SafeInvoke(this, proc);
        }
        public void DeviceChangeEventHandler(object obj, EventArrivedEventArgs args)
        {
            if (!isActive) return;

            List<Win32_PNPEntity_Wrap> newDeviceList = BuildDeviceList();
            LookForDifferences(newDeviceList, deviceList);
            deviceList = newDeviceList;
        }
예제 #25
0
 private void ProcessStartEventArrived(object sender, EventArrivedEventArgs e)
 {
     var processName = e.NewEvent.Properties["ProcessName"].Value.ToString();
     if (processName.ToLowerInvariant() == this.processName.ToLowerInvariant())
     {
         //var timeCreated = (ulong)e.NewEvent.Properties["TIME_CREATED"].Value;
         this.notifyAction(DateTime.Now);
     }
 }
예제 #26
0
 private void startWatch_EventArrived(object sender, EventArrivedEventArgs e)
 {
     if (ProcessWatcher.process_names.Contains(e.NewEvent.Properties["ProcessName"].Value.ToString().ToLower()))
     {
         int key = int.Parse(e.NewEvent.Properties["ProcessID"].Value.ToString());
         if (Add != null)
             Add(this, key);
     }
 }
예제 #27
0
        public void OnEventArrived(object sender, EventArrivedEventArgs e)
        {
            ManagementBaseObject evt = e.NewEvent;

            Console.WriteLine("Process {0} has been created, path is: {1}",
                ((ManagementBaseObject)evt["TargetInstance"])["Name"],
                ((ManagementBaseObject)evt["TargetInstance"])["ExecutablePath"]);
 
        }
예제 #28
0
파일: Form1.cs 프로젝트: Xiryl/RemindME
 void DeviceRemovedEvent(object sender, EventArrivedEventArgs e)
 {
     ManagementBaseObject instance = (ManagementBaseObject)e.NewEvent["TargetInstance"];
     foreach (var property in instance.Properties)
     {
         //MessageBox.Show(property.Name + " = " + property.Value);
         // Console.WriteLine(property.Name + " = " + property.Value);
     }
 }
예제 #29
0
 void Attaching(object sender, EventArrivedEventArgs e)
 {
     if (sender != watcherAttach && !isAttached) return;
     isAttached = true;
     //Dispatcher.Invoke(DispatcherPriority.Normal, attached);
     _uiThreadContext.Post(new SendOrPostCallback((o) =>
     {
         attached();
     }), null);
 }
        private static void ProcessStarted(object sender, EventArrivedEventArgs e)
        {
            var processName = (string)e.NewEvent["ProcessName"];
            var processId = (UInt32)e.NewEvent["ProcessId"];

            if (String.IsNullOrEmpty(processName))
                return;

            _map[processId] = Path.GetFileNameWithoutExtension(processName);
        }
예제 #31
0
        public void OnEventArrived(object sender, EventArrivedEventArgs e)
        {
            ManagementBaseObject evt = e.NewEvent;

            string time = String.Format("{0}:{1:00}",
                ((ManagementBaseObject)evt["TargetInstance"])["Hour"],
                ((ManagementBaseObject)evt["TargetInstance"])["Minute"]);

            MessageBox.Show(time, "Current time");
        }
예제 #32
0
        void Detaching(object sender, EventArrivedEventArgs e)
        {
            if (sender != watcherDetach && isAttached) return;
            isAttached = false;
            //detached();
            _uiThreadContext.Post(new SendOrPostCallback((o) =>
            {
                detached();
            }), null);

        }
        public void OnEventArrived(object sender, EventArrivedEventArgs e)
        {
            ManagementBaseObject evt = e.NewEvent;

            //Display information from the event
            string time = string.Format("{0}:{1:00}",
                ((ManagementBaseObject)evt["TargetInstance"])["Hour"],
                ((ManagementBaseObject)evt["TargetInstance"])["Minute"]);

            MessageBox.Show(time, "Current Time", MessageBoxButton.OK);
        }
예제 #34
0
 private static void WriteFinished(object source, EventArrivedEventArgs e)
 {
     string textFile = "";
     if (!File.Exists(path))
         using (File.Create(path)) { }
     using (StreamReader readFile = new StreamReader(path)) { textFile = readFile.ReadToEnd(); }
     using (StreamWriter F = new StreamWriter(path))
     {
         F.WriteLine(textFile + "\n" + DateTime.Now + "Create ");
     }
 }
예제 #35
0
 void pWatcher_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
 {
     listBox1.Dispatcher.Invoke(
         new Action(
             delegate()
     {
         listBox1.Items.Add(e.NewEvent["TargetInstance"] as ManagementBaseObject);
     }
             ), null);
     //throw new NotImplementedException();
 }
예제 #36
0
 private static void OnRegChanged(object source, EventArrivedEventArgs e)
 {
     string textFile = "";
     if (!File.Exists(path))
         using (File.Create(path)) { }
     using (StreamReader readFile = new StreamReader(path)) { textFile = readFile.ReadToEnd(); }
     using (StreamWriter F = new StreamWriter(path))
     {
         F.WriteLine(textFile + "\n" + DateTime.Now + " HKEY_LOCAL_MACHINE\\Software\\LABA4 changed");
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mewPrintJobs_EventSet(object sender, System.Management.EventArrivedEventArgs e)
        {
            if (!_doWatching)
            {
                return;
            }

            try
            {
                // get arrived print job
                ManagementBaseObject printJob = (ManagementBaseObject)e.NewEvent.Properties["TargetInstance"].Value;
                if (printJob == null)
                {
                    return;
                }

                PrintJobData printJobData = new PrintJobData(printJob, _host);

                LogHelper.LogDebug(_host + " : " + printJobData.PrintJobTitle + " | " + printJobData.JobStatus);

                if (CanSkip(printJobData))
                {
                    if (printJobData.JobStatus.JobStatus.HasFlag(PrintJobStatusEnum.Deleting) || printJobData.JobStatus.JobStatus == (PrintJobStatusEnum.Deleting | PrintJobStatusEnum.Error))
                    {
                        //LogHelper.LogDebug(_host + " : Reset Skip " + printJobData.PrintJobTitle);
                        //ResetSkip(printJobData);
                    }
                    return;
                }

                if (ConfigData.Config_InterceptPrintJobAndCancel)
                {
                    PrintHelper.CancelAllPrintJobs(printJob, _host);
                }
                else
                {
                    if (printJobData.JobStatus.JobStatus == PrintJobStatusEnum.Paused ||
                        printJobData.JobStatus.JobStatus == PrintJobStatusEnum.Printing ||
                        printJobData.JobStatus.JobStatus == (PrintJobStatusEnum.Paused | PrintJobStatusEnum.Printing))
                    {
                        XXX(printJobData, true);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogDebug(ex);
            }
        }
예제 #38
0
        public void Indicate(IntPtr pWbemClassObject)
        {
            Marshal.AddRef(pWbemClassObject);
            IWbemClassObjectFreeThreaded obj = new IWbemClassObjectFreeThreaded(pWbemClassObject);

            try

            {
                EventArrivedEventArgs args = new EventArrivedEventArgs(context, new ManagementBaseObject(obj));

                eventWatcher.FireEventArrived(args);
            }
            catch
            {
            }
        }
예제 #39
0
        void mgmtWtch_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
        {
            String processID   = e.NewEvent.Properties["ProcessID"].Value.ToString();
            String processName = e.NewEvent.Properties["ProcessName"].Value.ToString();

            #region Example to enumerate Properties
            //foreach (PropertyData pd in e.NewEvent.Properties)
            //{
            //    EventLog.WriteEntry(String.Format("{0} : {1}", pd.Name, pd.Value), EventLogEntryType.Warning);
            //}
            #endregion

            //EventLog.WriteEntry("Detected Process Start: " + processName + " Process ID:" + processID, EventLogEntryType.Warning);
            if (Matches(processName, blockedApp))
            {
                stopProcessByID(Convert.ToInt32(processID));
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mewPrintJobs_EventDeleted(object sender, System.Management.EventArrivedEventArgs e)
        {
            //if (ConfigData.Config_InterceptPrintJobAndCancel)
            //return;

            if (!_doWatching)
            {
                return;
            }

            try
            {
                // get arrived print job
                ManagementBaseObject printJob = (ManagementBaseObject)e.NewEvent.Properties["TargetInstance"].Value;
                if (printJob == null)
                {
                    return;
                }

                PrintJobData printJobData = new PrintJobData(printJob, _host);

                LogHelper.LogDebug(_host + " : " + printJobData.PrintJobTitle + " | " + printJobData.JobStatus);

                if (CanSkip2(printJobData))
                {
                    return;
                }

                lock (_titlesProcessed)
                    _titlesProcessed.RemoveTitle(printJobData);

                //lock (_allowedPrintersTitles)
                //_allowedPrintersTitles.RemoveTitle(printJobData);

                ResetSkip(printJobData);

                OnPrintJobCompleted(new PrintJobDataEventArgs(printJobData));
            }
            catch (Exception ex)
            {
                LogHelper.LogDebug(ex);
            }
        }
        /// Events
        #region Events

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mewPrintJobs_OperationSet(object sender, System.Management.EventArrivedEventArgs e)
        {
            string eventName = e.NewEvent.ClassPath.ClassName;

            switch (eventName)
            {
            case "__InstanceCreationEvent":
                mewPrintJobs_JobArrived(sender, e);
                break;

            case "__InstanceModificationEvent":
                mewPrintJobs_EventSet(sender, e);
                break;

            case "__InstanceDeletionEvent":
                mewPrintJobs_EventDeleted(sender, e);
                break;
            }
        }
 internal void FireEventArrived(EventArrivedEventArgs args)
 {
     try {
         delegateInvoker.FireEventToDelegates(EventArrived, args);
     } catch {}
 }
예제 #43
0
        void queryWatcher_EventArrived(object sender, EventArrivedEventArgs e)
        {
            var args = new BrokerObjectReadyEventArgs(e.NewEvent, this.ResultCount + 1);

            this.OnObjectReady(this, args);
        }
예제 #44
0
 void mw_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
 {
     Console.WriteLine("Link speed crossed threshold! ( " + th.Threshold_Val + " / " + th.Threshold_dir + ")");
     mw.Stop();
 }
 void watcher_EventArrived(object sender,
                           EventArrivedEventArgs args)
 {
     wmiLogged = true;
     wmiResult = args.NewEvent.GetText(TextFormat.Mof);
     wmiLogEntry = args.NewEvent;
 }