Skip to content

Instantly share code, notes, and snippets.

View Nilzor's full-sized avatar

Frode Nilsen Nilzor

  • Forse.no
  • Oslo, Norway
View GitHub Profile
@Nilzor
Nilzor / TestPage.xaml
Created May 5, 2012 14:08
WebView InvokeScript-Notify-test
<Page
x:Class="GTWin8.TestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GTWin8"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}" RenderTransformOrigin="0.43299999833107,0.416000008583069">
@Nilzor
Nilzor / GenericFactoryPatternExample.cs
Created June 28, 2012 15:45
Generic Factory Example
using System;
using System.Collections.Generic;
namespace GenericFactoryPatternExample
{
public class MainClass
{
// Example of using a service locator to get the correct factory for
// a given object type.
public static void Main()
@Nilzor
Nilzor / CleanListViewItemStyle.xaml
Created July 11, 2012 11:13
A clean Metro ListViewItem Style. No selection animation or indication, no border, no nothing.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GTWin8.Assets">
<Style x:Key="CleanListViewItemStyle" TargetType="ListViewItem">
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TabNavigation" Value="Local"/>
@Nilzor
Nilzor / ExclusiveTaskQueue.cs
Created August 22, 2012 10:52
ExclusiveTaskQueue with tests
public class ExclusiveTaskQueue
{
public ConcurrentExclusiveSchedulerPair _schedulerPair;
public static TaskFactory _exclusiveTaskFactory;
public ExclusiveTaskQueue()
{
_schedulerPair = new ConcurrentExclusiveSchedulerPair();
_exclusiveTaskFactory = new TaskFactory(_schedulerPair.ExclusiveScheduler);
@Nilzor
Nilzor / ForegroundAnimPage.xaml
Created August 27, 2012 15:07
ForegroundAnimPage
<Page
x:Class="GTWin8.Ui.Drafts.ForegroundAnimPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GTWin8.Ui.Drafts"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@Nilzor
Nilzor / PageBase.cs
Created August 31, 2012 07:27
Page navigation helpers Metro
public class PageBase : LayoutAwarePage
{
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
object obj = null;
Debug.Assert(e.Parameter == null || e.Parameter is String, "Expected string as parameter");
if (e.Parameter != null) obj = SerializationHelper.DataContractDeserialize<object>((string) e.Parameter);
OnNavigatedToSmart(e, obj);
}
@Nilzor
Nilzor / DarkTheme.xaml
Created November 14, 2012 15:32
Dark Theme Resource Dictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- Default theme resources -->
<!--
******************************************************************
DEFAULT COMMON CONTROL PROPERTIES
******************************************************************
@Nilzor
Nilzor / statehelper.cs
Created November 15, 2012 13:04
StateHelper
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight.Messaging;
using GTWin8.Messages;
using GTWin8.Ui;
using Windows.UI.Xaml;
@Nilzor
Nilzor / GridLayoutSquares.xml
Created January 25, 2013 10:26
Grid Layout 2x2 attempt equal sized, screen-filling attempt
<?xml version="1.0" encoding="utf-8"?>
<!-- REMEMBER TO UPDATE BOTH LANDSCAPE AND PORTRAIT FILES -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Setting up GridLayout support library in IntelliJ: http://stackoverflow.com/questions/12468606/intellij-and-android-support-v7-widget-gridlayout -->
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
@Nilzor
Nilzor / ExceptionExtensions.cs
Created February 8, 2013 08:43
A handy Exception extension class exposing GetAsString()
public static class ExceptionExtensions
{
public static string GetAsString(this Exception ex)
{
StringBuilder sb = new StringBuilder();
AppendDefaultExceptionString(ex, sb);
return sb.ToString();
}
private static void AppendDefaultExceptionString(this Exception ex, StringBuilder sb)