So, you need to set the active category on the active analysis shown in the NAWindow.
To start, here is a bit of code to get the EngineNetworkAnalystEnvironment:
public static IEngineNetworkAnalystEnvironment GetTheEngineNetworkAnalystEnvironment()
{
// The network analyst environment is a singleton, and must be accessed using the System.Activator
System.Type t = System.Type.GetTypeFromProgID("esriControls.EngineNetworkAnalystEnvironment");
var naEnv = System.Activator.CreateInstance(t) as IEngineNetworkAnalystEnvironment;
return naEnv;
}
Use that (along with a NALayer) to set your active analysis layer:
// Set the active Analysis layer
IEngineNAWindow naWindow = naEnv.NAWindow;
if (naWindow.ActiveAnalysis != naLayer) naWindow.ActiveAnalysis = naLayer;
At that point, you should be able to set the active category by clicking on it in the NAWindow during application runtime.
Does this work for you? You can set the category programmatically, but I'm not sure it is necessary in your case. Once the naWindow is open, has an active analysis in it, and has an active category selected, the add location tool should work as you expect it to.