Skip to content

Instantly share code, notes, and snippets.

View ceee's full-sized avatar

tobi ceee

View GitHub Profile
public static Uri SaveTile(UserControl control, string filename, double width, double height)
{
string path = tileFolder + filename + ".png";
bool success = true;
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
control.Width = width;
control.Height = height;
control.Measure(new Size(width, height));
@ceee
ceee / MainPage.xaml
Created June 16, 2014 20:14
Render UIElement to PNG
<Page
x:Class="BitmapToPNGTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BitmapToPNGTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@ceee
ceee / AudioBackgroundTask.cs
Created July 17, 2014 15:42
Memory efficient TTS background audio in WinRT
using Newtonsoft.Json;
using Poki.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
IReadOnlyList<StorageFolder> artistFolders = await KnownFolders.MusicLibrary.GetFoldersAsync();
IEnumerable<Task> tasks = artistFolders.Select(artistFolder => TraverseFolderForFolders(artistFolder));
await Task.WhenAll(tasks);
@ceee
ceee / gist:b40df3169435abd40a2c
Created August 19, 2014 12:35
Launch store in WinRT
// navigate to store (details of app) page
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:navigate?appid=" + CurrentApp.AppId));
// navigate to review page
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));
@ceee
ceee / gauge-style.xaml
Created December 31, 2014 09:48
Gauge in WinRT
<Style x:Key="Gauge" TargetType="controls:Gauge">
<Setter Property="FontFamily" Value="Segoe WP" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Gauge">
<Viewbox>
<Grid x:Name="Container" Height="200" Width="200">
<Path Name="PART_Scale" Stroke="{TemplateBinding ScaleBrush}" StrokeThickness="{TemplateBinding ScaleWidth}" />
<Path Name="PART_Trail" Stroke="{TemplateBinding TrailBrush}" StrokeThickness="{TemplateBinding ScaleWidth}" />
@ceee
ceee / test.cs
Last active January 30, 2016 11:57
Live Tile Bug, Windows 10 (10586)
TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();
string xml = @"
<tile>
<visual>
<binding template='TileMedium' branding='none'>
<image placement='peek' src='http://placehold.it/400x400' />
<image hint-overlay='40' placement='background' src='http://placehold.it/300x300' />
<text hint-wrap='true'>Test test test</text>
</binding>
@ceee
ceee / CustomExportType.cs
Last active July 13, 2017 09:24
Fixed FormRecordSearcher (Umbraco.Forms) so used methods are public
using System;
using Umbraco.Core;
using Umbraco.Forms.Core;
using Umbraco.Forms.Web.BusinessLogic;
using Umbraco.Forms.Web.Models.Backoffice;
namespace MyNamespace
{
public class CustomExportType : ExportType
{