+ Reply to Thread
Results 1 to 13 of 13

Thread: Add In Bookmark Example.

  1. #1
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Add In Bookmark Example.

    So I want to try and use the bookmarks add-in. I downloaded the sample and then tried to add it into my page using the settings/add-ins but that did not seem to work. So I saw something about having to compile or something. So I opened it up in VS 2010 and noticed right away I had some reference errors with the esri assemblies. So I just added those in using the Project/Add Reference/Browse (ex C:\Program Files (x86)\ESRI SDKs\Silverlight\v2.4\ESRI.ArcGIS.Client.Toolkit.dll).

    Now I get one on system.windows.interactivity. I tried to add it like the others but it was not located in the ("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\") like System.Windows.Browser.dll was. I did a search for that dll and found it (Expressions) and placed it in the folder but VS 2010 does not like it because I moved it. So then I took it out thinking I might not need it and now get a bunch of errors.

    So what all am I doing wrong here. Obviously I am a newbie at this.

  2. #2
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: Add In Bookmark Example.

    Yes, you need the System.Windows.Interactivity dll, but you can leave it in it's original folder and just Browse to that folder when adding the reference. I believe the default location is: C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries (or similar).

    For the Bookmark sample, I've actually uploaded the .xap file (add-in) to ArcGIS Online, so you can download it directly without having to compile it:
    http://www.arcgis.com/home/item.html...e39f37a2832ae9

    Katy
    Katy Dalton
    Esri Product Engineer

  3. #3
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    Quote Originally Posted by katydalton View Post
    Yes, you need the System.Windows.Interactivity dll, but you can leave it in it's original folder and just Browse to that folder when adding the reference. I believe the default location is: C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries (or similar).

    For the Bookmark sample, I've actually uploaded the .xap file (add-in) to ArcGIS Online, so you can download it directly without having to compile it:
    http://www.arcgis.com/home/item.html...e39f37a2832ae9

    Katy
    Nice but I would still like to be able to edit this add-in. Once I have this running in Visual Studio will I be to add the bookmarks I want to the widget via code. This is what I really want to do. I need to be able to send users to different districts using bookmarks/dropdown whatever with a name and then the Web Mercator coordinate system information.


    As for Visual Studio and the System.Windows.Interactivity dll. The only one I find gives me an error that it does not belong with silverlight. Please see screen shot below. Thanks for all of your help. This is very exciting.


    Click image for larger version

Name:	Bookmarks.png
Views:	49
Size:	101.5 KB
ID:	13829

  4. #4
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    So I found this code in tools.xml

    <Bookmark.MapBookmark>
    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
    <d3p1:spatialReference>
    <d3p1:wkid>102100</d3p1:wkid>
    </d3p1:spatialReference>
    <d3p1:xmax>-13045320.775415432</d3p1:xmax>
    <d3p1:xmin>-13047143.032605518</d3p1:xmin>
    <d3p1:ymax>4036870.6724080243</d3p1:ymax>
    <d3p1:ymin>4036096.2954827617</d3p1:ymin>
    </Extent>
    <Name>Esri</Name>
    </Bookmark.MapBookmark>

    And tried adding in my own creating the code from ArcGIS Desktop. Will this work once we solve my reference issue. What is "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry"

    <Bookmark.MapBookmark>
    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
    <d3p1:spatialReference>
    <d3p1:wkid>102100</d3p1:wkid>
    </d3p1:spatialReference>
    <d3p1:xmax>-12924841.7103843</d3p1:xmax>
    <d3p1:xmin>-13687125.6273765</d3p1:xmin>
    <d3p1:ymax>6062311.60890295</d3p1:ymax>
    <d3p1:ymin>5402975.31369014</d3p1:ymin>
    </Extent>
    <Name>Portland</Name>
    </Bookmark.MapBookmark>

  5. #5
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: Add In Bookmark Example.

    Hi Michael,

    It sounds like maybe you need to install the Expression Blend SDK to get the proper dll. Do you have that installed already?

    Katy
    Katy Dalton
    Esri Product Engineer

  6. #6
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.


    Quote Originally Posted by katydalton View Post
    Hi Michael,

    It sounds like maybe you need to install the Expression Blend SDK to get the proper dll. Do you have that installed already?

    Katy
    I feels like one foot forward and two steps behind at the current moment. So I got it to compile without any errors however when I go to upload it I get this error now with application builder. Were getting closer. I'm getting an error after this that says value does not fall within acceptable range:

    at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
    at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
    at MS.Internal.XcpImports.Collection_Add[T](PresentationFrameworkCollection`1 collection, Object value)
    at System.Windows.PresentationFrameworkCollection`1.AddImpl(Object value)
    at System.Windows.Controls.ItemCollection.AddImpl(Object value)
    at System.Windows.Controls.ItemCollection.AddInternal(Object value)
    at ESRI.ArcGIS.Mapping.Builder.Controls.AvailableToolbarItemsControl.buildAddItemTree()
    at ESRI.ArcGIS.Mapping.Builder.MainPage.Settings_ExtensionsCatalogChanged(Object sender, EventArgs e)
    at ESRI.ArcGIS.Mapping.Builder.Settings.ExtensionsCatalog_Changed(Object sender, EventArgs e)
    at ESRI.ArcGIS.Mapping.Builder.ExtensionsManager.OnExtensionsCatalogChanged(EventArgs args)
    at ESRI.ArcGIS.Mapping.Builder.ExtensionsManager.extensionsProvider_LoadAdditionalExtensionCompleted(Object sender, EventArgs e)
    at ESRI.ArcGIS.Mapping.Core.ExtensionsManager.<>c__DisplayClass8.<LoadAdditionalExtension>b__6(Object s, OpenReadCompletedEventArgs e)
    at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
    at System.Net.WebClient.OpenReadOperationCompleted(Object arg)


    Click image for larger version

Name:	Bookmarks.png
Views:	41
Size:	185.3 KB
ID:	13841
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Bookmarks.png‎
Views:	32
Size:	176.0 KB
ID:	13840  
    Last edited by flfmmqp; 04-26-2012 at 08:34 AM.

  7. #7
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    Ha I think I have it working but how can I edit it so that I can put in my own generic zooms.

    So I found this code in tools.xml

    <Bookmark.MapBookmark>
    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
    <d3p1:spatialReference>
    <d3p1:wkid>102100</d3p1:wkid>
    </d3p1:spatialReference>
    <d3p1:xmax>-13045320.775415432</d3p1:xmax>
    <d3p1:xmin>-13047143.032605518</d3p1:xmin>
    <d3p1:ymax>4036870.6724080243</d3p1:ymax>
    <d3p1:ymin>4036096.2954827617</d3p1:ymin>
    </Extent>
    <Name>Esri</Name>
    </Bookmark.MapBookmark>

    I tried adding in my own creating the code from ArcGIS Desktop. Will this work once we solve my reference issue. What is "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry"

    <Bookmark.MapBookmark>
    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
    <d3p1:spatialReference>
    <d3p1:wkid>102100</d3p1:wkid>
    </d3p1:spatialReference>
    <d3p1:xmax>-12924841.7103843</d3p1:xmax>
    <d3p1:xmin>-13687125.6273765</d3p1:xmin>
    <d3p1:ymax>6062311.60890295</d3p1:ymax>
    <d3p1:ymin>5402975.31369014</d3p1:ymin>
    </Extent>
    <Name>Portland</Name>
    </Bookmark.MapBookmark>

  8. #8
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: Add In Bookmark Example.

    Hi Michael,

    The initial warning messages you see are simply warnings. To remove this warning, return to your Visual Studio solution and make sure that Copy Local=False for the references specified in the dialog box.

    I'm not sure about the second error you are receiving. Can you try including the add-in in its default state (that is, without any edits to the Tools.xml file).

    Also, for the "http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry", see http://msdn.microsoft.com/en-us/library/ms731045.aspx.

    Katy
    Last edited by katydalton; 04-27-2012 at 09:12 AM.
    Katy Dalton
    Esri Product Engineer

  9. #9
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    Hey Katie:

    Thanks for the reply. I've gotten the bookmarks example to work thanks to your help. What I am trying to do now is to be able to have some default bookmarks added for the user. We have 70 districts and I have the needed information in webmercator to have them zoom to these areas. I saw in the tools.xml you guys look like you have some default locations already. I'm just not sure how to get my bookmarks to see these. I don't understand why we have a .web and .addins as part of the solutions. Should I be using something else besides the .addins xap file? I would be estatic if you could help me get these district locations into the bookmarks. I can create whatever code is need from my side.

    Michael

  10. #10
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: Add In Bookmark Example.

    Hi Michael,

    From our help:

    Visual Studio solutions created from the Viewer template will include three projects. In the list below, <Project Name> means the name of the project as specified on the New Project dialog box. The projects created as part of the template are as follows:
    •<Project Name>—This is a website project containing a fully functional Viewer application. This contains a copy of all the configuration files that are included with the Viewer. When you compile the solution, the output from the AddIns project and the layouts in the Layouts project are automatically copied to this website.
    •<Project Name>.AddIns—Contains a simple tool and behavior to get you started writing your own add-in. See Creating a Tool and Creating a Behavior for further details.
    •<Project Name>.Layouts—Contains a copy of the default layouts that are deployed with the Viewer. You can open these in Visual Studio or Expression Blend to modify their design or create new layouts.

    You won't be able to edit the Tools.xml file directly to add the bookmarks; instead, you'll need to write some code on your end to allow entering of coordinates. (Enter coordinates, zoom to location, create bookmark, etc.). :-)

    Katy
    Katy Dalton
    Esri Product Engineer

  11. #11
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    Quote Originally Posted by katydalton View Post
    Hi Michael,

    From our help:

    You won't be able to edit the Tools.xml file directly to add the bookmarks; instead, you'll need to write some code on your end to allow entering of coordinates. (Enter coordinates, zoom to location, create bookmark, etc.). :-)

    Katy
    Thanks Katy but this takes the level of ease from about a 3 to about a 9 :-( Not exactly what we were shooting for with the Viewer application. As reference I was able to do this pretty easiliy with the Flex Viewer Application. With just this line of code that got created in ArcGIS. <bookmark name="Arizona">-112.38977 30.7464496467391 -106.38002 36.2270803532609</bookmark>. This is such a great application but in a couple of areas just disappoints. Creating bookmarks is a basic functionality.

  12. #12
    Rich Zwaap
    Join Date
    Mar 2010
    Posts
    77
    Points
    44
    Answers Provided
    5


    0

    Default Re: Add In Bookmark Example.

    Hi Michael:

    Here's the process for creating a Viewer containing the tool and editing bookmarks in the config file.
    1. Don't use Visual Studio and the Viewer template (i.e. the sample from the SDK). Use the Application Builder. The template is for developing your own add-ins. You are not doing that here, but rather just looking to load, configure, and use an existing example.
    2. Download the pre-compiled xap containing the Bookmarks tool from here.
    3. Open the Application Builder
    4. Upload the pre-compiled add-in to Application Builder
    5. Create a new Viewer application
    6. Add the Bookmarks tool using the Add Tool button on the Tools tab
    7. In the Bookmarks configuration, the last page is for defining bookmarks. The tool is designed for you to add bookmarks interactively at this point, by defining a name, zooming/panning to the desired bookmark extent, and clicking Add. In your case, since this does not work for your existing workflow, input a dummy bookmark and click OK
    8. Deploy the application
    9. Navigate to the folder containing the deployed app on disk. With default installations of IIS and the Viewer, this would be c:\inetpub\wwwroot\apps\<app name>
    10. Navigate to the config folder. This contains Tools.xml and the other Viewer configuration files
    11. Open the Tools.xml file and find the Bookmarks tool. It sounds like you already found this in the Tools.xml file in the Viewer template - it will look the same here as well.
    12. Replace the dummy bookmark with your set of bookmarks. You had the right format in your previous post. So the whole tool's markup should look something like this:
      Code:
      <Tool Label="Bookmarks" Icon="/Bookmarks.AddIns;component/Images/Bookmark16.png" Description="View bookmarks in the map">
          <Tool.Class>
              <Bookmarks_AddIns:BookmarksTool />
          </Tool.Class>
          <Tool.ConfigData>
              <ArrayOfBookmark.MapBookmark xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Toolkit">
      
                  <!-- First Bookmark -->
                  <Bookmark.MapBookmark>
                      <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                      <d3p1:spatialReference>
                          <d3p1:wkid>102100</d3p1:wkid>
                      </d3p1:spatialReference>
                      <d3p1:xmax>-5753581.5</d3p1:xmax>
                      <d3p1:xmin>-15499612</d3p1:xmin>
                      <d3p1:ymax>7454065.7724409448</d3p1:ymax>
                      <d3p1:ymin>1890386.9437007876</d3p1:ymin>
                      </Extent>
                      <Name>Test</Name>
                  </Bookmark.MapBookmark>
      
                  <!-- Second Bookmark -->
                  <Bookmark.MapBookmark>
                      <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                          <d3p1:spatialReference>
                              <d3p1:wkid>102100</d3p1:wkid>
                          </d3p1:spatialReference>
                          <d3p1:xmax>-4754581.5</d3p1:xmax>
                          <d3p1:xmin>-14499612</d3p1:xmin>
                          <d3p1:ymax>7454065.7724409448</d3p1:ymax>
                          <d3p1:ymin>1890386.9437007876</d3p1:ymin>
                      </Extent>
                      <Name>Test 2</Name>
                  </Bookmark.MapBookmark>
              </ArrayOfBookmark.MapBookmark>
          </Tool.ConfigData>
      </Tool>
    13. Save and close Tools.xml
    14. Open Application.xml and increment the number contained in the <Version> tag. This will keep users from needing to clear their browser cache to see the changes you make in the config file.

    Hope this helps.
    Rich Zwaap
    Software Developer
    ArcGIS Runtime SDK for .NET, ArcGIS Viewer for Silverlight

  13. #13
    Michael Pickens
    Join Date
    Apr 2011
    Posts
    40
    Points
    0
    Answers Provided
    0


    0

    Default Re: Add In Bookmark Example.

    Genius. I knew that tools.xml had to do something. Fantastic answer. This should be helpful to many people. Now one more small favor. Since I have like 80 of these bookmarks created the box is really big on my screen. How can I contain that? I'm very excited about this.

    This is the sort of stuff that really needs to be taught in a GIS Silverlight Viewer Class at the conference. Hint Hint. I'm going to have to look at that apps folder a little more closely now.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts