I coded a dockpane as an addin. a button clicked opens the dockpane.
when I click the x on the top-right corner, the dockpane is closed. when I close ArcGIS Pro after closing the dockpane using the x, the dockpane remains closed on starting ArcGIS Pro the next time. that's great.
I'd like to implement this as a function. meaning that some listener realises, that ArcGIS Pro is getting closed and closes the dockpane too. the dockpane remains closed when I open ArcGIS Pro again, but can be activated again using the button.
How can I implement such a listener, that checks if ArcGIS Pro gets closed?
Solved! Go to Solution.
Hi,
I am trying to catch project closing event in dock pane code:
/// <summary> /// Override to implement custom initialization code for this dockpane /// </summary> /// <returns></returns> protected override async Task InitializeAsync() { await base.InitializeAsync(); ProjectClosingEvent.Subscribe(OnProjectClosing); }
And on project closing execute code below:
private Task OnProjectClosing(ProjectClosingEventArgs args) { // if already cancelled, ignore if (args.Cancel) return Task.CompletedTask; var vm = FrameworkApplication.DockPaneManager.Find(_dockPaneID); if (vm != null) vm.Hide(); return Task.CompletedTask; }
Hi,
I am trying to catch project closing event in dock pane code:
/// <summary> /// Override to implement custom initialization code for this dockpane /// </summary> /// <returns></returns> protected override async Task InitializeAsync() { await base.InitializeAsync(); ProjectClosingEvent.Subscribe(OnProjectClosing); }
And on project closing execute code below:
private Task OnProjectClosing(ProjectClosingEventArgs args) { // if already cancelled, ignore if (args.Cancel) return Task.CompletedTask; var vm = FrameworkApplication.DockPaneManager.Find(_dockPaneID); if (vm != null) vm.Hide(); return Task.CompletedTask; }
would it be possible to force the dockpane and all its processes to stop/cancel when closing the dockpane using the "x" with a modification of this code? I know, I could use CacellationToken to force a task or method to cancel, but implementing that in every method is messy. it would be nice to just click the x and it forces the entire dockpane and its running tasks to cancel, but the project would remain open.