コード例 #1
0
        private void subscribeArea(IArea area)
        {
            var areaBinding     = area.Bind <IAreaComponent>(c => c.PropertyChanged += _onAreaPropertyChangedCallback, c => c.PropertyChanged -= _onAreaPropertyChangedCallback);
            var scaleBinding    = area.Bind <IScalingArea>(c => c.PropertyChanged += _onScalingAreaChangedCallback, c => c.PropertyChanged -= _onScalingAreaChangedCallback);
            var restrictBinding = area.Bind <IAreaRestriction>(c =>
            {
                c.RestrictionList.OnListChanged.Subscribe(_onAreaRestrictionListChangedCallback);
                c.PropertyChanged += _onAreaRestrictionChangedCallback;
            }, c =>
            {
                c.RestrictionList.OnListChanged.Unsubscribe(_onAreaRestrictionListChangedCallback);
                c.PropertyChanged -= _onAreaRestrictionChangedCallback;
            });
            var bindings = _areaBindings.GetOrAdd(area.ID, () => new List <IComponentBinding>());

            bindings.Add(scaleBinding);
            bindings.Add(areaBinding);
            bindings.Add(restrictBinding);
        }