public OWAToolViewModel() { _mcdaExtension = MCDAExtension.GetExtension(); _owaTool = ToolFactory.NewOWATool(); _owaResultDataTable = _owaTool.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); // init stuff for the alpha selection // all commands are defined in this class and set here _alphaSelectionViewModel.CancelCommand = CancelAlphaSelectionCommand; _alphaSelectionViewModel.ApplyCommand = ApplyAlphaSelectionCommand; _alphaSelectionViewModel.OkayCommand = OkayAlphaSelectionCommand; }
private void SelectedFeaturePropertyChanged(object sender, PropertyChangedEventArgs e) { if (_isLocked) { return; } _owaTool = ToolFactory.NewOWATool(); _toolParameter = new BindingList <IToolParameter>(_owaTool.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) { _owaTool.Run(); _owaResultDataTable = _owaTool.Data; } } RegisterToolParameterEvents(); PropertyChanged.Notify(() => OWAParameter); PropertyChanged.Notify(() => OWAResult); CommandManager.InvalidateRequerySuggested(); }
private void FieldPropertyChanged(object sender, PropertyChangedEventArgs e) { if (_isLocked) { return; } _owaTool = ToolFactory.NewOWATool(); _toolParameter = new BindingList <IToolParameter>(_owaTool.ToolParameterContainer.ToolParameter); if (_selectedFeature.Fields.Count(f => f.IsSelected) >= 1) { _owaTool.Run(); _owaResultDataTable = _owaTool.Data; } RegisterToolParameterEvents(); PropertyChanged.Notify(() => OWAParameter); PropertyChanged.Notify(() => OWAResult); CommandManager.InvalidateRequerySuggested(); }