<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Execute Tool from a Behavior in ArcGIS Viewer for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316493#M945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Brian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the code from the query tool (publised by SLDevTem) as base for another add-in that I wrote. They have some really nice code in the project&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=451259f8e47440f2b727442fe1b2f7c2" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=451259f8e47440f2b727442fe1b2f7c2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My tool runs once the button is clicked (Execute function). Assume that same should be possible with behaviour&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example code from QueryTool project:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public void Execute(object parameter)
{
 ToolExecuting = true;
 try
 {
&amp;nbsp; toolView = new MyToolView()
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; Margin = new Thickness(10),
&amp;nbsp;&amp;nbsp; MinWidth = 400,
&amp;nbsp;&amp;nbsp; MinHeight = 400,
&amp;nbsp;&amp;nbsp; HorizontalAlignment = HorizontalAlignment.Stretch
&amp;nbsp; };
&amp;nbsp; toolView.Unloaded += toolViewOnUnloaded;

&amp;nbsp; // Updates tool DataContext with savedConfiguration.
&amp;nbsp; var toolViewModel = toolView.DataContext as MyConfigurationViewModel;
&amp;nbsp; if (toolViewModel == null)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; toolViewModel = savedConfiguration != null ? new MyConfigurationViewModel(savedConfiguration) : new MyConfigurationViewModel();
&amp;nbsp;&amp;nbsp; toolView.DataContext = toolViewModel;
&amp;nbsp; }
&amp;nbsp; else if (savedConfiguration != null)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; toolViewModel.ApplyChanges(savedConfiguration);
&amp;nbsp; }
...

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Executes tool on click when there are no visible expression.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (toolViewModel.Execute.CanExecute(null))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toolViewModel.Execute.Execute(null);
 }
 catch (Exception e)
 {
&amp;nbsp; MapApplication.Current.ShowWindow("Error", new TextBlock() { Text = e.Message });
 }
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:03:03 GMT</pubDate>
    <dc:creator>PietaSwanepoel2</dc:creator>
    <dc:date>2021-12-11T15:03:03Z</dc:date>
    <item>
      <title>Execute Tool from a Behavior</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316489#M941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I have a custum add-in that I build to query a service and return results to the map. While useful in one application by clicking a button to execute, I am looking to utilize the same tool in another app but this time I need it to automatically run the tool when the map opens. I am not sure what is the best way to go about this? Can I use a behavior to launch the tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason I want to use the tool is I also want the user to be able to close after the first launch and have the ability to re-open the tool and change the query to re-run at anytime.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I appreciate any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 12:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316489#M941</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2013-09-05T12:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Tool from a Behavior</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316490#M942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;YourTool.Execute("") assuming the execute is public.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2013 14:46:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316490#M942</guid>
      <dc:creator>brettangel</dc:creator>
      <dc:date>2013-09-16T14:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Tool from a Behavior</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316491#M943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I think I may be getting closer. I reference my add-in tools dll in my new behavior project. I can call te execute method but it is looking for an object parameter. I am not sure what to put here. I tried using null but When the behavior runs it says the parameter is missing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 13:22:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316491#M943</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2013-09-26T13:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Tool from a Behavior</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316492#M944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well i was able to get the execute method to run from the behavior but it appears all the elements of the tool are not initializing. I have a viewmodel that is supposed to query some data sources and populate combo boxes but that is not working.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 14:28:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316492#M944</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2013-09-26T14:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Tool from a Behavior</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316493#M945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Brian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the code from the query tool (publised by SLDevTem) as base for another add-in that I wrote. They have some really nice code in the project&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=451259f8e47440f2b727442fe1b2f7c2" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=451259f8e47440f2b727442fe1b2f7c2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My tool runs once the button is clicked (Execute function). Assume that same should be possible with behaviour&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example code from QueryTool project:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public void Execute(object parameter)
{
 ToolExecuting = true;
 try
 {
&amp;nbsp; toolView = new MyToolView()
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; Margin = new Thickness(10),
&amp;nbsp;&amp;nbsp; MinWidth = 400,
&amp;nbsp;&amp;nbsp; MinHeight = 400,
&amp;nbsp;&amp;nbsp; HorizontalAlignment = HorizontalAlignment.Stretch
&amp;nbsp; };
&amp;nbsp; toolView.Unloaded += toolViewOnUnloaded;

&amp;nbsp; // Updates tool DataContext with savedConfiguration.
&amp;nbsp; var toolViewModel = toolView.DataContext as MyConfigurationViewModel;
&amp;nbsp; if (toolViewModel == null)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; toolViewModel = savedConfiguration != null ? new MyConfigurationViewModel(savedConfiguration) : new MyConfigurationViewModel();
&amp;nbsp;&amp;nbsp; toolView.DataContext = toolViewModel;
&amp;nbsp; }
&amp;nbsp; else if (savedConfiguration != null)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; toolViewModel.ApplyChanges(savedConfiguration);
&amp;nbsp; }
...

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Executes tool on click when there are no visible expression.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (toolViewModel.Execute.CanExecute(null))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toolViewModel.Execute.Execute(null);
 }
 catch (Exception e)
 {
&amp;nbsp; MapApplication.Current.ShowWindow("Error", new TextBlock() { Text = e.Message });
 }
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:03:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-silverlight-questions/execute-tool-from-a-behavior/m-p/316493#M945</guid>
      <dc:creator>PietaSwanepoel2</dc:creator>
      <dc:date>2021-12-11T15:03:03Z</dc:date>
    </item>
  </channel>
</rss>

