Raba - Defend your code RSS 2.0
# Monday, February 11, 2008

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:

   1:  System.Reflection.Assembly.GetExecutingAssembly().Location;

Enjoy.

Monday, February 11, 2008 6:10:38 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net 2.0 | GIS | AGX | Software Development

Comments are closed.
Archive
<December 2014>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2014
Shani Raba
Sign In
Statistics
Total Posts: 146
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Themes
Pick a theme:
All Content © 2014, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)