Exemplo n.º 1
0
        private void FieldPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (_isLocked)
            {
                return;
            }

            _lwlcTool = ToolFactory.NewLWLCTool();

            _lwlcResultDataTable = _lwlcTool.Data;

            if (_selectedFeature.Fields.Count(f => f.IsSelected) >= 1)
            {
                _toolParameter = new BindingList <IToolParameter>(_lwlcTool.ToolParameterContainer.ToolParameter);

                //ProgressDialog.ShowProgressDialog("Running LWLC Tool", (Action) _lwlcTool.Run);
                ProgressDialogBuilder progressDialogBuilder = new ProgressDialogBuilder((Action <ProgressHandler>)_lwlcTool.Run);
                progressDialogBuilder.SetTitle("Running LWLC Tool").Build().Show();
            }
            else
            {
                RegisterToolParameterEvents();
            }

            PropertyChanged.Notify(() => LWLCParameter);
            PropertyChanged.Notify(() => LWLCResult);

            CommandManager.InvalidateRequerySuggested();
        }
Exemplo n.º 2
0
        private void SelectedFeaturePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (_isLocked)
            {
                return;
            }

            _lwlcTool = ToolFactory.NewLWLCTool();

            _toolParameter = new BindingList <IToolParameter>(_lwlcTool.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)
                {
                    //ProgressDialog.ShowProgressDialog("Running LWLC Tool", (Action)_lwlcTool.Run);

                    ProgressDialogBuilder progressDialogBuilder = new ProgressDialogBuilder((Action <ProgressHandler>)_lwlcTool.Run);
                    progressDialogBuilder.SetTitle("Running LWLC Tool").Build().Show();

                    _lwlcResultDataTable = _lwlcTool.Data;
                }
            }

            RegisterToolParameterEvents();

            PropertyChanged.Notify(() => LWLCParameter);
            PropertyChanged.Notify(() => LWLCResult);

            CommandManager.InvalidateRequerySuggested();
        }
Exemplo n.º 3
0
        public LWLCToolViewModel()
        {
            _mcdaExtension = MCDAExtension.GetExtension();

            _lwlcTool = ToolFactory.NewLWLCTool();

            _lwlcResultDataTable = _lwlcTool.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 neighborhood selection
            // all commands are defined in this class and set here
            _neighborhoodSelectionViewModel.OkayCommand   = OkayNeighborhoodSelectionCommand;
            _neighborhoodSelectionViewModel.CancelCommand = CancelNeighborhoodSelectionCommand;
            _neighborhoodSelectionViewModel.ApplyCommand  = ApplyNeighborhoodSelectionCommand;

            _neighborhoodSelectionViewModel.SelectedNumberOfKNearestNeighbors             = 3;
            _neighborhoodSelectionViewModel.SelectedNumberOfKNearestNeighborsForAutomatic = 3;
        }