Skip to content

Instantly share code, notes, and snippets.

@parmarnishant
parmarnishant / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
Observable.Timer(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10))
.ObserveOn(Scheduler.ThreadPool.AsSafe())
.Subscribe(_=> ThreadMethod());
public static class SafeSchedulerExtensions
{
public static IScheduler AsSafe(this IScheduler scheduler)
{
return new SafeScheduler(scheduler);
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
namespace System.Web.Http
{
/// <summary>
/// Extends the HttpRequestMessage collection
IEnumerable<Task<Image>> tasks = s_Domains.Select(GetFavicon);
// The IEnumerable from Select is lazy, so evaluate it to start the tasks
tasks = tasks.ToList();
Task<Image[]> allTask = Task.WhenAll(tasks);
Then, all we have left to do is await the allTask, and use its results:
Image[] images = await allTask;
foreach (Image eachImage in images)
{
AddAFavicon(eachImage);