无法分配到'方法'因为它是一个'方法组

时间:2015-04-24 06:23:36

标签: c#

我无法运行我的代码,因为有错误说:

  

无法分配到' OnNewLand'因为它是一个'方法组

这很奇怪,因为我使用了与其他方法相同的结构,并且它们没有问题。 这是我的代码。

.txt
  

无法分配到' OnNewLand'因为它是一个'方法组

我的另一个窗口:

 private void CreateNewFlight()
        {
            string flightCode = ReadFlightCode();

            //Create the new bidder
            if (!string.IsNullOrEmpty(flightCode))
            {
                FlightWindow frm = new FlightWindow(Flightcode.Text);
                frm.Show();

                //Subscribe to the publisher's new bid and quit bid events
                frm.NewStart += OnNewStartClick;
                frm.NewChangeRoute += OnNewChangeRoute;
                frm.OnNewLand += OnNewLand; <----Here is the error <-------
            }
        }

1 个答案:

答案 0 :(得分:2)

你需要

app.directive('pauseChildrenWatchersIf', function(){
    return {
        link: function (scope, element, attrs) {

            scope.$watch(attrs.pauseChildrenWatchersIf, function (newVal) {
                if (newVal === undefined) {
                    return;
                }
                if (newVal) {
                    toggleChildrenWatchers(element, true)
                } else {
                    toggleChildrenWatchers(element, false)
                }
            });
            function toggleChildrenWatchers(element, pause) {
                angular.forEach(element.children(), function (childElement) {
                    toggleAllWatchers(angular.element(childElement), pause);
                });
            }

            function toggleAllWatchers(element, pause) {
                var data = element.data();
                if (data.hasOwnProperty('$scope') && data.$scope.hasOwnProperty('$$watchers') && data.$scope.$$watchers) {
                    if (pause) {
                        data._bk_$$watchers = [];
                        $.each(data.$scope.$$watchers, function (i, watcher) {
                            data._bk_$$watchers.push($.extend(true, {}, watcher))
                        });

                        data.$scope.$$watchers = [];
                    } else {
                        if (data.hasOwnProperty('_bk_$$watchers')) {
                            $.each(data._bk_$$watchers, function (i, watcher) {
                                data.$scope.$$watchers.push($.extend(true, {}, watcher))
                            });
                        }
                    }

                }
                toggleChildrenWatchers(element, pause);
            }
        }
    }
});

而不是

frm.OnNewLand += NewLand;

您可能有兴趣知道方法组的含义。请访问this以便线索。