Permalink
Browse files

WinRT live tile example

  • Loading branch information...
1 parent 5c39895 commit 7bc01d242422a31fa4ea25defe384a3914aae428 @mikoskinen committed Jul 3, 2012
Showing with 59,361 additions and 0 deletions.
  1. +14 −0 WinRT-Live-Tile-Notification-Queue/Backend/App.config
  2. +85 −0 WinRT-Live-Tile-Notification-Queue/Backend/Backend.csproj
  3. +55 −0 WinRT-Live-Tile-Notification-Queue/Backend/Program.cs
  4. +36 −0 WinRT-Live-Tile-Notification-Queue/Backend/Properties/AssemblyInfo.cs
  5. +8 −0 WinRT-Live-Tile-Notification-Queue/Backend/packages.config
  6. +20 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/App.xaml
  7. +85 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/App.xaml.cs
  8. BIN WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Assets/Logo.png
  9. BIN WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Assets/SmallLogo.png
  10. BIN WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Assets/SplashScreen.png
  11. BIN WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Assets/StoreLogo.png
  12. BIN WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Assets/WideLogo.png
  13. +1,007 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Common/StandardStyles.xaml
  14. +14 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/MainPage.xaml
  15. +67 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/MainPage.xaml.cs
  16. +27 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Package.appxmanifest
  17. +29 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Properties/AssemblyInfo.cs
  18. +156 −0 WinRT-Live-Tile-Notification-Queue/Scenario1_Local_Updates/Scenario1_Local_Updates.csproj
  19. BIN ...le-Notification-Queue/Scenario1_Local_Updates/WinRT-Live-Tile-Notification-Queue_TemporaryKey.pfx
  20. +20 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/App.xaml
  21. +85 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/App.xaml.cs
  22. BIN WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Assets/Logo.png
  23. BIN WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Assets/SmallLogo.png
  24. BIN WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Assets/SplashScreen.png
  25. BIN WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Assets/StoreLogo.png
  26. BIN WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Assets/WideLogo.png
  27. +1,007 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Common/StandardStyles.xaml
  28. +14 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/MainPage.xaml
  29. +51 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/MainPage.xaml.cs
  30. +27 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Package.appxmanifest
  31. +29 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Properties/AssemblyInfo.cs
  32. +152 −0 WinRT-Live-Tile-Notification-Queue/Scenario2_Periodic_Updates/Scenario2_Periodic_Updates.csproj
  33. BIN ...ve-Tile-Notification-Queue/Scenario2_Periodic_Updates/Scenario2_Periodic_Updates_TemporaryKey.pfx
  34. +13 −0 WinRT-Live-Tile-Notification-Queue/Tile-Generator/Generator.vb
  35. +31 −0 WinRT-Live-Tile-Notification-Queue/Tile-Generator/My Project/AssemblyInfo.vb
  36. +70 −0 WinRT-Live-Tile-Notification-Queue/Tile-Generator/Tile-Generator.vbproj
  37. +96 −0 WinRT-Live-Tile-Notification-Queue/WinRT-Live-Tile-Notification-Queue.sln
  38. BIN ...kages/Microsoft.AspNet.WebApi.Client.4.0.20505.0/Microsoft.AspNet.WebApi.Client.4.0.20505.0.nupkg
  39. BIN ...ueue/packages/Microsoft.AspNet.WebApi.Client.4.0.20505.0/lib/net40/System.Net.Http.Formatting.dll
  40. +1,121 −0 ...ueue/packages/Microsoft.AspNet.WebApi.Client.4.0.20505.0/lib/net40/System.Net.Http.Formatting.xml
  41. BIN .../packages/Microsoft.AspNet.WebApi.Core.4.0.20505.0/Microsoft.AspNet.WebApi.Core.4.0.20505.0.nupkg
  42. BIN ...otification-Queue/packages/Microsoft.AspNet.WebApi.Core.4.0.20505.0/lib/net40/System.Web.Http.dll
  43. +2,015 −0 ...otification-Queue/packages/Microsoft.AspNet.WebApi.Core.4.0.20505.0/lib/net40/System.Web.Http.xml
  44. BIN ...s/Microsoft.AspNet.WebApi.SelfHost.4.0.20505.0/Microsoft.AspNet.WebApi.SelfHost.4.0.20505.0.nupkg
  45. BIN ...ueue/packages/Microsoft.AspNet.WebApi.SelfHost.4.0.20505.0/lib/net40/System.Web.Http.SelfHost.dll
  46. +145 −0 ...ueue/packages/Microsoft.AspNet.WebApi.SelfHost.4.0.20505.0/lib/net40/System.Web.Http.SelfHost.xml
  47. BIN ...e-Notification-Queue/packages/Microsoft.Net.Http.2.0.20505.0/Microsoft.Net.Http.2.0.20505.0.nupkg
  48. BIN ...tification-Queue/packages/Microsoft.Net.Http.2.0.20505.0/lib/net40/System.Net.Http.WebRequest.dll
  49. +59 −0 ...tification-Queue/packages/Microsoft.Net.Http.2.0.20505.0/lib/net40/System.Net.Http.WebRequest.xml
  50. BIN ...ive-Tile-Notification-Queue/packages/Microsoft.Net.Http.2.0.20505.0/lib/net40/System.Net.Http.dll
  51. +1,920 −0 ...ive-Tile-Notification-Queue/packages/Microsoft.Net.Http.2.0.20505.0/lib/net40/System.Net.Http.xml
  52. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/Newtonsoft.Json.4.5.7.nupkg
  53. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.dll
  54. +8,204 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.xml
  55. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.dll
  56. +7,340 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.xml
  57. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.dll
  58. +7,583 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.xml
  59. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.dll
  60. +6,883 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.xml
  61. BIN ...Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.dll
  62. +6,883 −0 ...Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.xml
  63. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.dll
  64. +6,905 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.xml
  65. BIN WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.dll
  66. +7,101 −0 WinRT-Live-Tile-Notification-Queue/packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.xml
  67. +4 −0 WinRT-Live-Tile-Notification-Queue/packages/repositories.config
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{A04E88BF-BC9A-4ADB-99E1-1F2FF4BD867E}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Backend</RootNamespace>
+ <AssemblyName>Backend</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net.Http">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Net.Http.2.0.20505.0\lib\net40\System.Net.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.20505.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.WebRequest">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Net.Http.2.0.20505.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20505.0\lib\net40\System.Web.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.20505.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tile-Generator\Tile-Generator.vbproj">
+ <Project>{3a80ec01-4932-4ac5-8936-c23dab2abace}</Project>
+ <Name>Tile-Generator</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.Http;
+using System.Web.Http.SelfHost;
+using Tile_Generator;
+
+namespace Backend
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var config = new HttpSelfHostConfiguration("http://localhost:8080");
+
+ config.Routes.MapHttpRoute("Default", "api/{controller}/{id}",
+ new { id = RouteParameter.Optional });
+
+ config.Formatters.RemoveAt(0);
+
+ using (var server = new HttpSelfHostServer(config))
+ {
+ server.OpenAsync().Wait();
+
+ Console.WriteLine("Press Enter to quit.");
+ Console.ReadLine();
+ }
+ }
+
+ }
+
+ public class TileUpdaterController : ApiController
+ {
+ public HttpResponseMessage Get(int position)
+ {
+ var msg = string.Format("Received request for position {0}", position);
+ Console.WriteLine(msg);
+
+ var tileTitle = string.Format("Backend Noti {0}", position);
+ var tilesSubtitle = DateTime.UtcNow.AddHours(position);
+
+ var result = Generator.Generate(tileTitle, tilesSubtitle);
+
+ var response = Request.CreateResponse(HttpStatusCode.OK, result);
+ response.Headers.Add("X-WNS-Expires", tilesSubtitle.AddMinutes(15).ToString("r"));
+ response.Headers.Add("X-WNS-Tag", position.ToString());
+
+ return response;
+ }
+ }
+}
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Backend")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Backend")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b2ca879c-6d46-4fa3-9f2f-9f16d6be4e06")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.AspNet.WebApi.Client" version="4.0.20505.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Core" version="4.0.20505.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.20505.0" targetFramework="net45" />
+ <package id="Microsoft.Net.Http" version="2.0.20505.0" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="4.5.7" targetFramework="net45" />
+</packages>
@@ -0,0 +1,20 @@
+<Application
+ x:Class="WinRT_Live_Tile_Notification_Queue.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:WinRT_Live_Tile_Notification_Queue">
+
+ <Application.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+
+ <!--
+ Styles that define common aspects of the platform look and feel
+ Required by Visual Studio project and item templates
+ -->
+ <ResourceDictionary Source="Common/StandardStyles.xaml"/>
+ </ResourceDictionary.MergedDictionaries>
+
+ </ResourceDictionary>
+ </Application.Resources>
+</Application>
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.Activation;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Notifications;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
+
+namespace WinRT_Live_Tile_Notification_Queue
+{
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ sealed partial class App : Application
+ {
+ /// <summary>
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ /// </summary>
+ public App()
+ {
+ this.InitializeComponent();
+ this.Suspending += OnSuspending;
+ TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
+ }
+
+ /// <summary>
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used when the application is launched to open a specific file, to display
+ /// search results, and so forth.
+ /// </summary>
+ /// <param name="args">Details about the launch request and process.</param>
+ protected override void OnLaunched(LaunchActivatedEventArgs args)
+ {
+ // Do not repeat app initialization when already running, just ensure that
+ // the window is active
+ if (args.PreviousExecutionState == ApplicationExecutionState.Running)
+ {
+ Window.Current.Activate();
+ return;
+ }
+
+ if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
+
+ // Create a Frame to act navigation context and navigate to the first page
+ var rootFrame = new Frame();
+ if (!rootFrame.Navigate(typeof(MainPage)))
+ {
+ throw new Exception("Failed to create initial page");
+ }
+
+ // Place the frame in the current Window and ensure that it is active
+ Window.Current.Content = rootFrame;
+ Window.Current.Activate();
+ }
+
+ /// <summary>
+ /// Invoked when application execution is being suspended. Application state is saved
+ /// without knowing whether the application will be terminated or resumed with the contents
+ /// of memory still intact.
+ /// </summary>
+ /// <param name="sender">The source of the suspend request.</param>
+ /// <param name="e">Details about the suspend request.</param>
+ private void OnSuspending(object sender, SuspendingEventArgs e)
+ {
+ var deferral = e.SuspendingOperation.GetDeferral();
+ //TODO: Save application state and stop any background activity
+ deferral.Complete();
+ }
+ }
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong. Retry.

0 comments on commit 7bc01d2

Please sign in to comment.