by Shani Raba
We are using the ArcGis Explorer as our 3d-Browser, and we would like to create a task.config file for each task. You can read more at my last post about Load config file dynamically (here).
Why this Architecture good for us?
Every one can install its explorer on his computer without any problem, we would like to add our own Task-Specific configurations for example: server-names to connect to, task-screen-size, links to web sites etc.
first, such details you cannot be save to the AGX-installation directory because it already installed. second, we would like to send them again and again every time the task will be updated and downloaded.
Any way, after reading this we still have two questions to answer:
1) how to get to the tasks directory
2) how to find our specific task
The answers for those questions are pretty simple:
1) To get to the task directory you should use this parameters:
1: Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\ESRI\ArcGIS Explorer\Tasks";
This answer will solve you the "how to found the tasks directory programmatically" but you’ll still have to find the specific task directory that is interesting you.
Anyway, this is good but not good enough. I would like the E2 API to give me its Environment parameters and not to force me to code it by myself. It smell like something that can be change… and I’ll be glad if the people at the ArcGis Explorer will create something like: public static class E2Environemnt which will implement such property. For now: we implement our own Environment extensions.
2) To Find the specific task you should dig the black box of E2 and you will find this cool factory:
1: ESRI.ArcGIS.E2API.E2TaskFactory factory = new ESRI.ArcGIS.E2API.E2TaskFactory();
2: string taskDirectoryName = factory.GetTaskSubfolderNameFromAssemblyName(currentTask);
So What’s the catch I’ve asked? This is an internal implementation, ESRI don’t like you if you’ll use it… (you can read more about my question in the AGX forum). And I will ask just one simple question, why?! why not to make it internal or even private class. why we should read it at the XML comments?!
And here is my preferred solution (as Rob answered in the ArcGis Explorer forum), it make the job for me right now and it is the simple way to do it: