Select to view content in your preferred language

Template Gallery look and feel

666
4
03-15-2011 07:31 AM
ChristineZeller
Occasional Contributor
Hello,

This is kind of a strange request but I was wondering if there was an example (code snips) of how ESRI built the template gallery?  Here's the link:

http://help.arcgis.com/en/webapi/silverlight/samples/TemplateGalleryWeb/start.htm

Basically I have several applications for internal use at my organization and wanted to create a one stop starting place to launch the applications.  The end user would be able to view them like you can at the template gallery, maybe I could add a little description at the bottom, and then my users would be able to launch the app they want (I don't need the download option of course). 

So I was wondering if there was something out there that I could look at (code) maybe on ESRI site or a Silverlight site?

Thanks
Chris
0 Kudos
4 Replies
RexHansen
Esri Contributor
Unfortunately the source code for the Template Gallery is not available at this time.  We'll consider providing this in the future.  In the meantime you may want to take a look at some cover flow implementations in Silverlight (e.g. http://silverlightcoverflow.codeplex.com/).
0 Kudos
ChristineZeller
Occasional Contributor
Cool thanks Rex!
0 Kudos
ChristineZeller
Occasional Contributor
Rex or ESRI team,
Thanks a bunch for the link. Very cool. I did some customization and basically got the app working for me but I was hoping to ask one question and I know it is not ESRI API silverlight related but I thought I could ask in hopes you are feeling kind.

So the template was pointing to this xml file
http://www.apple.com/trailers/home/xml/current.xml
And this is how all the movie icons and information was getting binded to the application.

So I wrote my own xml and bound my own information about my websites and icons/pictures of my websites.

Everything works great when I launch the app from VS 2010 but when I launch the app outside of VS just using Mozilla or I.E the app can't find my xml file. I just place it in the CoverFlowWeb directory.

So in xaml.cs file there is this code where it is pointing to the xml file First Red line and it is erroring out at the second Red line. Do I need to place my xml file in a special place (virtual directory) Currently everything is on one maching so I thought it would be able to access it.

 void MainPage_Loaded(object sender, RoutedEventArgs e)
        {

            WebClient webClient = new WebClient();
            webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
            Uri xmlUri = new Uri(HtmlPage.Document.DocumentUri, "GetTrailersXml.ashx");
            webClient.DownloadStringAsync(xmlUri);

        }

        void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("There was an error retrieving xml");
                return;
            }
            XDocument xDoc = XDocument.Parse(e.Result);
            foreach (XElement xMovieInfo in xDoc.Descendants("movieinfo"))
            {
                try
                {
                    MovieTrailer trailer = new MovieTrailer(xMovieInfo);
                    trailers.Add(trailer);
                }
                catch { }
            }
            AssignItems();
            loadingControl.Visibility = Visibility.Collapsed;
            slider.Focus();
        }



Thanks
Chris
0 Kudos
ChristineZeller
Occasional Contributor
Hey sorry to hammer the ESRI team about this...I know it is more of SL issue but I'm not really getting any where on the MS forums so....

On the code plex there is a discussion area, which the creator has not commented on the other problems for over a year and it sounds like others have had similar issues but no explanation on how to fix them.  One person mention
"The application is a .Net application and requires a webserver to run the .Net part.  There is an error retrieving the xml because it uses an asmx webservice to download the movie trailer xml data from apple.com and then caches it.  So if you are not running from a web server then it will not be able to run the .Net code."

But I think I am running a web server right? I have IIS installed.  If i'm using the apple xml file or my own and run it through VS 2010 debug it works and fires but if it is not through VS just through a browser I get the error.

I'm wondering why it can make the connection when I launch debug from VS 2010 but it can't when I go directly through the web browser.  Obviously when I launch through VS my web address looks something like http://localhost:52703/Default.html and when I go through a browser I'm typing in http://servername/AppFinder/CoverFlowWeb/Default.html


Can someone suggestion something else or sheds some more light on this...I've spent days trying to get it to run from the browser and can't.

Thanks
Christine
0 Kudos