Select to view content in your preferred language

Close and open the current project

160
1
2 weeks ago
MichaelKohler
Frequent Contributor

Stupid question here😁

I'm trying to close and open the current project to reset the project for the Add-In. Nothing happens with the code as expected because the project is already open.

I have a "reset" function where i find all the elements in the Add-in and reset them. If the project could be "reloaded", it would be easier.

protected override void OnClick()
{
    var curProject = Project.Current;
    string projectPath = curProject.URI;
    Project.Current.SetDirty(false);
    openPrj(projectPath);
}

private async void openPrj(string projectPath) 
{
    await Project.OpenAsync(projectPath);
}

 

Thanks!

 

0 Kudos
1 Reply
CharlesMacleod
Esri Regular Contributor

Once a project is open, the application does not return to the "there is not a project open" state. That only occurs at start up. To "reset" a project/addin you would essentially have to open _another_ project and, from "that" project, re-open your desired one.

0 Kudos