<?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: Handle discard for map tool in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317748#M10172</link>
    <description>&lt;P&gt;any suggestion&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2023 23:57:47 GMT</pubDate>
    <dc:creator>CarlosK</dc:creator>
    <dc:date>2023-08-10T23:57:47Z</dc:date>
    <item>
      <title>Handle discard for map tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317420#M10170</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;In my map tool, there is another map tool inside it for selecting different features just like in many custom tools in Pro for map selection. And then it also contains other controls for my map tool. By default when my tool is opened this map selection tool is made active therefore when my tool is opened map selection tool will always be active. After my actual tool executed its work data is in edit and also same data is reflected in my tool’s UI. But what if user instead of save ,will discard the changes.&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;So I can subscribe to EditCompletedEvent and check if operation type is discard then I will come to know discard button is pressed. Now what I want is to update the UI again as per the map selection at that time and those new edited changes should be removed from the UI. &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;I thought that I will check &amp;nbsp;if the active tool is my tool on discard and then process the load of my tool once again based on the map selection and it will update the UI by removing the edit changes. But the problem is when my tool is opened it can never be the active tool since map selection tool inside my tool will be active tool always.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Can someone guide me how to handle discard in this scenario so that UI should be updated?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/9021"&gt;@UmaHarano&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 15:44:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317420#M10170</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2023-08-10T15:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Handle discard for map tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317748#M10172</link>
      <description>&lt;P&gt;any suggestion&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 23:57:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317748#M10172</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2023-08-10T23:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Handle discard for map tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317803#M10173</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your tool pattern seems to be too complex. I suggest you to write your own tool for map selection using &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Exploration#maptool" target="_self"&gt;MapTool&lt;/A&gt; or &lt;A href="https://github.com/kataya/arcgis-pro-sdk/wiki/ProGuide-Using-Embeddable-Controls" target="_self"&gt;EmbeddableControl.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Take a look to that &lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-insert-the-selection-tool-in-an-embeddable/m-p/1064170" target="_self"&gt;thread&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 09:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317803#M10173</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-11T09:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Handle discard for map tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317807#M10174</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;The selection tool which I am using inside my map tool is also created by me only. But the challenge is how to catch discard happened while my tool was being used. I cant use active tool to check which tool is in use because &amp;nbsp;whenever my custom map tool is being used Active tool will always be my custom map selection tool used inside my custom map tool.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 09:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317807#M10174</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2023-08-11T09:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Handle discard for map tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317810#M10175</link>
      <description>&lt;P&gt;If you are using EditOperation set your EditOperation &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9570.html" target="_self"&gt;EventToken&lt;/A&gt; for further checking in&amp;nbsp;&lt;SPAN&gt;EditCompletedEvent &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9786.html" target="_self"&gt;EventToken&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  // in your MapTool class
  SubscriptionToken _yourOperationEventToken = null;




  // in subscribe to EditCompletedEvent place
  _yourOperationEventToken =   EditCompletedEvent.Subscribe(onEditCompleted);




  // in create EditOperation place
  EditOperation op = new EditOperation();
  op.EventToken = _yourOperationEventToken;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private Task OnEditCompleted(EditCompletedEventArgs args)
        {
            switch (args.CompletedType)
            {
            case EditCompletedType.Save:
                break;

            case EditCompletedType.Discard:
                if(args.EventToken == _yourOperationEventToken) {
                    // your tool operation discarded
                }
                break;

            case EditCompletedType.Operation:
                break;

            case EditCompletedType.Undo:
            case EditCompletedType.Redo:
                break;

            case EditCompletedType.Reconcile:
                break;

            case EditCompletedType.Post:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 10:28:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/handle-discard-for-map-tool/m-p/1317810#M10175</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-11T10:28:30Z</dc:date>
    </item>
  </channel>
</rss>

