how to use MVVMLight SimpleIoc? [closed]

SimpleIoc crib sheet: You register all your interfaces and objects in the ViewModelLocator class ViewModelLocator { static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); if (ViewModelBase.IsInDesignModeStatic) { SimpleIoc.Default.Register<IDataService, Design.DesignDataService>(); } else { SimpleIoc.Default.Register<IDataService, DataService>(); } SimpleIoc.Default.Register<MainViewModel>(); SimpleIoc.Default.Register<SecondViewModel>(); } public MainViewModel Main { get { return ServiceLocator.Current.GetInstance<MainViewModel>(); } } } Every object is a singleton by default. To … Read more

Setting button text via JavaScript [duplicate]

Use textContent instead of value to set the button text. Typically the value attribute is used to associate a value with the button when it’s submitted as form data. Note that while it’s possible to set the button text with innerHTML, using textContext should be preferred because it’s more performant and it can prevent cross-site … Read more

How to uninstall an app that another user installed?

My process above still works, but it simply gets around a race condition issue, where Windows Update (yes, oddly enough) is in charge of wiping out “staged packages.” According to Microsoft, the “other fix” – and I still consider this issue to be a bug – is: Cause of the problem: Windows Update (WU) downloads … 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

Thread.Sleep replacement in .NET for Windows Store

Windows Store apps embrace asynchrony – and an “asynchronous pause” is provided by Task.Delay. So within an asynchronous method, you’d write: await Task.Delay(TimeSpan.FromSeconds(30)); … or whatever delay you want. The asynchronous method will continue 30 seconds later, but the thread will not be blocked, just as for all await expressions.

Is it possible to await an event instead of another async method?

You can use an instance of the SemaphoreSlim Class as a signal: private SemaphoreSlim signal = new SemaphoreSlim(0, 1); // set signal in event signal.Release(); // wait for signal somewhere else await signal.WaitAsync(); Alternatively, you can use an instance of the TaskCompletionSource<T> Class to create a Task<T> that represents the result of the button click: … Read more

“Permission Denied” trying to run Python on Windows 10

As far as I can tell, this was caused by a conflict with the version of Python 3.7 that was recently added into the Windows Store. It looks like this added two “stubs” called python.exe and python3.exe into the %USERPROFILE%\AppData\Local\Microsoft\WindowsApps folder, and in my case, this was inserted before my existing Python executable’s entry in … Read more

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