Exemplo n.º 1
0
 public void AddControlObserver(NSString key, Action<ObserverActionEventArgs> action, NSObject control)
 {
     if (observers == null)
         observers = new List<ObserverHelper>();
     var observer = new ObserverHelper
     {
         Action = action,
         KeyPath = key,
         Control = control,
         Widget = Widget,
         Handler = this
     };
     observer.AddToControl();
     observers.Add(observer);
 }
Exemplo n.º 2
0
        public void AddControlObserver(NSString key, Action <ObserverActionEventArgs> action, NSObject control)
        {
            if (observers == null)
            {
                observers = new List <ObserverHelper>();
                // ensure we finalize to clean this up later
                GC.ReRegisterForFinalize(this);
            }
            var observer = new ObserverHelper
            {
                Action  = action,
                KeyPath = key,
                Control = control,
                Widget  = Widget,
                Handler = this
            };

            observer.AddToControl();
            observers.Add(observer);
        }