<?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 Help converting ArcMap to Pro Code in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/help-converting-arcmap-to-pro-code/m-p/644383#M28661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Converting code from ArcMap to Pro for add-in button.&amp;nbsp; I'm lost on the syntax.&amp;nbsp; Where do I find assembly references to update the ArcMap parts to ArcGIS Pro, etc?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two button tools.&amp;nbsp; One links to a database with traffic sign supports.&amp;nbsp; The other creates new supports.&amp;nbsp; I may make a third that creates a sign on an existing support.&amp;nbsp; This used to work in ArcMap but does not work with current builds anymore.&amp;nbsp; Any hints are appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//HyperlinkTSI_Tool&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Optionally modify the values for the message box caption and user prompt&lt;BR /&gt;//If necessary enter the correct name of the Support layer and correct field name for SupportID&lt;BR /&gt;private const string URL = "F:\APPS\PW\TSI\TSI.accdb&amp;nbsp;";&lt;BR /&gt;private const string USER_PROMPT = "Are you sure you want to hyperlink to the TSI program?";&lt;BR /&gt;private const string CAPTION = "Hyperlink to TSI";&lt;BR /&gt;private const string LAYER_NAME = "Supports";&lt;BR /&gt;private const string SUPPORTID_FIELD = "SupportID";&lt;/P&gt;&lt;P&gt;protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)&lt;BR /&gt;{ &lt;BR /&gt; //Create envelope for use in spatial filter&lt;BR /&gt; ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = ArcMap.Document;&lt;BR /&gt; ESRI.ArcGIS.Carto.IMap map = mxDoc.FocusMap;&lt;BR /&gt; ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.FocusMap as ESRI.ArcGIS.Carto.IActiveView;&lt;BR /&gt; ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);&lt;BR /&gt; ESRI.ArcGIS.Geometry.IEnvelope envelope = point.Envelope;&lt;BR /&gt; envelope.Expand(mxDoc.SearchTolerance, mxDoc.SearchTolerance, false);&lt;/P&gt;&lt;P&gt;//Make sure Supports layer is present and create its ILayer instance&lt;BR /&gt; ESRI.ArcGIS.Carto.ILayer layer = null;&lt;BR /&gt; for (int i = 0; i &amp;lt; map.LayerCount - 1; i++)&lt;BR /&gt; {&lt;BR /&gt; if (map.get_Layer(i).Name.Equals(LAYER_NAME))&lt;BR /&gt; layer = map.get_Layer(i);&lt;BR /&gt; }&lt;BR /&gt; if (layer == null)&lt;BR /&gt; {&lt;BR /&gt; System.Windows.Forms.MessageBox.Show(LAYER_NAME + " feature class not found");&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; //Find features within envelope&lt;BR /&gt; ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = layer as ESRI.ArcGIS.Carto.IFeatureLayer;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = featureLayer.FeatureClass;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();&lt;BR /&gt; spatialFilter.Geometry = envelope;&lt;BR /&gt; spatialFilter.GeometryField = featureClass.ShapeFieldName;&lt;BR /&gt; spatialFilter.set_OutputSpatialReference(featureClass.ShapeFieldName, map.SpatialReference);&lt;BR /&gt; spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeature feature = featureCursor.NextFeature();&lt;BR /&gt; //If the envelope contains a feature, append its support ID to URL and open in default browser&lt;BR /&gt; if (feature != null)&lt;BR /&gt; {&lt;BR /&gt; var result = System.Windows.Forms.MessageBox.Show(USER_PROMPT, CAPTION,&lt;BR /&gt; System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);&lt;BR /&gt; if (result == System.Windows.Forms.DialogResult.Yes)&lt;BR /&gt; {&lt;BR /&gt; string supportID = feature.get_Value(feature.Fields.FindField(SUPPORTID_FIELD)).ToString();&lt;BR /&gt; System.Diagnostics.Process.Start(URL + supportID);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//CreateSupportTool&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Optionally modify the following values for the message box caption and user prompt&lt;BR /&gt;private const string USER_PROMPT = "Are you sure you want to create this support?";&lt;BR /&gt;private const string CAPTION = "Create Support";&lt;/P&gt;&lt;P&gt;protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)&lt;BR /&gt;{&lt;BR /&gt; var result = System.Windows.Forms.MessageBox.Show(USER_PROMPT, CAPTION,&lt;BR /&gt; System.Windows.Forms.MessageBoxButtons.YesNo,&lt;BR /&gt; System.Windows.Forms.MessageBoxIcon.Question);&lt;BR /&gt; if (result == System.Windows.Forms.DialogResult.Yes)&lt;BR /&gt; {&lt;BR /&gt; //Get coords from MouseEventArgs and insert into TSI Create Support URL parameter string&lt;BR /&gt; ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = ArcMap.Document;&lt;BR /&gt; ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.FocusMap as ESRI.ArcGIS.Carto.IActiveView;&lt;BR /&gt; ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y) as ESRI.ArcGIS.Geometry.IPoint;&lt;BR /&gt; System.Diagnostics.Process.Start("http://camchdev2k3/tsi/ns.aspx?aid=2&amp;amp;X=" + point.X + "&amp;amp;Y=" + point.Y);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Jun 2019 22:13:01 GMT</pubDate>
    <dc:creator>TomMagdaleno</dc:creator>
    <dc:date>2019-06-25T22:13:01Z</dc:date>
    <item>
      <title>Help converting ArcMap to Pro Code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-converting-arcmap-to-pro-code/m-p/644383#M28661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Converting code from ArcMap to Pro for add-in button.&amp;nbsp; I'm lost on the syntax.&amp;nbsp; Where do I find assembly references to update the ArcMap parts to ArcGIS Pro, etc?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two button tools.&amp;nbsp; One links to a database with traffic sign supports.&amp;nbsp; The other creates new supports.&amp;nbsp; I may make a third that creates a sign on an existing support.&amp;nbsp; This used to work in ArcMap but does not work with current builds anymore.&amp;nbsp; Any hints are appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//HyperlinkTSI_Tool&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Optionally modify the values for the message box caption and user prompt&lt;BR /&gt;//If necessary enter the correct name of the Support layer and correct field name for SupportID&lt;BR /&gt;private const string URL = "F:\APPS\PW\TSI\TSI.accdb&amp;nbsp;";&lt;BR /&gt;private const string USER_PROMPT = "Are you sure you want to hyperlink to the TSI program?";&lt;BR /&gt;private const string CAPTION = "Hyperlink to TSI";&lt;BR /&gt;private const string LAYER_NAME = "Supports";&lt;BR /&gt;private const string SUPPORTID_FIELD = "SupportID";&lt;/P&gt;&lt;P&gt;protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)&lt;BR /&gt;{ &lt;BR /&gt; //Create envelope for use in spatial filter&lt;BR /&gt; ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = ArcMap.Document;&lt;BR /&gt; ESRI.ArcGIS.Carto.IMap map = mxDoc.FocusMap;&lt;BR /&gt; ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.FocusMap as ESRI.ArcGIS.Carto.IActiveView;&lt;BR /&gt; ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);&lt;BR /&gt; ESRI.ArcGIS.Geometry.IEnvelope envelope = point.Envelope;&lt;BR /&gt; envelope.Expand(mxDoc.SearchTolerance, mxDoc.SearchTolerance, false);&lt;/P&gt;&lt;P&gt;//Make sure Supports layer is present and create its ILayer instance&lt;BR /&gt; ESRI.ArcGIS.Carto.ILayer layer = null;&lt;BR /&gt; for (int i = 0; i &amp;lt; map.LayerCount - 1; i++)&lt;BR /&gt; {&lt;BR /&gt; if (map.get_Layer(i).Name.Equals(LAYER_NAME))&lt;BR /&gt; layer = map.get_Layer(i);&lt;BR /&gt; }&lt;BR /&gt; if (layer == null)&lt;BR /&gt; {&lt;BR /&gt; System.Windows.Forms.MessageBox.Show(LAYER_NAME + " feature class not found");&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; //Find features within envelope&lt;BR /&gt; ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = layer as ESRI.ArcGIS.Carto.IFeatureLayer;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = featureLayer.FeatureClass;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();&lt;BR /&gt; spatialFilter.Geometry = envelope;&lt;BR /&gt; spatialFilter.GeometryField = featureClass.ShapeFieldName;&lt;BR /&gt; spatialFilter.set_OutputSpatialReference(featureClass.ShapeFieldName, map.SpatialReference);&lt;BR /&gt; spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);&lt;BR /&gt; ESRI.ArcGIS.Geodatabase.IFeature feature = featureCursor.NextFeature();&lt;BR /&gt; //If the envelope contains a feature, append its support ID to URL and open in default browser&lt;BR /&gt; if (feature != null)&lt;BR /&gt; {&lt;BR /&gt; var result = System.Windows.Forms.MessageBox.Show(USER_PROMPT, CAPTION,&lt;BR /&gt; System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);&lt;BR /&gt; if (result == System.Windows.Forms.DialogResult.Yes)&lt;BR /&gt; {&lt;BR /&gt; string supportID = feature.get_Value(feature.Fields.FindField(SUPPORTID_FIELD)).ToString();&lt;BR /&gt; System.Diagnostics.Process.Start(URL + supportID);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//CreateSupportTool&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Optionally modify the following values for the message box caption and user prompt&lt;BR /&gt;private const string USER_PROMPT = "Are you sure you want to create this support?";&lt;BR /&gt;private const string CAPTION = "Create Support";&lt;/P&gt;&lt;P&gt;protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)&lt;BR /&gt;{&lt;BR /&gt; var result = System.Windows.Forms.MessageBox.Show(USER_PROMPT, CAPTION,&lt;BR /&gt; System.Windows.Forms.MessageBoxButtons.YesNo,&lt;BR /&gt; System.Windows.Forms.MessageBoxIcon.Question);&lt;BR /&gt; if (result == System.Windows.Forms.DialogResult.Yes)&lt;BR /&gt; {&lt;BR /&gt; //Get coords from MouseEventArgs and insert into TSI Create Support URL parameter string&lt;BR /&gt; ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = ArcMap.Document;&lt;BR /&gt; ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.FocusMap as ESRI.ArcGIS.Carto.IActiveView;&lt;BR /&gt; ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y) as ESRI.ArcGIS.Geometry.IPoint;&lt;BR /&gt; System.Diagnostics.Process.Start("http://camchdev2k3/tsi/ns.aspx?aid=2&amp;amp;X=" + point.X + "&amp;amp;Y=" + point.Y);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2019 22:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-converting-arcmap-to-pro-code/m-p/644383#M28661</guid>
      <dc:creator>TomMagdaleno</dc:creator>
      <dc:date>2019-06-25T22:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help converting ArcMap to Pro Code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-converting-arcmap-to-pro-code/m-p/644384#M28662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/group/3979"&gt;ArcGIS Pro SDK&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2019 22:18:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-converting-arcmap-to-pro-code/m-p/644384#M28662</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2019-06-25T22:18:46Z</dc:date>
    </item>
  </channel>
</rss>

