Root

Q&A App

Hey, When my professor put a machine-readable quiz on his website, I made an app for my Phone to do the quiz.. Today I ported it to the desktop and I’d like to share it: Download Q&A App.zip It requires .NET Framework 4.0. To feed it with questions, you need a text file (preferable in UTF-8 encoding) that follows these simple rules: question-answer blocks are separated by one empty line question-lines begin with ‘Q: ’ answer-lines begin with ‘A: ‘ category-lines begin with ‘C: ‘ multiple Q/A/C-lines per block are allowed There’s a sample file in the *.zip. You can load a file from your computer, or from a remote location (eg. a textfile in a public dropbox folder). have fun!

C#

TCD.Device

Just another TCD namespace: TCD.Device. Its purpose is to contain additional namespaces that use features like Camera, GPS, Accelerometer, Compass.. Everything that has an effect on the App permissions the user sees on the Windows Phone or Windows 8 application. (Like ‘This app has access to your location, compass..’) TCD.Device.Camera CodeScannerPopup is another async control, specific to the Windows Phone platform, that can be used to scan for QR codes. (In theory other 2D-codes as well.) Usage: add the TCD.Device.Camera NuGet package add using directives for TCD.Device.Camera and TCD.Device.Camera.Barcodes in the calling method (eg. a Button.Click event) hide/show ApplicationBar, attach/remove BackKeyPress event Code sample: private async void Button_Click(object sender, RoutedEventArgs e) { CodeScannerPopup scp = new CodeScannerPopup(Microsoft.Phone.Shell.SystemTray.IsVisible, Format.ALL_1D); //important: hide ApplicationBar and handle BackKeyPress ApplicationBar.IsVisible = false; this.BackKeyPress += scp.HandleBackKeyPress; //now let’s go ScanResult r = await scp.ShowAsync(“BARCODE SCANNER”, “scan”); if (r != null) output.Text = string.Format(“{0}n{1}”, r.Text, r.Format.ToString()); //clean…

C#

TCD.Controls – Flyouts for XAML/C#

Hey there, Let’s start with the most important news: TCD.Controls is now available on NuGet (click here if you don’t know how this works, or why you want to use it) From now on, I won’t link *.zip packages with the sources anymore, because NuGet really make life easier. If you want access to the source files, just drop me an email There’s been one more or less important change to the Flyout control you should know about: It now has a property called “IsIgnoreLightDismissal”. To understand its purpose, imagine the following scenario (video below) You have a Button control that opens a FilePicker/FolderPicker, asking the user to select a File/Folder. This Button is hosted inside a Flyout control. Now when the user taps the Button, the Picker will popup, stealing the focus from your applications Window. Flyouts are required to hide on App-switch by the design guidelines, which is…

C#

Exploring NuGet

Since 5 hours now, I ‘m on NuGet and I’d like to share my first experiences. Why did I join NuGet? I joined NuGet, because it seems to be the most comfortable way to share libraries, containing XAML controls. Share them between my own projects, as well as with you. Previously I always had to include the project containing the controls in the solution I was working on, which was really annoying.. How can you use it? Let’s assume that you want to use a package in your project. All you need is the NuGet Package Manager Visual Studio extension. You can install it via Tools/Extensions and Updates. To use/reference a package from NuGet right-click on the references in the solution explorer and select ‘Manage NuGet Packages’. Then you can search for the package you desire (for example ‘TCD.Serialization’) and add it to your project. How do I use it?…

C#

Draw the Skeletons in two lines

Hello, Recently I was coding some Kinect stuff and wanted to draw the skeleton that the user can see what’s going on. In the Samples there’s some code for that, but it’s pretty annoying to copy/paste it in your own project every time, so I wrapped it up in a class called SkeletonPainter. To use it you just need an Image of either 640×480 or 320×240 and hand it over to the SkeletonPainter, along with the resolution and a background Brush of your choice: SkeletonPainter painter = new SkeletonPainter(skeletonImage, SkeletonPainterResolution.Resolution320x240, Brushes.White); Of course, you need to hand him the KinectSensor as well: painter.SwitchSensor(sensor); This way you can easily switch the KinectSensor while the painter is still active^ Have a try and tell me what you think =) Download TCD.Kinect.zip

C#

Async CustomMessageBox on Windows Phone

UPDATE: There’s a new Version with .NET4.5 Support, Code Samples Hey there, As you may know, there’s just a limited set of MessageBoxButtons available in Silverlight for WP. However, you can make your own MessageBox in your Silverlight app using the Microsoft.Xna.Framework.GamerServices namespace as explained in this tutorial by Den Delimarsky. This method uses the old style async, which really sucks, so I decided to go the cool and smart new async way. You need Visual Studio Async CTP and Visual Studio 2010 to do this. The trick is to wrap the old async methods together with async Tasks, resulting in a Task<int> that shows the custom message box and returns the selected button in just one line: int result = await CustomMessageBox.ShowAsync(“Dinner time!”, “What do you prefer?”, 0, CustomMessageBoxIcon.Alert, “German”, “Italian”); Asynchronously and therefore non-UI-thread-blocking, of course If you’re interested you can have a look at the source: CustomMessageBox.cs…

Root

Sync specific Folders with SkyDrive

Some of you may know, that I’m a huge fan of Dropbox, Windows Live Mesh and SkyDrive alltogether. Each of them has some exclusive features that I find most useful. This is the public sharing using a single URL of Dropbox, the cross-platform Features of SkyDrive (WP7…) and the feature to ‘select and sync’ any folder on your hard drive with Windows Live Mesh (in contrast to the quite unflexible syncing of just one folder). Well today on reddit, I came across a link to a blogpost… This guy, Jan Hannemann, had a genious idea: In the NTFS file system you can hard-link folders in a way that and application (such as Windows Explorer, or Windows Live Mesh) thinks that the folder is really there. These links are called folder-junctions and can be created using the command line. Fortunately he created an extension to the Explorers context menu that lets you do this in just two…