Cannot convert lambda expression to type ‘System.Delegate’

The problem is that you aren’t providing the exact type of delegate you want to invoke. Dispatcher.Invoke just takes a Delegate. Is it an Action<T>? If so, what is T? Is it a MethodInvoker? Action? What? If your delegate takes no arguments and returns nothing, you can use Action or MethodInvoker. Try this: _uiDispatcher.Invoke(new Action(() … Read more

Run code on UI thread in WinRT

It’s easier to directly get the CoreWindow from the non-UI thread. The following code will work everywhere, even when GetForCurrentThread() or Window.Current returns null. CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, <lambda for your code which should run on the UI thread>); for example: CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Your UI update code goes here! }); You’ll need to reference Windows.ApplicationModel.Core … Read more

How to pass the UI Dispatcher to the ViewModel

I have abstracted the Dispatcher using an interface IContext: public interface IContext { bool IsSynchronized { get; } void Invoke(Action action); void BeginInvoke(Action action); } This has the advantage that you can unit-test your ViewModels more easily. I inject the interface into my ViewModels using the MEF (Managed Extensibility Framework). Another possibility would be a … Read more

Correct way to get the CoreDispatcher in a Windows Store app

This is the preferred way: Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Your UI update code goes here! }); The advantage this has is that it gets the main CoreApplicationView and so is always available. More details here. There are two alternatives which you could use. First alternative Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().CoreWindow.Dispatcher This gets the active view for the app, … Read more

Dispatcher.CurrentDispatcher vs. Application.Current.Dispatcher

My gut tells me that Application.Current.Dispatcher will never change and is global to all threads in the current application, while Dispatcher.CurrentDispatcher may create a new instance of Dispatcher depending on the thread from which it was called. That is correct. Additionally, there is no point whatsoever in accessing Dispatcher.CurrentDispatcher from a non-UI thread. It will … Read more

Which Python packages offer a stand-alone event system? [closed]

PyPI packages As of January 2022, these are the event-related packages available on PyPI, ordered by most recent release date. pluggy 1.0.0: August 2021 pymitter 0.3.1: June 2021 zope.event 4.5.0: Sept 2020 python-dispatch 0.1.31: Aug 2020 RxPy3 1.0.1: June 2020 Louie 2.0: Sept 2019 PyPubSub 4.0.3: Jan 2019 pyeventdispatcher 0.2.3a0: 2018 buslane 0.0.5: 2018 PyPyDispatcher … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)