<?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 Button.Click Event Queuing in ArcGIS Explorer Desktop Questions</title>
    <link>https://community.esri.com/t5/arcgis-explorer-desktop-questions/button-click-event-queuing/m-p/648440#M4082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've created a DockWindow which includes a few Buttons (System.Windows.Forms.Button)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My goal is to suppress multiple Click Events from being fired is succession. However, it seems that the Click events are being queued, then fired after the thread is free.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, I click the button once and the Click event is fired and the ProgressHelper dialog is shown. While the PH dialog is still being shown I can click again on the button. The application will wait for the btnExampleWork_Click handler to finish executing, then fire off the second instance of the Click handler. &lt;/SPAN&gt;&lt;STRONG&gt;Is there anyway I can suppress multiple clicks?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am positive that only one click handler is being assigned. I have also attempted it without the ProgressHelper and SuspendDisplay to no avail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
private bool MapIsBusy = false;

private void btnExampleWork_Click(object sender, EventArgs e) {
 btnExampleWork.Enabled = false;//even this doesn't help
 if (this.MapIsBusy) {
&amp;nbsp; return;
 }
 this.MapIsBusy = true;
 Trace.WriteLine("start");
 using (ProgressHelper ph = new ProgressHelper("Busy...", "Busy...", ""))
 using (IDisposable suspendDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.SuspendDisplay()) {
&amp;nbsp; //Do some intensive work
 }
 Trace.WriteLine("stop");
 this.MapIsBusy = false;
 btnExampleWork.Enabled = true;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jul 2012 00:18:41 GMT</pubDate>
    <dc:creator>norie</dc:creator>
    <dc:date>2012-07-18T00:18:41Z</dc:date>
    <item>
      <title>Button.Click Event Queuing</title>
      <link>https://community.esri.com/t5/arcgis-explorer-desktop-questions/button-click-event-queuing/m-p/648440#M4082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've created a DockWindow which includes a few Buttons (System.Windows.Forms.Button)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My goal is to suppress multiple Click Events from being fired is succession. However, it seems that the Click events are being queued, then fired after the thread is free.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, I click the button once and the Click event is fired and the ProgressHelper dialog is shown. While the PH dialog is still being shown I can click again on the button. The application will wait for the btnExampleWork_Click handler to finish executing, then fire off the second instance of the Click handler. &lt;/SPAN&gt;&lt;STRONG&gt;Is there anyway I can suppress multiple clicks?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am positive that only one click handler is being assigned. I have also attempted it without the ProgressHelper and SuspendDisplay to no avail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
private bool MapIsBusy = false;

private void btnExampleWork_Click(object sender, EventArgs e) {
 btnExampleWork.Enabled = false;//even this doesn't help
 if (this.MapIsBusy) {
&amp;nbsp; return;
 }
 this.MapIsBusy = true;
 Trace.WriteLine("start");
 using (ProgressHelper ph = new ProgressHelper("Busy...", "Busy...", ""))
 using (IDisposable suspendDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.SuspendDisplay()) {
&amp;nbsp; //Do some intensive work
 }
 Trace.WriteLine("stop");
 this.MapIsBusy = false;
 btnExampleWork.Enabled = true;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 00:18:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-explorer-desktop-questions/button-click-event-queuing/m-p/648440#M4082</guid>
      <dc:creator>norie</dc:creator>
      <dc:date>2012-07-18T00:18:41Z</dc:date>
    </item>
  </channel>
</rss>

