Esempio n. 1
0
 protected virtual void notifyListeners()
 {
     D.assert(this._debugAssertNotDisposed());
     if (this._listeners != null)
     {
         var localListeners = new List <VoidCallback>(this._listeners);
         foreach (VoidCallback listener in localListeners)
         {
             try {
                 if (this._listeners.Contains(listener))
                 {
                     listener();
                 }
             }
             catch (Exception ex) {
                 UIWidgetsError.reportError(new UIWidgetsErrorDetails(
                                                exception: ex,
                                                library: "foundation library",
                                                context: "while dispatching notifications for " + this.GetType(),
                                                informationCollector: information => {
                     information.AppendLine("The " + this.GetType() + " sending notification was:");
                     information.Append("  " + this);
                 }
                                                ));
             }
         }
     }
 }
Esempio n. 2
0
        protected virtual void notifyListeners()
        {
            D.assert(_debugAssertNotDisposed());
            if (_listeners != null)
            {
                var localListeners = new List <VoidCallback>(_listeners);
                foreach (VoidCallback listener in localListeners)
                {
                    try {
                        if (_listeners.Contains(listener))
                        {
                            listener();
                        }
                    }
                    catch (Exception ex) {
                        IEnumerable <DiagnosticsNode> infoCollector()
                        {
                            yield return(new DiagnosticsProperty <ChangeNotifier>(
                                             $"The {GetType()} sending notification was",
                                             this,
                                             style: DiagnosticsTreeStyle.errorProperty
                                             ));
                        }

                        UIWidgetsError.reportError(new UIWidgetsErrorDetails(
                                                       exception: ex,
                                                       library: "foundation library",
                                                       context: new ErrorDescription($"while dispatching notifications for {GetType()}"),
                                                       informationCollector: infoCollector
                                                       ));
                    }
                }
            }
        }