<?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 Create Extension just like ArcMap in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-extension-just-like-arcmap/m-p/1223762#M8934</link>
    <description>&lt;P&gt;I am developing an Pro application that will control edit events.&lt;/P&gt;&lt;P&gt;I would like to give option to turn of this option.&lt;/P&gt;&lt;P&gt;In ArcMap I would develop code that implement IExtension and IExtensioConfig then the extension "remember" if it is on or off. If it is on it runs the startup. If I am turning it off it will un subscribe to the events.&lt;/P&gt;&lt;P&gt;Here is the docs for ArcMap&amp;nbsp;&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#AppFrameworkExtensionHowTo.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#AppFrameworkExtensionHowTo.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moving to Pro I used this example:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/Licensing" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/Licensing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have a license for the extension.&lt;/P&gt;&lt;P&gt;I see two problems. First I do not see startup method - what code is running when extension exists?&lt;/P&gt;&lt;P&gt;Then the extension is always turned off, I could not find a way to remember the last state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 12:44:16 GMT</pubDate>
    <dc:creator>mody_buchbinder</dc:creator>
    <dc:date>2022-10-20T12:44:16Z</dc:date>
    <item>
      <title>Create Extension just like ArcMap</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-extension-just-like-arcmap/m-p/1223762#M8934</link>
      <description>&lt;P&gt;I am developing an Pro application that will control edit events.&lt;/P&gt;&lt;P&gt;I would like to give option to turn of this option.&lt;/P&gt;&lt;P&gt;In ArcMap I would develop code that implement IExtension and IExtensioConfig then the extension "remember" if it is on or off. If it is on it runs the startup. If I am turning it off it will un subscribe to the events.&lt;/P&gt;&lt;P&gt;Here is the docs for ArcMap&amp;nbsp;&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#AppFrameworkExtensionHowTo.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#AppFrameworkExtensionHowTo.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moving to Pro I used this example:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/Licensing" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/Licensing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have a license for the extension.&lt;/P&gt;&lt;P&gt;I see two problems. First I do not see startup method - what code is running when extension exists?&lt;/P&gt;&lt;P&gt;Then the extension is always turned off, I could not find a way to remember the last state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 12:44:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-extension-just-like-arcmap/m-p/1223762#M8934</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2022-10-20T12:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Extension just like ArcMap</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-extension-just-like-arcmap/m-p/1223775#M8935</link>
      <description>&lt;P&gt;You can implement IExtensionConfig in your Module class and activate/deactivate your events in the State property setter:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public ExtensionState State
{
	get { return this._state; }
	set
	{
		this._state = value;
		if (value == ExtensionState.Disabled) this.UnwireEvents();
		else if (value == ExtensionState.Enabled) this.WireEvents();
	}
}&lt;/LI-CODE&gt;&lt;P&gt;If you want to persist your extension state in the project, you can overwrite the OnReadSettingsAsync and OnWriteSettingsAsync methods:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override Task OnReadSettingsAsync(ModuleSettingsReader settings)
{
	if (null == settings) return Task.FromResult(0);
	var value = settings.Get("MyExtensionState");
	if (value != null &amp;amp;&amp;amp; value is string s &amp;amp;&amp;amp; Enum.TryParse(s, out ExtensionState extensionState))
	{
		this.State = extensionState;
	}

	return Task.FromResult(0);
}

protected override Task OnWriteSettingsAsync(ModuleSettingsWriter settings)
{
	settings.Add("MyExtensionState", this.State.ToString());
	return Task.FromResult(0);
}&lt;/LI-CODE&gt;&lt;P&gt;See also &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings," target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings&lt;/A&gt;. This also explains how to store settings at the application/user level.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 13:32:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-extension-just-like-arcmap/m-p/1223775#M8935</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2022-10-20T13:32:50Z</dc:date>
    </item>
  </channel>
</rss>

