<?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: Extending the CallCanExecute enum for a ribbon button in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/7019571#M4878</link>
    <description>&lt;P&gt;Any answer to this? I also have the same problem.&lt;/P&gt;</description>
    <pubDate>Sun, 16 Apr 2017 09:40:52 GMT</pubDate>
    <dc:creator>rade_tomovic</dc:creator>
    <dc:date>2017-04-16T09:40:52Z</dc:date>
    <item>
      <title>Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/6775925#M4877</link>
      <description>&lt;P&gt;Is there a way to extend the CallCanExecute enum for a RibbonButton? Currently there are options for&lt;/P&gt;&lt;PRE&gt;//     Command is Enabled unless specifically disabled by CanExecute implementation
       Always = 0,
&lt;BR /&gt;//     Command is disabled if the doument is Clear
       DocumentNotClear = 1,
&lt;BR /&gt;//     Command is Disabled unless there is a single selection
       CurrentSelectionSingle = 2,
&lt;BR /&gt;//     Command is Disabled unless there are multiple selections
       CurrentSelectionMultiple = 3&lt;/PRE&gt;&lt;P&gt;I'd ideally like to have the CallCanExecute be linked to CurrentSelectionNotEmpty or similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Binding an event that sets IsEnabled on a button to the CurrentSelection works, but is immediately overridden by the CanExecute binding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the best place to start with this, a custom CanExecute binding function?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2016 12:33:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/6775925#M4877</guid>
      <dc:creator>jonathonbroughton</dc:creator>
      <dc:date>2016-12-30T12:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/7019571#M4878</link>
      <description>&lt;P&gt;Any answer to this? I also have the same problem.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2017 09:40:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/7019571#M4878</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2017-04-16T09:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/7021608#M4879</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2367255"&gt;@jonathonbroughton&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know there is no way to add to the enum. However, I believe you can use a combination of CallCanExecute.DocumentNotClear and an if statement within your CanExecuteCommand method to get the functionality you want. Something like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    [Command("SelectionButton",
                LoadForCanExecute = true,
                CallCanExecute = CallCanExecute.DocumentNotClear)]

    [Plugin("SomePluginName", "ABCD", ToolTip = "", DisplayName = "Some Name")]
    public class MyAddIn : CommandHandlerPlugin
    {
        public override CommandState CanExecuteCommand(string commandId)
        {
            CommandState state = new CommandState(true);
            switch (commandId)
            {
                case "SelectionButton":
                {
                    // Inactive if there is no selection
                    if (Application.ActiveDocument.CurrentSelection.IsEmpty == true)
                    {
                        state.IsEnabled = false;
                    }

                    break;
                }
            }

            return state;
        }
        
        public override int ExecuteCommand(string commandId, params string[] parameters)
        {
            switch (commandId)
            {
                case "SelectionButton":
                {
                    // do something cool
                    return 0;
                }
            }
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 18:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/7021608#M4879</guid>
      <dc:creator>logikgate</dc:creator>
      <dc:date>2017-04-17T18:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8207421#M4880</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4477877"&gt;@logikgate&lt;/a&gt;&amp;nbsp;this will need an event listener on the selection event to enable the button again presumably?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 17:36:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8207421#M4880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-17T17:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8209841#M4881</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;I suspect that you will not need an event listener to re-enable the button. Navisworks reevaluates the CanExecuteCommand periodically.&amp;nbsp; It is possible that the button state may lag behind though as I'm not exactly sure what events in Navis actually trigger the reevaluation.&amp;nbsp; If you implement this I would do it without the event listener first.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 21:21:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8209841#M4881</guid>
      <dc:creator>logikgate</dc:creator>
      <dc:date>2018-08-19T21:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extending the CallCanExecute enum for a ribbon button</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8216665#M4882</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4477877"&gt;@logikgate&lt;/a&gt;&amp;nbsp;I haven't found anything that causes DocumentCanExecute that causes the above implementation to re-evaluate.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 13:25:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/extending-the-callcanexecute-enum-for-a-ribbon-button/m-p/8216665#M4882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-22T13:25:27Z</dc:date>
    </item>
  </channel>
</rss>

