internal void FireProgress(ProgressEventArgs args) { try { this.delegateInvoker.FireEventToDelegates(this.Progress, args); } catch { } }
public void SetStatus(int flags, int hResult, string message, IntPtr pErrorObj) { CompletedEventArgs completedEventArg; IWbemClassObjectFreeThreaded wbemClassObjectFreeThreaded = null; if (pErrorObj != IntPtr.Zero) { Marshal.AddRef(pErrorObj); wbemClassObjectFreeThreaded = new IWbemClassObjectFreeThreaded(pErrorObj); } try { if (flags != 0) { if ((flags & 2) != 0) { ProgressEventArgs progressEventArg = new ProgressEventArgs(this.context, (hResult & -65536) >> 16, hResult & 0xffff, message); this.watcher.FireProgress(progressEventArg); } } else { if (this.path != null) { if (this.className != null) { this.path.RelativePath = this.className; } else { this.path.RelativePath = message; } if (this.InternalObjectPut != null) { try { InternalObjectPutEventArgs internalObjectPutEventArg = new InternalObjectPutEventArgs(this.path); this.InternalObjectPut(this, internalObjectPutEventArg); } catch { } } ObjectPutEventArgs objectPutEventArg = new ObjectPutEventArgs(this.context, this.path); this.watcher.FireObjectPut(objectPutEventArg); } if (wbemClassObjectFreeThreaded == null) { completedEventArg = new CompletedEventArgs(this.context, hResult, null); } else { completedEventArg = new CompletedEventArgs(this.context, hResult, new ManagementBaseObject(wbemClassObjectFreeThreaded)); } this.watcher.FireCompleted(completedEventArg); this.watcher.RemoveSink(this); } } catch { } }
public void SetStatus( int flags, int hResult, string message, IntPtr pErrorObj) { IWbemClassObjectFreeThreaded errObj = null; if (pErrorObj != IntPtr.Zero) { Marshal.AddRef(pErrorObj); errObj = new IWbemClassObjectFreeThreaded(pErrorObj); } try { if (flags == (int)tag_WBEM_STATUS_TYPE.WBEM_STATUS_COMPLETE) { // Is this a Put? If so fire the ObjectPut event if (null != path) { if (null == className) { path.RelativePath = message; } else { path.RelativePath = className; } // Fire the internal event (if anyone is interested) if (null != InternalObjectPut) { try { InternalObjectPutEventArgs iargs = new InternalObjectPutEventArgs(path); InternalObjectPut(this, iargs); } catch {} } ObjectPutEventArgs args = new ObjectPutEventArgs(context, path); watcher.FireObjectPut(args); } // Fire Completed event CompletedEventArgs args2 = null; if (errObj != null) { args2 = new CompletedEventArgs(context, hResult, new ManagementBaseObject(errObj) ); } else { args2 = new CompletedEventArgs(context, hResult, null ); } watcher.FireCompleted(args2); // Unhook and tidy up watcher.RemoveSink(this); } else if (0 != (flags & (int)tag_WBEM_STATUS_TYPE.WBEM_STATUS_PROGRESS)) { // Fire Progress event ProgressEventArgs args = new ProgressEventArgs(context, (int)(((uint)hResult & 0xFFFF0000) >> 16), hResult & 0xFFFF, message); watcher.FireProgress(args); } } catch {} }
internal void FireProgress(ProgressEventArgs args) { try { delegateInvoker.FireEventToDelegates(Progress, args); } catch {} }
public void SetStatus(int flags, int hResult, string message, IntPtr pErrorObj) { IWbemClassObjectFreeThreaded wbemObject = null; if (pErrorObj != IntPtr.Zero) { Marshal.AddRef(pErrorObj); wbemObject = new IWbemClassObjectFreeThreaded(pErrorObj); } try { if (flags == 0) { if (this.path != null) { if (this.className == null) { this.path.RelativePath = message; } else { this.path.RelativePath = this.className; } if (this.InternalObjectPut != null) { try { InternalObjectPutEventArgs e = new InternalObjectPutEventArgs(this.path); this.InternalObjectPut(this, e); } catch { } } ObjectPutEventArgs args2 = new ObjectPutEventArgs(this.context, this.path); this.watcher.FireObjectPut(args2); } CompletedEventArgs args3 = null; if (wbemObject != null) { args3 = new CompletedEventArgs(this.context, hResult, new ManagementBaseObject(wbemObject)); } else { args3 = new CompletedEventArgs(this.context, hResult, null); } this.watcher.FireCompleted(args3); this.watcher.RemoveSink(this); } else if ((flags & 2) != 0) { ProgressEventArgs args = new ProgressEventArgs(this.context, (hResult & -65536) >> 0x10, hResult & 0xffff, message); this.watcher.FireProgress(args); } } catch { } }