public void Execute(object parameter) { ToolExecuting = true; try { toolView = new MyToolView() { Margin = new Thickness(10), MinWidth = 400, MinHeight = 400, HorizontalAlignment = HorizontalAlignment.Stretch }; toolView.Unloaded += toolViewOnUnloaded; // Updates tool DataContext with savedConfiguration. var toolViewModel = toolView.DataContext as MyConfigurationViewModel; if (toolViewModel == null) { toolViewModel = savedConfiguration != null ? new MyConfigurationViewModel(savedConfiguration) : new MyConfigurationViewModel(); toolView.DataContext = toolViewModel; } else if (savedConfiguration != null) { toolViewModel.ApplyChanges(savedConfiguration); } ... // Executes tool on click when there are no visible expression. if (toolViewModel.Execute.CanExecute(null)) toolViewModel.Execute.Execute(null); } catch (Exception e) { MapApplication.Current.ShowWindow("Error", new TextBlock() { Text = e.Message }); } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.