none
[UWP] Using Dispatcher in a PCL RRS feed

  • Question

  • How can I do this in a PCL ?

    Protected Async Sub OnPropertyChanged(<CallerMemberName> Optional propertyName As String = Nothing)
            Await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow. (CoreDispatcherPriority.High, (Sub()
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
            End Sub))
        End Sub

    • Moved by Breeze Liu Wednesday, September 6, 2017 5:48 AM off topic
    Thursday, August 24, 2017 12:31 PM

All replies

  • Hi theresonlyonefinmaf,

    Do you have some speciafic requirements to use the PCL? You can use the APIs easily in the Class Library (Universal Windows) as in the uwp project.

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 25, 2017 9:51 AM
  • Yes its for Xamarin Forms,
    Friday, August 25, 2017 10:49 AM
  • Hi theresonlyonefinmaf,

    Here is the forum for Developing Universal Windows apps, and we are focusing on developing universal windows apps issue. If your issue is about Xamarin Forms, you can ask it in the Xamarin Forms official website.

    By the way, In Xamarin Forms, you can use the Xamarin.Forms.Device.BeginInvokeOnMainThread Method in the PCL, it invokes an Action on the device main (UI) thread as the Dispatcher in UWP.

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 28, 2017 1:55 AM
  • Is there any known reason why BeginInvokeOnMainThread would not be invoked, i.e. jumped over. I have a class file with numerous calls to BeginInvokeOnMainThread in different methods that work, but this one doesn't execute. I can place breakpoints in the others, but in this one forget it. I originally had the same code in a separate class with the same issue. I am using them in order to asynchronously end DataServiceQuery'ies in the PCL of Xamarin cross-platform forms solution. I know that the query I am making is returning a result by just making it using a browser.

    There are no associated error messages that I have seen, directly or in Output.

    Is there a limit on the number of invokes?
    • Edited by AlaskanRogue Wednesday, December 19, 2018 7:12 PM
    Wednesday, December 19, 2018 4:04 PM
  • The reality was that since I was not in the main UI thread of the PCL but in a background thread, that I didn't need to run the query on the main thread via BeginInvokeOnMainThread.

    • Edited by AlaskanRogue Thursday, December 20, 2018 2:26 AM
    • Proposed as answer by AlaskanRogue Thursday, December 20, 2018 2:26 AM
    Thursday, December 20, 2018 2:22 AM