<?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: Prevent command from running multiple times in a row, by fast clicking of us in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5245007#M42784</link>
    <description>The CommandFlags.NoMultiple may prevent this:&lt;BR /&gt;&lt;BR /&gt;[CommandMethod("Startup",CommandFlags.NoMultiple)]&lt;BR /&gt;</description>
    <pubDate>Mon, 01 Sep 2014 10:45:25 GMT</pubDate>
    <dc:creator>SENL1362</dc:creator>
    <dc:date>2014-09-01T10:45:25Z</dc:date>
    <item>
      <title>Prevent command from running multiple times in a row, by fast clicking of user</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5244159#M42783</link>
      <description>&lt;P&gt;Hello Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a command that initializes some stuff, which can take a few seconds, and then shows a dialog form.&lt;/P&gt;&lt;P&gt;Because the initialization can take a few seconds, the user can click the AutoCAD button (wich triggers the command) multiple times if he is fast enough. This results in being the command run multiple times in a row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I prevent this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried checking "GetSystemVariable("CMDNAMES")" to see if the command is already running, but this does not work because the commands do not run simultaneously, but after each other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 06:22:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5244159#M42783</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2014-08-31T06:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5245007#M42784</link>
      <description>The CommandFlags.NoMultiple may prevent this:&lt;BR /&gt;&lt;BR /&gt;[CommandMethod("Startup",CommandFlags.NoMultiple)]&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Sep 2014 10:45:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5245007#M42784</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2014-09-01T10:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5245571#M42785</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried it, but the command flag 'NoMultiple' does not solve this problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;The CommandFlags.NoMultiple indicates that the command will not be possible to repeat itself through the MULTIPLE command."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for the response.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 17:41:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5245571#M42785</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2014-09-01T17:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5246171#M42786</link>
      <description>ok, sorry about that, just a quick guess.&lt;BR /&gt;Other possibilities are a:&lt;BR /&gt;-check CMDACTIVE&lt;BR /&gt;-set a static (global) var when starting</description>
      <pubDate>Tue, 02 Sep 2014 05:56:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5246171#M42786</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2014-09-02T05:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251177#M42787</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing some sort of check if the same command is already active, doesn't work in my case, because the commands run after each other, not simultaneously.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have cancel in my button (^C^C) but that doesn't help, I think because the command shows a dialog form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the response.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2014 17:15:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251177#M42787</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2014-09-03T17:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251539#M42788</link>
      <description>&lt;P&gt;Can't you just use a static counter?&lt;/P&gt;&lt;PRE&gt;        public static int numOfTimes = 0;

        [CommandMethod("NumTest")]
        public void NumTest()
        {
            numOfTimes++;

            if (numOfTimes == 1)
            {
                Ed.WriteLine("First time ran");
            }
            Ed.WriteLine("{0} time ran", numOfTimes);
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2014 19:38:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251539#M42788</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2014-09-03T19:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251915#M42789</link>
      <description>&lt;P&gt;Or structure the function such that it first checks to see if the initialization is already done (presumably, data is added where it was missing before?) and only proceeds if initialization is required.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2014 23:00:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5251915#M42789</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2014-09-03T23:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5257583#M42790</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont think I can use a counter, because I can't tell the difference between 2 situations:&lt;/P&gt;&lt;P&gt;- The user clicked the button fast 2 times in a row (the second time the command should not run).&lt;/P&gt;&lt;P&gt;- The user activated the command 2 times in a row on purpose (the second time the command should run).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Sep 2014 04:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5257583#M42790</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2014-09-06T04:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5257585#M42791</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The initialization needs to be done every time, because it shows files, and those files may have been altered between each session.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to change the structure of the function in such a matter, that initialization is done in a later stage of the command, and the command is already running and the user can't click fast enough to activate it again &amp;nbsp;(but this is more of a 'trick' then a solution to my problem).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Sep 2014 04:23:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5257585#M42791</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2014-09-06T04:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent command from running multiple times in a row, by fast clicking of us</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5286153#M42792</link>
      <description>&lt;P&gt;Would it help to change the cursor to a wait cursor and then back again with:&lt;/P&gt;&lt;PRE&gt;       System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor

''''' Your oode here

        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;At the very least, it will notify the user that something is happening. Alternatively, open your dialog immediately with minimal data and update it once you've finished initializing it.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Sep 2014 17:54:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-command-from-running-multiple-times-in-a-row-by-fast/m-p/5286153#M42792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-19T17:54:56Z</dc:date>
    </item>
  </channel>
</rss>

