Skip to content

Instantly share code, notes, and snippets.

public static TResult GetFirstResult<TSource, TResult>(
IEnumerable<TSource> source, Func<TSource, TResult> invokeAction)
{
if (source== null)
{
throw new ArgumentNullException("source");
}
if (invokeAction== null)
public static class StringExtensions
{
public static readonly string CHAR_UNICODE_HEX_FORMAT = "{0:x4}";
public static readonly string CHAR_UNICODE_PREFIX = "&#{0};";
public static string EncodeUnicodeChars(this string srcString)
{
if (srcString == null)
{
public static readonly string CHAR_UNICODE_FORMAT = "&#{0};";
public static string EncodeUnicodeChars(this string srcString)
{
if (srcString == null)
{
throw new ArgumentNullException("srcString");
}
return srcString.Aggregate(new StringBuilder(),
<ListBox Name="lstPosts" Margin="0,10,0,0" ItemsSource="{Binding SelectedSite.Posts}" Grid.Row="2" SelectedItem="{Binding SelectedPost, Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneForegroundBrush}" CornerRadius="20" BorderThickness="0 0 0 2" Margin="0 2" >
<TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}" Width="{Binding ElementName=lstPosts, Path=ActualWidth}"/>
</Border>
</DataTemplate>
browser.NavigateToString(htmlString);
public static class StringExtensions
{
public static readonly string CHAR_UNICODE_FORMAT = "&#{0};";
public static readonly int ASCII_INDEX = 127;
//Dirty fix for WP7 browser
public static string EncodeUnicodeChars(this string srcString)
{
if (srcString == null)
public class WebBrowserNavigateBehavior : Behavior<WebBrowser>
{
public static string GetNavigateText(DependencyObject obj)
{
return (string)obj.GetValue(NavigateText);
}
<controlex:PageBase
xmlns:mybehaviors="clr-namespace:RStein.PosterousReader.WP.Behaviors"
....
....
>
.....
<phone:WebBrowser Name="wbPostBody" mybehaviors:WebBrowserNavigateBehavior.NavigateText="{Binding SelectedPost.Body}">
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{