How can a Metro app in Windows 8 communicate with a backend desktop app on the same machine?

I’m porting my existing project to Win8 right now. It consists of windows service and tray application which are talking to each other via NamedPipes WCF. As you may already know Metro doesn’t support named pipes. I ended up using TcpBinding for full duplex connection. This post describes what functionality is supported. Sample of my … Read more

How does Windows 8 Runtime (WinRT / Windows Store apps / Windows 10 Universal App) compare to Silverlight and WPF? [closed]

At the lowest level, WinRT is an object model defined on ABI level. It uses COM as a base (so every WinRT object implements IUnknown and does refcounting), and builds from there. It does add quite a lot of new concepts in comparison to COM of old, most of which come directly from .NET – … 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

Allowing Untrusted SSL Certificates with HttpClient

A quick and dirty solution is to use the ServicePointManager.ServerCertificateValidationCallback delegate. This allows you to provide your own certificate validation. The validation is applied globally across the whole App Domain. ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; I use this mainly for unit testing in situations where I want to run against an endpoint … Read more

Simple and tested online regex containing regex delimiters does not work in C# code

Do not use regex delimiters: name = Regex.Replace(name, @”\W”, “”); In C#, you cannot use regex delimiters as the syntax to declare a regular expression is different from that of PHP, Perl or JavaScript or others that support <action>/<pattern>(/<substituiton>)/modifiers regex declaration. Just to avoid terminology confusion: inline modifiers (enforcing case-insensitive search, multiline, singleline, verbose and … Read more