Пример #1
0
        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;
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }