├── .gitignore ├── LICENSE ├── TemperatureReader.ClientApp ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ ├── TileIconLarge.png │ ├── TileIconSmall.png │ └── Wide310x150Logo.scale-200.png ├── Behaviors │ └── BlinkBehavior.cs ├── Converters │ └── BoolToVisibilityConverter.cs ├── Helpers │ ├── ErrorLogger.cs │ ├── IErrorLogger.cs │ ├── IMessageDisplayer.cs │ └── Toaster.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Messages │ ├── DataReceivedMessage.cs │ └── ResumeMessage.cs ├── Models │ ├── BandOperator.cs │ ├── BandUiController.cs │ ├── BandUiDefinitions.cs │ ├── DateTimeExtensions.cs │ ├── IBandOperator.cs │ ├── ITemperatureListener.cs │ └── TemperatureListener.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml ├── TemperatureReader.ClientApp.csproj ├── TemperatureReader.ClientApp_TemporaryKey.pfx ├── ViewModels │ ├── CrashLoggerViewModel.cs │ └── MainViewModel.cs ├── project.json └── project.lock.json ├── TemperatureReader.Logic ├── Devices │ ├── AnalogTemperatureSensorController.cs │ ├── GpioService.cs │ ├── IAnalogTemperatureSensorController.cs │ ├── IGpioService.cs │ ├── StatusLed.cs │ └── SwitchDevice.cs ├── Models │ └── Thermometer.cs ├── Properties │ ├── AssemblyInfo.cs │ └── TemperatureReader.Logic.rd.xml ├── TemperatureReader.Logic.csproj ├── Utilities │ └── SynchronousWaiter.cs ├── project.json └── project.lock.json ├── TemperatureReader.ServiceBus ├── FanSwitchQueueClient.cs ├── IQueueClient.cs ├── Properties │ ├── AssemblyInfo.cs │ └── TemperatureReader.ServiceBus.rd.xml ├── QueueClient.cs ├── QueueMode.cs ├── TemperatureQueueClient.cs ├── TemperatureReader.ServiceBus.csproj ├── project.json └── project.lock.json ├── TemperatureReader.Shared ├── FanStatus.cs ├── FanSwitchCommand.cs ├── Properties │ └── AssemblyInfo.cs ├── Settings.cs ├── TemperatureData.cs └── TemperatureReader.Shared.csproj ├── TemperatureReader ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml ├── TemperatureReader.csproj ├── TemperatureReader_TemporaryKey.pfx ├── project.json └── project.lock.json └── TemperatureReaderDemo.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.publishsettings 162 | node_modules/ 163 | bower_components/ 164 | 165 | # RIA/Silverlight projects 166 | Generated_Code/ 167 | 168 | # Backup & report files from converting an old project file 169 | # to a newer Visual Studio version. Backup files are not needed, 170 | # because we have git ;-) 171 | _UpgradeReport_Files/ 172 | Backup*/ 173 | UpgradeLog*.XML 174 | UpgradeLog*.htm 175 | 176 | # SQL Server files 177 | *.mdf 178 | *.ldf 179 | 180 | # Business Intelligence projects 181 | *.rdl.data 182 | *.bim.layout 183 | *.bim_*.settings 184 | 185 | # Microsoft Fakes 186 | FakesAssemblies/ 187 | 188 | # Node.js Tools for Visual Studio 189 | .ntvs_analysis.dat 190 | 191 | # Visual Studio 6 build log 192 | *.plg 193 | 194 | # Visual Studio 6 workspace options file 195 | *.opt 196 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Joost van Schaik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/App.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Runtime.InteropServices.WindowsRuntime; 7 | using System.Threading.Tasks; 8 | using Windows.ApplicationModel; 9 | using Windows.ApplicationModel.Activation; 10 | using Windows.Foundation; 11 | using Windows.Foundation.Collections; 12 | using Windows.UI.ViewManagement; 13 | using Windows.UI.Xaml; 14 | using Windows.UI.Xaml.Controls; 15 | using Windows.UI.Xaml.Controls.Primitives; 16 | using Windows.UI.Xaml.Data; 17 | using Windows.UI.Xaml.Input; 18 | using Windows.UI.Xaml.Media; 19 | using Windows.UI.Xaml.Navigation; 20 | using GalaSoft.MvvmLight.Ioc; 21 | using GalaSoft.MvvmLight.Messaging; 22 | using GalaSoft.MvvmLight.Threading; 23 | using TemperatureReader.ClientApp.Helpers; 24 | using TemperatureReader.ClientApp.Messages; 25 | using TemperatureReader.ClientApp.ViewModels; 26 | 27 | namespace TemperatureReader.ClientApp 28 | { 29 | /// 30 | /// Provides application-specific behavior to supplement the default Application class. 31 | /// 32 | sealed partial class App : Application 33 | { 34 | /// 35 | /// Initializes the singleton application object. This is the first line of authored code 36 | /// executed, and as such is the logical equivalent of main() or WinMain(). 37 | /// 38 | public App() 39 | { 40 | SimpleIoc.Default.Register(); 41 | SimpleIoc.Default.Register(); 42 | InitializeComponent(); 43 | Suspending += OnSuspending; 44 | UnhandledException += SimpleIoc.Default.GetInstance().LogUnhandledException; 45 | UnhandledException += App_UnhandledException; 46 | Resuming += App_Resuming; 47 | } 48 | 49 | private void App_Resuming(object sender, object e) 50 | { 51 | Messenger.Default.Send(new ResumeMessage()); 52 | } 53 | 54 | private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e) 55 | { 56 | SimpleIoc.Default.GetInstance().ShowMessage ($"Crashed: {e.Message}"); 57 | } 58 | 59 | /// 60 | /// Invoked when the application is launched normally by the end user. Other entry points 61 | /// will be used such as when the application is launched to open a specific file. 62 | /// 63 | /// Details about the launch request and process. 64 | protected override void OnLaunched(LaunchActivatedEventArgs e) 65 | { 66 | DispatcherHelper.Initialize(); 67 | 68 | MainViewModel.Instance.Init(); 69 | #if DEBUG 70 | if (System.Diagnostics.Debugger.IsAttached) 71 | { 72 | //this.DebugSettings.EnableFrameRateCounter = true; 73 | } 74 | #endif 75 | 76 | 77 | Frame rootFrame = Window.Current.Content as Frame; 78 | 79 | // Do not repeat app initialization when the Window already has content, 80 | // just ensure that the window is active 81 | if (rootFrame == null) 82 | { 83 | // Create a Frame to act as the navigation context and navigate to the first page 84 | rootFrame = new Frame(); 85 | 86 | rootFrame.NavigationFailed += OnNavigationFailed; 87 | 88 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 89 | { 90 | //TODO: Load state from previously suspended application 91 | } 92 | 93 | // Place the frame in the current Window 94 | Window.Current.Content = rootFrame; 95 | } 96 | 97 | if (rootFrame.Content == null) 98 | { 99 | // When the navigation stack isn't restored navigate to the first page, 100 | // configuring the new page by passing required information as a navigation 101 | // parameter 102 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 103 | } 104 | // Ensure the current window is active 105 | 106 | Window.Current.Activate(); 107 | } 108 | 109 | /// 110 | /// Invoked when Navigation to a certain page fails 111 | /// 112 | /// The Frame which failed navigation 113 | /// Details about the navigation failure 114 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 115 | { 116 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 117 | } 118 | 119 | /// 120 | /// Invoked when application execution is being suspended. Application state is saved 121 | /// without knowing whether the application will be terminated or resumed with the contents 122 | /// of memory still intact. 123 | /// 124 | /// The source of the suspend request. 125 | /// Details about the suspend request. 126 | private async void OnSuspending(object sender, SuspendingEventArgs e) 127 | { 128 | var deferral = e.SuspendingOperation.GetDeferral(); 129 | await MainViewModel.Instance.OnSuspend(); 130 | //TODO: Save application state and stop any background activity 131 | deferral.Complete(); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/TileIconLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/TileIconLarge.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/TileIconSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/TileIconSmall.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LocalJoost/TemperatureReaderDemo/181701369c4bad7bfdc1891d011fd27994c8f6f3/TemperatureReader.ClientApp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Behaviors/BlinkBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Windows.UI.Xaml; 3 | using Windows.UI.Xaml.Media; 4 | using Windows.UI.Xaml.Shapes; 5 | using GalaSoft.MvvmLight.Messaging; 6 | using Microsoft.Xaml.Interactivity; 7 | using TemperatureReader.ClientApp.Messages; 8 | 9 | namespace TemperatureReader.ClientApp.Behaviors 10 | { 11 | public class BlinkBehavior : DependencyObject, IBehavior 12 | { 13 | private Shape _shape; 14 | private Brush _originalFillBrush; 15 | private readonly Brush _blinkBrush = Application.Current.Resources["SystemControlHighlightAccentBrush"] as SolidColorBrush; 16 | 17 | public void Attach(DependencyObject associatedObject) 18 | { 19 | AssociatedObject = associatedObject; 20 | _shape = associatedObject as Shape; 21 | if (_shape != null) 22 | { 23 | _originalFillBrush = _shape.Fill; 24 | Messenger.Default.Register(this, OnDateReceivedMessage); 25 | } 26 | } 27 | 28 | private async void OnDateReceivedMessage(DataReceivedMessage mes) 29 | { 30 | _shape.Fill = _blinkBrush; 31 | 32 | await Task.Delay(500); 33 | _shape.Fill = _originalFillBrush; 34 | } 35 | 36 | public void Detach() 37 | { 38 | Messenger.Default.Unregister(this); 39 | if (_shape != null) 40 | { 41 | _shape.Fill = _originalFillBrush; 42 | } 43 | } 44 | 45 | public DependencyObject AssociatedObject { get; private set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Converters/BoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI.Xaml; 3 | using Windows.UI.Xaml.Data; 4 | 5 | namespace TemperatureReader.ClientApp.Converters 6 | { 7 | /// 8 | /// Converts true to the value of parameter 9 | /// 10 | public class BoolToVisibilityConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, string language) 13 | { 14 | if (parameter == null) 15 | { 16 | parameter = Visibility.Visible; 17 | } 18 | 19 | if (value is bool) 20 | { 21 | var bValue = (bool)value; 22 | var visibility = (Visibility)Enum.Parse(typeof(Visibility), parameter.ToString(), true); 23 | if (bValue) return visibility; 24 | return visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible; 25 | } 26 | return parameter; 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, string language) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Helpers/ErrorLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Windows.Storage; 5 | using Windows.UI.Xaml; 6 | 7 | namespace TemperatureReader.ClientApp.Helpers 8 | { 9 | public class ErrorLogger : IErrorLogger 10 | { 11 | private const string LogFile = "crashlog.txt"; 12 | public async void LogUnhandledException(object sender, UnhandledExceptionEventArgs e) 13 | { 14 | await LogException(e.Exception); 15 | } 16 | 17 | public async Task LogException(Exception ex) 18 | { 19 | try 20 | { 21 | var folder = ApplicationData.Current.LocalFolder; 22 | var logFile = await folder.CreateFileAsync(LogFile, CreationCollisionOption.OpenIfExists); 23 | var lines = new List 24 | { 25 | "------------------------", 26 | "Error at " + DateTimeOffset.Now.ToString("yy-MM-yyyy HH:mm:ss"), 27 | }; 28 | if (!string.IsNullOrWhiteSpace(ex.Message)) lines.Add(ex.Message); 29 | if (!string.IsNullOrWhiteSpace(ex.StackTrace)) lines.Add(ex.StackTrace); 30 | await FileIO.AppendLinesAsync(logFile, lines); 31 | } 32 | catch (Exception) 33 | { 34 | } 35 | } 36 | 37 | public async Task> GetLogContents() 38 | { 39 | var result = new List(); 40 | var logFile = await ApplicationData.Current.LocalFolder.TryGetItemAsync(LogFile); 41 | var file = logFile as StorageFile; 42 | if (file != null) 43 | { 44 | var lines = await FileIO.ReadLinesAsync(file); 45 | result.AddRange(lines); 46 | } 47 | return result; 48 | } 49 | 50 | public async Task DeleteLog() 51 | { 52 | var logFile = await ApplicationData.Current.LocalFolder.TryGetItemAsync(LogFile); 53 | var file = logFile as StorageFile; 54 | if (file != null) 55 | { 56 | await file.DeleteAsync(); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Helpers/IErrorLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Windows.UI.Xaml; 5 | 6 | namespace TemperatureReader.ClientApp.Helpers 7 | { 8 | public interface IErrorLogger 9 | { 10 | Task DeleteLog(); 11 | Task> GetLogContents(); 12 | void LogUnhandledException(object sender, UnhandledExceptionEventArgs e); 13 | Task LogException(Exception ex); 14 | } 15 | } -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Helpers/IMessageDisplayer.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace TemperatureReader.ClientApp.Helpers 4 | { 5 | public interface IMessageDisplayer 6 | { 7 | Task ShowMessage(string text); 8 | } 9 | } -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/Helpers/Toaster.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Windows.UI.Notifications; 3 | using NotificationsExtensions.Toasts; 4 | 5 | namespace TemperatureReader.ClientApp.Helpers 6 | { 7 | public class Toaster : IMessageDisplayer 8 | { 9 | public async Task ShowMessage(string text) 10 | { 11 | var content = new ToastContent() 12 | { 13 | 14 | Visual = new ToastVisual() 15 | { 16 | TitleText = new ToastText() 17 | { 18 | Text = "Temperature Listener" 19 | }, 20 | 21 | BodyTextLine1 = new ToastText() 22 | { 23 | Text = text 24 | } 25 | } 26 | }; 27 | 28 | var toast = new ToastNotification(content.GetXml()); 29 | 30 | var toastNotifier = ToastNotificationManager.CreateToastNotifier(); 31 | toastNotifier.Show(toast); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /TemperatureReader.ClientApp/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 73 | 74 |