private void FieldPropertyChanged(object sender, PropertyChangedEventArgs e) { if (_isLocked) { return; } _wlcTool = ToolFactory.NewWLCTool(); _toolParameter = new BindingList <IToolParameter>(_wlcTool.ToolParameterContainer.ToolParameter); if (_selectedFeature.Fields.Count(f => f.IsSelected) >= 1) { _wlcTool.Run(); _wlcResultDataTable = _wlcTool.Data; } RegisterToolParameterEvents(); PropertyChanged.Notify(() => WLCParameter); PropertyChanged.Notify(() => WLCResult); CommandManager.InvalidateRequerySuggested(); }
public WLCToolViewModel() { _mcdaExtension = MCDAExtension.GetExtension(); _wlcTool = ToolFactory.NewWLCTool(); _wlcResultDataTable = _wlcTool.Data; _selectedFeaturePropertyChangedEventHandler = _mcdaExtension.RegisterPropertyHandler(x => x.SelectedFeature, SelectedFeaturePropertyChanged); //we have to call our own update method to make sure we have a result column SelectedFeaturePropertyChanged(this, null); }
private void SelectedFeaturePropertyChanged(object sender, PropertyChangedEventArgs e) { if (_isLocked) { return; } _wlcTool = ToolFactory.NewWLCTool(); _toolParameter = new BindingList <IToolParameter>(_wlcTool.ToolParameterContainer.ToolParameter); if (_selectedFeature != null) { foreach (var currentField in _selectedFeature.Fields) { currentField.UnRegisterPropertyHandler(_listOfpropertyChangedEventHandlersForFieldIsSelected); } } _selectedFeature = _mcdaExtension.SelectedFeature; if (_selectedFeature != null) { foreach (var currentField in _selectedFeature.Fields) { _listOfpropertyChangedEventHandlersForFieldIsSelected.Add( currentField.RegisterPropertyHandler(f => f.IsSelected, FieldPropertyChanged)); } if (_selectedFeature.Fields.Count(f => f.IsSelected) >= 1) { _wlcTool.Run(); _wlcResultDataTable = _wlcTool.Data; } } RegisterToolParameterEvents(); PropertyChanged.Notify(() => WLCParameter); PropertyChanged.Notify(() => WLCResult); CommandManager.InvalidateRequerySuggested(); }