示例#1
0
文件: MacBase.cs 项目: CheckTech/Eto
 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);
 }
示例#2
0
文件: MacBase.cs 项目: CheckTech/Eto
 public NSObject AddObserver(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.AddToNotificationCenter();
     observers.Add(observer);
     return observer;
 }
示例#3
0
文件: MacBase.cs 项目: landytest/Eto
        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);
        }
示例#4
0
 public ObserverActionEventArgs(ObserverHelper observer, NSNotification notification)
 {
     this.observer     = observer;
     this.Notification = notification;
 }