Skip to content

Instantly share code, notes, and snippets.

View ejball's full-sized avatar
💭
Coding for fun.

Ed Ball ejball

💭
Coding for fun.
View GitHub Profile
@ejball
ejball / WaitForTask.h
Created September 27, 2012 03:55
Async unit tests in C++/Cx
template <typename T>
T WaitForTask(concurrency::task<T> t)
{
Windows::UI::Core::CoreDispatcher^ dispatcher =
Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow->Dispatcher;
HANDLE hEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (hEvent == NULL)
throw std::bad_alloc();
@ejball
ejball / MetroAppImages.cs
Created July 16, 2012 23:09
Create Metro app images
private void CreateAppImagesFromIcon(Bitmap icon, string targetFolder)
{
CreateAppImageFromIcon("Logo", icon, 150, 150, 42, 37, new[] { 80, 100, 140, 180 }, targetFolder);
CreateAppImageFromIcon("WideLogo", icon, 310, 150, 122, 37, new[] { 80, 100, 140, 180 }, targetFolder);
CreateAppImageFromIcon("SmallLogo", icon, 30, 30, 3, 3, new[] { 80, 100, 140, 180 }, targetFolder);
CreateAppImageFromIcon("StoreLogo", icon, 50, 50, 5, 5, new[] { 100, 140, 180 }, targetFolder);
CreateAppImageFromIcon("SplashScreen", icon, 620, 300, 203, 43, new[] { 100, 140, 180 }, targetFolder);
}
private void CreateAppImageFromIcon(string name, Bitmap icon, int logoWidth, int logoHeight, int iconX, int iconY, int[] scales, string targetFolder)