public void RemoveNotify(string dir, NotifyEventHandler notify) { if (dir == null) { throw new NullReferenceException("dir"); } if (notify == null) { throw new NullReferenceException("notify"); } NotifyWrapper wrapper_to_remove = null; foreach (NotifyWrapper wrapper in wrapper_list) { if (wrapper.dir.Equals(dir) && wrapper.notify.Equals(notify)) { wrapper_to_remove = wrapper; break; } } // NOTE: For some unknown reason, the RemoveNotify call does not // work here. That is why we explicitly disable the wrapper, // since it will unfortunately continue to exist and get // inappropriately notified. if (wrapper_to_remove != null) { client.RemoveNotify(dir, wrapper_to_remove.HandleNotify); wrapper_to_remove.enabled = false; wrapper_list.Remove(wrapper_to_remove); } }
public void AddNotify (string dir, NotifyEventHandler notify) { if (dir == null) throw new NullReferenceException("dir"); if (notify == null) throw new NullReferenceException("notify"); NotifyWrapper wrapper = new NotifyWrapper (notify, dir); client.AddNotify (dir, wrapper.HandleNotify); wrapper_list.Add (wrapper); }
public void AddNotify(string dir, NotifyEventHandler notify) { if (dir == null) { throw new NullReferenceException("dir"); } if (notify == null) { throw new NullReferenceException("notify"); } NotifyWrapper wrapper = new NotifyWrapper(notify, dir); client.AddNotify(dir, wrapper.HandleNotify); wrapper_list.Add(wrapper); }