<?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 ProWindow calling method during an event in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/prowindow-calling-method-during-an-event/m-p/1099580#M7145</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use the&amp;nbsp;RowDeletedEvent to validate if it's permitted to erase a data or put it in history depending of user choice :&amp;nbsp;&lt;/P&gt;&lt;P&gt;RowDeletedEvent.Subscribe(OnRowDeleted, this.Table);&lt;/P&gt;&lt;P&gt;This is an async method and I try to set a property on my window before calling ShowDialog and nothing happing because of cross thread calling.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await QueuedTask.Run(() =&amp;gt;
{
    ProWindowClass pwc = new ProWindowClass();
    pwc.SetShowDateInput(Visibility.Visible);
    pwc.ShowDialog();
});&lt;/LI-CODE&gt;&lt;P&gt;The dialog is not showing up. But if I put in comment SetShowDateInput, the dialog is showing up.&lt;/P&gt;&lt;P&gt;I tried to use a async method for SetShowDateInput and use his own Dispatcher and I always got this error:&amp;nbsp;The calling thread cannot access this object because a different thread owns it.&lt;/P&gt;&lt;P&gt;What is the best practice to set control property of ProWindow during an event calling a await method?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
    <pubDate>Sat, 18 Sep 2021 02:13:35 GMT</pubDate>
    <dc:creator>JeanDesormeaux</dc:creator>
    <dc:date>2021-09-18T02:13:35Z</dc:date>
    <item>
      <title>ProWindow calling method during an event</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/prowindow-calling-method-during-an-event/m-p/1099580#M7145</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use the&amp;nbsp;RowDeletedEvent to validate if it's permitted to erase a data or put it in history depending of user choice :&amp;nbsp;&lt;/P&gt;&lt;P&gt;RowDeletedEvent.Subscribe(OnRowDeleted, this.Table);&lt;/P&gt;&lt;P&gt;This is an async method and I try to set a property on my window before calling ShowDialog and nothing happing because of cross thread calling.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await QueuedTask.Run(() =&amp;gt;
{
    ProWindowClass pwc = new ProWindowClass();
    pwc.SetShowDateInput(Visibility.Visible);
    pwc.ShowDialog();
});&lt;/LI-CODE&gt;&lt;P&gt;The dialog is not showing up. But if I put in comment SetShowDateInput, the dialog is showing up.&lt;/P&gt;&lt;P&gt;I tried to use a async method for SetShowDateInput and use his own Dispatcher and I always got this error:&amp;nbsp;The calling thread cannot access this object because a different thread owns it.&lt;/P&gt;&lt;P&gt;What is the best practice to set control property of ProWindow during an event calling a await method?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 02:13:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/prowindow-calling-method-during-an-event/m-p/1099580#M7145</guid>
      <dc:creator>JeanDesormeaux</dc:creator>
      <dc:date>2021-09-18T02:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: ProWindow calling method during an event</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/prowindow-calling-method-during-an-event/m-p/1099623#M7146</link>
      <description>&lt;P&gt;Ok I finally found how to call my Form, set parameters and call ShowDialog.&lt;/P&gt;&lt;P&gt;I needed to pass through FrameworkApplication.Current.Dispatcher.Invoke&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Windows.DemandeSuppressionHistorique.ChoixEnum choix = Windows.DemandeSuppressionHistorique.ChoixEnum.Annuler;

FrameworkApplication.Current.Dispatcher.Invoke(() =&amp;gt;
{
    Windows.DemandeSuppressionHistorique wnd = new Windows.DemandeSuppressionHistorique();
    wnd.DemandeSupressionIsEnable(false);
    wnd.ShowDialog();

    choix = wnd.Choix;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that could help someone eventually!&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 15:41:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/prowindow-calling-method-during-an-event/m-p/1099623#M7146</guid>
      <dc:creator>JeanDesormeaux</dc:creator>
      <dc:date>2021-09-18T15:41:48Z</dc:date>
    </item>
  </channel>
</rss>

