From 09f1d327a793909c494f97a7e02b0b4ac9677fc8 Mon Sep 17 00:00:00 2001 From: Satyam Bandarapu Date: Thu, 29 Jan 2015 11:20:02 +0200 Subject: [PATCH] Bug fiexes+coding format included --- Activities/AboutPage.xaml | 8 +- Activities/AboutPage.xaml.cs | 56 +++-- Activities/App.xaml | 1 - Activities/App.xaml.cs | 44 ++-- .../Converters/ActivityToActivityHint.cs | 66 ++++- Activities/Converters/ActivityToImage.cs | 46 +++- Activities/Converters/ElipsisVisible.cs | 47 +++- Activities/Converters/TimeSpanToString.cs | 48 +++- Activities/Converters/TimeSpanToWidth.cs | 48 +++- Activities/Converters/TimeWindowToString.cs | 60 ++++- Activities/Data/MyData.cs | 228 ++++++++++++------ Activities/Data/MyDesignData.cs | 102 ++++++-- Activities/MainPage.xaml | 15 +- Activities/MainPage.xaml.cs | 111 ++++++--- Activities/Package.appxmanifest | 8 +- Activities/activities.csproj | 8 - Licence.txt | 45 ---- README.md | 21 +- 18 files changed, 636 insertions(+), 326 deletions(-) delete mode 100644 Licence.txt diff --git a/Activities/AboutPage.xaml b/Activities/AboutPage.xaml index 9b643f9..c413db6 100644 --- a/Activities/AboutPage.xaml +++ b/Activities/AboutPage.xaml @@ -7,26 +7,21 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="#FF1bA1E2"> - - - - - @@ -49,6 +44,5 @@ - - + \ No newline at end of file diff --git a/Activities/AboutPage.xaml.cs b/Activities/AboutPage.xaml.cs index b5533b7..962a3a7 100644 --- a/Activities/AboutPage.xaml.cs +++ b/Activities/AboutPage.xaml.cs @@ -1,31 +1,36 @@ -/* - * Copyright (c) 2014 Microsoft Mobile. All rights reserved. - * See the license text file provided with this project for more information. - */ +/* +Copyright (c) 2015 Microsoft -using Windows.UI.Xaml.Documents; +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ using System; -using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.Graphics.Display; -using Windows.UI.ViewManagement; 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; using Windows.Storage; using System.Xml; using System.Xml.Linq; -// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556 - +/// +/// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556 +/// namespace ActivitiesExample { /// @@ -33,18 +38,23 @@ namespace ActivitiesExample /// public sealed partial class AboutPage : Page { - + /// + /// Constructor + /// public AboutPage() { this.InitializeComponent(); - Loaded += AboutPage_Loaded; } + /// + /// Loaded event raised after the component is initialized + /// + /// The sender of the event + /// Event arguments async void AboutPage_Loaded(object sender, RoutedEventArgs e) { string version = ""; - var uri = new System.Uri("ms-appx:///AppxManifest.xml"); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri); using (var rastream = await file.OpenReadAsync()) @@ -64,9 +74,7 @@ namespace ActivitiesExample } } } - VersionNumber.Text = version; } - } -} +} \ No newline at end of file diff --git a/Activities/App.xaml b/Activities/App.xaml index 893e99a..e973c8a 100644 --- a/Activities/App.xaml +++ b/Activities/App.xaml @@ -3,5 +3,4 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Activities"> - diff --git a/Activities/App.xaml.cs b/Activities/App.xaml.cs index 85ac877..5f4cc84 100644 --- a/Activities/App.xaml.cs +++ b/Activities/App.xaml.cs @@ -1,21 +1,35 @@ -/* - * Copyright (c) 2014 Microsoft Mobile. All rights reserved. - * See the license text file provided with this project for more information. - */ +/* +Copyright (c) 2015 Microsoft +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ using System; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; -using Windows.Foundation; using Windows.Phone.UI.Input; 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 Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556 +/// namespace ActivitiesExample { /// @@ -47,7 +61,6 @@ namespace ActivitiesExample { return; } - if (frame.CanGoBack) { frame.GoBack(); @@ -63,7 +76,6 @@ namespace ActivitiesExample /// Details about the launch request and process. protected override void OnLaunched(LaunchActivatedEventArgs e) { - #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { @@ -71,28 +83,22 @@ namespace ActivitiesExample } #endif Frame rootFrame = Window.Current.Content as Frame; - // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); - // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; - rootFrame.NavigationFailed += OnNavigationFailed; - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { - //TODO: Load state from previously suspended application + //Load state from previously suspended application } - // Place the frame in the current Window Window.Current.Content = rootFrame; } - if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, @@ -124,7 +130,7 @@ namespace ActivitiesExample private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity + //Save application state and stop any background activity deferral.Complete(); } } diff --git a/Activities/Converters/ActivityToActivityHint.cs b/Activities/Converters/ActivityToActivityHint.cs index 18bd197..1c32d20 100644 --- a/Activities/Converters/ActivityToActivityHint.cs +++ b/Activities/Converters/ActivityToActivityHint.cs @@ -1,4 +1,25 @@ -using Lumia.Sense; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using Lumia.Sense; using System; using System.Collections.Generic; using System.Linq; @@ -9,42 +30,63 @@ using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert activity to activity hint + /// class ActivityToActivityHint : IValueConverter { - private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources"); + #region Private members + /// + /// Constructs a new ResourceLoader object + /// + private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("Resources"); + #endregion + /// + /// Get activity description + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { string hint = ""; - switch(((string)value).ToLower()) { case "moving": - hint = this.resourceLoader.GetString("Hint/Moving"); + hint = this._resourceLoader.GetString("Hint/Moving"); break; case "idle": - hint = this.resourceLoader.GetString("Hint/Idle"); + hint = this._resourceLoader.GetString("Hint/Idle"); break; case "stationary": - hint = this.resourceLoader.GetString("Hint/Stationary"); + hint = this._resourceLoader.GetString("Hint/Stationary"); break; case "walking": - hint = this.resourceLoader.GetString("Hint/Walking"); + hint = this._resourceLoader.GetString("Hint/Walking"); break; case "running": - hint = this.resourceLoader.GetString("Hint/Running"); + hint = this._resourceLoader.GetString("Hint/Running"); break; default: break; - } - + } return hint; } + /// + /// Remove activity description + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } -} +} \ No newline at end of file diff --git a/Activities/Converters/ActivityToImage.cs b/Activities/Converters/ActivityToImage.cs index cb0d9f7..5034b5f 100644 --- a/Activities/Converters/ActivityToImage.cs +++ b/Activities/Converters/ActivityToImage.cs @@ -1,25 +1,59 @@ -using Lumia.Sense; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert activity to image + /// class ActivityToImage : IValueConverter { + /// + /// Get activity icon + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { Uri uri = new Uri("ms-appx:///Assets/Activities/" + ((string)value).ToLower() + ".png", UriKind.Absolute); return uri; } + /// + /// Remove activity icon + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } diff --git a/Activities/Converters/ElipsisVisible.cs b/Activities/Converters/ElipsisVisible.cs index a8b04bf..b465b6d 100644 --- a/Activities/Converters/ElipsisVisible.cs +++ b/Activities/Converters/ElipsisVisible.cs @@ -1,24 +1,59 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using System; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert time span to elipsis + /// public class ElipsisVisible : IValueConverter { + /// + /// Elipsis added if duration > 12h + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { return ((TimeSpan)value).TotalMinutes >= 720 ? Visibility.Visible:Visibility.Collapsed; } + /// + /// Remove elipsis + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } diff --git a/Activities/Converters/TimeSpanToString.cs b/Activities/Converters/TimeSpanToString.cs index 2c19ecb..3aede15 100644 --- a/Activities/Converters/TimeSpanToString.cs +++ b/Activities/Converters/TimeSpanToString.cs @@ -1,25 +1,59 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Xaml; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using System; using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert time span to string + /// public class TimeSpanToString : IValueConverter { + /// + /// Convert time span to string + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { string result = "(" + ((TimeSpan)value).ToString(@"hh\:mm") + ")"; return result; } + /// + /// Remove time span string + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } diff --git a/Activities/Converters/TimeSpanToWidth.cs b/Activities/Converters/TimeSpanToWidth.cs index 15dfd01..bd67ac1 100644 --- a/Activities/Converters/TimeSpanToWidth.cs +++ b/Activities/Converters/TimeSpanToWidth.cs @@ -1,15 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Xaml; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using System; using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert time span to width + /// public class TimeSpanToWidth : IValueConverter { + /// + /// Convert activity duration to rectangle + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { // 320 is an ugly hardcoded value for list width (350) - elipsis column (30) @@ -18,10 +45,17 @@ namespace ActivitiesExample.Converters return (320 * ((TimeSpan)value).TotalMinutes) / (12*60); } + /// + /// Remove rectangle + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } diff --git a/Activities/Converters/TimeWindowToString.cs b/Activities/Converters/TimeWindowToString.cs index 1ceaee1..5135dd0 100644 --- a/Activities/Converters/TimeWindowToString.cs +++ b/Activities/Converters/TimeWindowToString.cs @@ -1,42 +1,80 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using System; using Windows.ApplicationModel.Resources; using Windows.UI.Xaml.Data; namespace ActivitiesExample.Converters { + /// + /// Helper class to convert time window to string + /// class TimeWindowToString : IValueConverter { - private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources"); + #region Private members + /// + /// Constructs a new ResourceLoader object + /// + private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("Resources"); + #endregion + /// + /// Convert activity time window to string + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, string language) { string twString = ""; - if ((double)value == 0) { - twString = this.resourceLoader.GetString("TimeWindow/Today"); + twString = this._resourceLoader.GetString("TimeWindow/Today"); } else if ((double)value == -1) { - twString = this.resourceLoader.GetString("TimeWindow/Yesterday"); + twString = this._resourceLoader.GetString("TimeWindow/Yesterday"); } else { var sdatefmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("shortdate"); twString = sdatefmt.Format(DateTime.Now.Date.AddDays((double)value)); } - return twString; } + /// + /// Remove time window string + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference + /// An optional parameter to be used in the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. public object ConvertBack(object value, Type targetType, object parameter, string language) { string result = ""; - return result; } } diff --git a/Activities/Data/MyData.cs b/Activities/Data/MyData.cs index 71337e9..5daa9e6 100644 --- a/Activities/Data/MyData.cs +++ b/Activities/Data/MyData.cs @@ -1,32 +1,76 @@ -using Lumia.Sense; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ +using Lumia.Sense; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Popups; -using Windows.UI.Xaml; - namespace ActivitiesExample.Data { + /// + /// Data class for getting users activities + /// public class MyData : INotifyPropertyChanged { - private List _ListData = null; + #region Private members + /// + /// List of activities and durations + /// + private List _listData = null; - private static MyData _self; + /// + /// Data instance + /// + private static MyData _selfData; - private IList _history; - private Activity _activity = Activity.Idle; + /// + /// List of history data + /// + private IList _historyData; - // time window index, 0 = today, -1 = yesterday - private double timeWindowIndex = 0; + /// + /// Activity instance + /// + private Activity _activityMode = Activity.Idle; + /// + /// Time window index, 0 = today, -1 = yesterday + /// + private double _timeWindowIndex = 0; + #endregion + + /// + /// Occurs when a property value changes. + /// public event PropertyChangedEventHandler PropertyChanged; + /// + /// This method is called by the Set accessor of each property. + /// The CallerMemberName attribute that is applied to the optional propertyName + /// parameter causes the property name of the caller to be substituted as an argument. + /// + /// private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { if (PropertyChanged != null) @@ -35,194 +79,228 @@ namespace ActivitiesExample.Data } } + /// + /// Constructor + /// public MyData() { - _ListData = new List(); + _listData = new List(); } + /// + /// Create new instance of the class + /// + /// Data instance static public MyData Instance() { - if (_self == null) - _self = new MyData(); - return _self; + if (_selfData == null) + _selfData = new MyData(); + return _selfData; } + /// + /// Get the current activity + /// public string CurrentActivity { get { - return _activity.ToString().ToLower(); + return _activityMode.ToString().ToLower(); } } + /// + /// Set the current activity + /// public Activity ActivityEnum { set { - _activity = value; + _activityMode = value; NotifyPropertyChanged("CurrentActivity"); } } + /// + /// Get the time window + /// public double TimeWindow { get { - return timeWindowIndex; + return _timeWindowIndex; } } + /// + /// Set the time window to today + /// public void NextDay() { - if (timeWindowIndex < 0) + if (_timeWindowIndex < 0) { - timeWindowIndex++; + _timeWindowIndex++; NotifyPropertyChanged("TimeWindow"); } } + + /// + /// Set the time window to previous day + /// public void PreviousDay() { - if (timeWindowIndex >= -9) + if (_timeWindowIndex >= -9) { - timeWindowIndex--; + _timeWindowIndex--; NotifyPropertyChanged("TimeWindow"); } } + + /// + /// List of activities occured during given time period. + /// public IList History { - get + get { - return _history; + return _historyData; } set { - if (_history == null) + if (_historyData == null) { - _history = new List(); + _historyData = new List(); } else { - _history.Clear(); + _historyData.Clear(); } - - _history = value; + _historyData = value; QuantifyData(); } } + /// + /// Get the list of activities and durations + /// public List ListData { get { - return _ListData; + return _listData; } } + /// + /// Populate the list of activities and durations to display in the UI + /// private void QuantifyData() { - if (_ListData != null) + if (_listData != null) { - _ListData.Clear(); + _listData.Clear(); } - - _ListData = new List(); - + _listData = new List(); if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled) { List _activitiesList = new List(Enum.GetNames(typeof(Activity))); Dictionary indexer = new Dictionary(); TimeSpan[] _durations = new TimeSpan[_activitiesList.Count]; - Activity[] values = (Activity[])Enum.GetValues(typeof(Activity)); for (int i = 0; i < values.Length; i++) { indexer.Add(values[i], i); } - - // there could be days with no data (e.g. of phone was turned off) - if(_history.Count>0) + // There could be days with no data (e.g. of phone was turned off) + if (_historyData.Count > 0) { - // first entry may be from previous time window, is there any data from current time window? + // First entry may be from previous time window, is there any data from current time window? bool hasDataInTimeWindow = false; - - // insert new fist entry, representing the last activity of the previous time window + + // Insert new fist entry, representing the last activity of the previous time window // this helps capture that activity's duration but only from the start of current time window - ActivityMonitorReading first = _history[0]; - if(first.Timestamp <= DateTime.Now.Date.AddDays(timeWindowIndex)) + ActivityMonitorReading first = _historyData[0]; + if (first.Timestamp <= DateTime.Now.Date.AddDays(_timeWindowIndex)) { - // create new "first" entry, with the same mode but timestamp set as 0:00h in current time window - _history.Insert(1, new ActivityMonitorReading(first.Mode, DateTime.Now.Date.AddDays(timeWindowIndex))); - // remove previous entry - _history.RemoveAt(0); - hasDataInTimeWindow = _history.Count > 1; + // Create new "first" entry, with the same mode but timestamp set as 0:00h in current time window + _historyData.Insert(1, new ActivityMonitorReading(first.Mode, DateTime.Now.Date.AddDays(_timeWindowIndex))); + // Remove previous entry + _historyData.RemoveAt(0); + hasDataInTimeWindow = _historyData.Count > 1; } else { - // the first entry belongs to the current time window + // The first entry belongs to the current time window // there is no known activity before it hasDataInTimeWindow = true; } - - // if at least one activity is recorded in this time window - if(hasDataInTimeWindow) + // If at least one activity is recorded in this time window + if (hasDataInTimeWindow) { - // insert a last activity, marking the begining of the next time window + // Insert a last activity, marking the begining of the next time window // this helps capturing the correct duration of the last activity stated in this time window - ActivityMonitorReading last = _history.Last(); - if (last.Timestamp < DateTime.Now.Date.AddDays(timeWindowIndex + 1)) + ActivityMonitorReading last = _historyData.Last(); + if (last.Timestamp < DateTime.Now.Date.AddDays(_timeWindowIndex + 1)) { - // is this today's time window - if (timeWindowIndex == 0) + // Is this today's time window + if (_timeWindowIndex == 0) { - // last activity duration measured until this instant time - _history.Add(new ActivityMonitorReading(last.Mode, DateTime.Now)); + // Last activity duration measured until this instant time + _historyData.Add(new ActivityMonitorReading(last.Mode, DateTime.Now)); } else { - // last activity measured until the begining of the next time index - _history.Add(new ActivityMonitorReading(last.Mode, DateTime.Now.Date.AddDays(timeWindowIndex + 1))); + // Last activity measured until the begining of the next time index + _historyData.Add(new ActivityMonitorReading(last.Mode, DateTime.Now.Date.AddDays(_timeWindowIndex + 1))); } } - - // calculate duration for each current activity by subtracting its timestamp from that of the next one - for (int i = 0; i < _history.Count - 1; i++) + // Calculate duration for each current activity by subtracting its timestamp from that of the next one + for (int i = 0; i < _historyData.Count - 1; i++) { - ActivityMonitorReading current = _history[i]; - ActivityMonitorReading next = _history[i + 1]; - + ActivityMonitorReading current = _historyData[i]; + ActivityMonitorReading next = _historyData[i + 1]; _durations[indexer[current.Mode]] += next.Timestamp - current.Timestamp; } } } - - // populate the list to be displayed in the UI + // Populate the list to be displayed in the UI for (int i = 0; i < _activitiesList.Count; i++) { - _ListData.Add(new MyQuantifiedData(_activitiesList[i], _durations[i])); + _listData.Add(new MyQuantifiedData(_activitiesList[i], _durations[i])); } } - NotifyPropertyChanged("ListData"); } - } + /// + /// Helper class to create a list of activities and their timestamp + /// public class MyQuantifiedData { + /// + /// Constructor + /// public MyQuantifiedData(string s, TimeSpan i) { ActivityName = s; ActivityTime = i; } + /// + /// Activity name + /// public string ActivityName { get; set; } + /// + /// Activity time + /// public TimeSpan ActivityTime { get; diff --git a/Activities/Data/MyDesignData.cs b/Activities/Data/MyDesignData.cs index db3c6ca..34c5836 100644 --- a/Activities/Data/MyDesignData.cs +++ b/Activities/Data/MyDesignData.cs @@ -1,27 +1,64 @@ -using Lumia.Sense; +/* +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Xaml; - namespace ActivitiesExample.Data { + /// + /// Data class for design mode + /// public class MyDesignData : INotifyPropertyChanged { - private List _ListData = null; - private static MyDesignData _self; + #region Private members + /// + /// List of activities and durations + /// + private List _listData = null; - // time window index, 0 = today, -1 = yesterday - private double timeWindowIndex = 0; + /// + /// Design data instance + /// + private static MyDesignData _selfData; + /// + /// Time window index, 0 = today, -1 = yesterday + /// + private double _timeWindowIndex = 0; + #endregion + + /// + /// Occurs when a property value changes. + /// public event PropertyChangedEventHandler PropertyChanged; + /// + /// This method is called by the Set accessor of each property. + /// The CallerMemberName attribute that is applied to the optional propertyName + /// parameter causes the property name of the caller to be substituted as an argument + /// + /// private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { if (PropertyChanged != null) @@ -30,27 +67,36 @@ namespace ActivitiesExample.Data } } + /// + /// Constructor + /// public MyDesignData() { - _ListData = new List(); - + _listData = new List(); if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { - _ListData.Add(new MyQuantifiedData("Idle", new TimeSpan(13, 0, 0))); - _ListData.Add(new MyQuantifiedData("Moving", new TimeSpan(4, 0, 0))); - _ListData.Add(new MyQuantifiedData("Stationary", new TimeSpan(1, 0, 0))); - _ListData.Add(new MyQuantifiedData("Walking", new TimeSpan(2, 0, 0))); - _ListData.Add(new MyQuantifiedData("Running", new TimeSpan(3, 0, 0))); + _listData.Add(new MyQuantifiedData("Idle", new TimeSpan(13, 0, 0))); + _listData.Add(new MyQuantifiedData("Moving", new TimeSpan(4, 0, 0))); + _listData.Add(new MyQuantifiedData("Stationary", new TimeSpan(1, 0, 0))); + _listData.Add(new MyQuantifiedData("Walking", new TimeSpan(2, 0, 0))); + _listData.Add(new MyQuantifiedData("Running", new TimeSpan(3, 0, 0))); } } + /// + /// Create new instance of the class + /// + /// Design data instance static public MyDesignData Instance() { - if (_self == null) - _self = new MyDesignData(); - return _self; + if (_selfData == null) + _selfData = new MyDesignData(); + return _selfData; } + /// + /// Get the current activity + /// public string CurrentActivity { get @@ -59,22 +105,26 @@ namespace ActivitiesExample.Data } } + /// + /// Get the list of activities and durations + /// public List ListData { get { - return _ListData; + return _listData; } } + /// + /// Get the time window + /// public double TimeWindow { get { - return timeWindowIndex; + return _timeWindowIndex; } } - } - -} +} \ No newline at end of file diff --git a/Activities/MainPage.xaml b/Activities/MainPage.xaml index 1494aed..cc03dfa 100644 --- a/Activities/MainPage.xaml +++ b/Activities/MainPage.xaml @@ -10,7 +10,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="#FF1bA1E2"> - @@ -19,19 +18,16 @@ - - - @@ -40,16 +36,13 @@ - - - @@ -85,7 +78,6 @@ - @@ -103,10 +95,9 @@ - - + @@ -116,16 +107,14 @@ - + - - diff --git a/Activities/MainPage.xaml.cs b/Activities/MainPage.xaml.cs index 3950584..849767f 100644 --- a/Activities/MainPage.xaml.cs +++ b/Activities/MainPage.xaml.cs @@ -1,20 +1,28 @@ -/* - * Copyright (c) 2014 Microsoft Mobile. All rights reserved. - * See the license text file provided with this project for more information. - */ +/* +Copyright (c) 2015 Microsoft +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + */ using System; -using Windows.Foundation; 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; -using System.Windows; -using System.Collections.Generic; -using Windows.ApplicationModel.Core; using Windows.UI.Core; using Windows.UI.Popups; using System.Threading.Tasks; @@ -25,6 +33,9 @@ using Windows.Security.ExchangeActiveSyncProvisioning; using Lumia.Sense.Testing; using Windows.ApplicationModel.Resources; +/// +/// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556 +/// namespace ActivitiesExample { /// @@ -37,8 +48,16 @@ namespace ActivitiesExample /// Activity monitor instance /// private IActivityMonitor _activityMonitor = null; + + /// + /// Check if running in emulator + /// private bool _runningInEmulator = false; - private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources"); + + /// + /// Constructs a new ResourceLoader object + /// + private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("Resources"); #endregion @@ -49,9 +68,7 @@ namespace ActivitiesExample { InitializeComponent(); DataContext = MyData.Instance(); - Loaded += MainPage_Loaded; - //Using this method to detect if the application runs in the emulator or on a real device. Later the *Simulator API is used to read fake sense data on emulator. //In production code you do not need this and in fact you should ensure that you do not include the Lumia.Sense.Test reference in your project. EasClientDeviceInformation x = new EasClientDeviceInformation(); @@ -61,19 +78,23 @@ namespace ActivitiesExample } } + /// + /// Loaded event raised after the component is initialized + /// + /// The sender of the event + /// Event argument async void MainPage_Loaded(object sender, RoutedEventArgs e) { if (!_runningInEmulator && !await ActivityMonitor.IsSupportedAsync()) { - // nothing to do if we cannot use the API + // Nothing to do if we cannot use the API // In a real app please do make an effort to create a better user experience. // e.g. if access to Activity Monitor is not mission critical, let the app run without showing any error message // simply hide the features that depend on it - MessageDialog md = new MessageDialog(this.resourceLoader.GetString("FeatureNotSupported/Message"), this.resourceLoader.GetString("FeatureNotSupported/Title")); + MessageDialog md = new MessageDialog(this._resourceLoader.GetString("FeatureNotSupported/Message"), this._resourceLoader.GetString("FeatureNotSupported/Title")); await md.ShowAsync(); Application.Current.Exit(); } - Initialize(); } @@ -92,14 +113,12 @@ namespace ActivitiesExample { await CallSensorCoreApiAsync(async () => { _activityMonitor = await ActivityMonitor.GetDefaultAsync(); }); } - if (_activityMonitor!=null) { // Set activity observer _activityMonitor.ReadingChanged += activityMonitor_ReadingChanged; _activityMonitor.Enabled = true; - - // read current activity + // Read current activity ActivityMonitorReading reading = null; if (await CallSensorCoreApiAsync(async () => { reading = await _activityMonitor.GetCurrentReadingAsync(); })) { @@ -108,17 +127,15 @@ namespace ActivitiesExample MyData.Instance().ActivityEnum = reading.Mode; } } - - // read logged data + // Read logged data PollHistory(); } else { - // nothing to do if we cannot use the API + // Nothing to do if we cannot use the API // in a real app do make an effort to make the user experience better Application.Current.Exit(); } - // Must call DeactivateAsync() when the application goes to background Window.Current.VisibilityChanged += async (sender, args) => { @@ -138,13 +155,12 @@ namespace ActivitiesExample } }; } - } /// /// Performs asynchronous Sense SDK operation and handles any exceptions /// - /// + /// The function delegate to execute asynchronously when one task in the tasks completes /// true if call was successful, false otherwise private async Task CallSensorCoreApiAsync(Func action) { @@ -158,7 +174,6 @@ namespace ActivitiesExample failure = e; Debug.WriteLine("Failure:" + e.Message); } - if (failure != null) { try @@ -167,21 +182,19 @@ namespace ActivitiesExample switch (SenseHelper.GetSenseError(failure.HResult)) { case SenseError.LocationDisabled: - dialog = new MessageDialog(this.resourceLoader.GetString("FeatureDisabled/Location"), this.resourceLoader.GetString("FeatureDisabled/Title")); + dialog = new MessageDialog(this._resourceLoader.GetString("FeatureDisabled/Location"), this._resourceLoader.GetString("FeatureDisabled/Title")); dialog.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(async (cmd) => await SenseHelper.LaunchLocationSettingsAsync()))); dialog.Commands.Add(new UICommand("No")); await dialog.ShowAsync(); new System.Threading.ManualResetEvent(false).WaitOne(500); return false; - case SenseError.SenseDisabled: - dialog = new MessageDialog(this.resourceLoader.GetString("FeatureDisabled/MotionData"), this.resourceLoader.GetString("FeatureDisabled/InTitle")); + dialog = new MessageDialog(this._resourceLoader.GetString("FeatureDisabled/MotionData"), this._resourceLoader.GetString("FeatureDisabled/InTitle")); dialog.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(async (cmd) => await SenseHelper.LaunchSenseSettingsAsync()))); dialog.Commands.Add(new UICommand("No")); await dialog.ShowAsync(); new System.Threading.ManualResetEvent(false).WaitOne(500); return false; - default: dialog = new MessageDialog("Failure: " + SenseHelper.GetSenseError(failure.HResult), ""); await dialog.ShowAsync(); @@ -246,7 +259,7 @@ namespace ActivitiesExample { if (!await CallSensorCoreApiAsync(async () => { - // get the data for the current 24h time window + // Get the data for the current 24h time window MyData.Instance().History = await _activityMonitor.GetActivityHistoryAsync(DateTime.Now.Date.AddDays(MyData.Instance().TimeWindow), new TimeSpan(24,0,0 )); })) { @@ -255,19 +268,34 @@ namespace ActivitiesExample } } + /// + /// Navigate to about page + /// + /// The sender of the event + /// Event arguments private void AboutButton_Click(object sender, RoutedEventArgs e) { this.Frame.Navigate(typeof(AboutPage)); } + /// + /// Refresh data for the current day + /// + /// The sender of the event + /// Event arguments private void RefreshButton_Click(object sender, RoutedEventArgs e) { PollHistory(); } - private void prevButton_Click(object sender, RoutedEventArgs e) + /// + /// Read the data for the past day + /// + /// The sender of the event + /// Event arguments + private void PrevButton_Click(object sender, RoutedEventArgs e) { - // move the time window 24 to the past + // Move the time window 24 to the past MyData.Instance().PreviousDay(); nextButton.IsEnabled = true; prevButton.IsEnabled = MyData.Instance().TimeWindow > -10; @@ -275,16 +303,19 @@ namespace ActivitiesExample PollHistory(); } - private void nextButton_Click(object sender, RoutedEventArgs e) + /// + /// Read the data for the next day + /// + /// The sender of the event + /// Event arguments + private void NextButton_Click(object sender, RoutedEventArgs e) { - // move the time window 24h to the present + // Move the time window 24h to the present MyData.Instance().NextDay(); nextButton.IsEnabled = MyData.Instance().TimeWindow < 0; prevButton.IsEnabled = true; refreshButton.IsEnabled = MyData.Instance().TimeWindow == 0; PollHistory(); } - } -} - +} \ No newline at end of file diff --git a/Activities/Package.appxmanifest b/Activities/Package.appxmanifest index 1707caa..3ce1913 100644 --- a/Activities/Package.appxmanifest +++ b/Activities/Package.appxmanifest @@ -1,16 +1,16 @@  - + - Activities - Nokia Developer + Activities – Lumia SensorCore SDK sample + Lumia SDK Assets\StoreLogo.png 6.3.0 6.3.0 - + diff --git a/Activities/activities.csproj b/Activities/activities.csproj index 43c5bd0..3ceb8c8 100644 --- a/Activities/activities.csproj +++ b/Activities/activities.csproj @@ -176,14 +176,6 @@ WindowsPhoneApp - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - diff --git a/Licence.txt b/Licence.txt deleted file mode 100644 index 219ecfc..0000000 --- a/Licence.txt +++ /dev/null @@ -1,45 +0,0 @@ -Copyright © 2014 Microsoft Mobile. All rights reserved. - -Microsoft is a registered trademark of Microsoft Corporation. Nokia and HERE are -trademarks and/or registered trademarks of Nokia Corporation. Other product and -company names mentioned herein may be trademarks or trade names of their -respective owners. - - -License - -Subject to the conditions below, you may use, copy, modify and/or merge copies -of this software and associated content and documentation files (the ”Software”) -to test, develop, publish, distribute, sub-license and/or sell new software -derived from or incorporating the Software, solely in connection with Microsoft -Mobile devices (however branded). Some of the documentation, content and/or -software may be licensed under open source software or other licenses. To the -extent such documentation, content and/or software are included, those licenses -and/or other terms and conditions shall apply in addition and/or instead of this -notice. The exact terms of the licenses, disclaimers, acknowledgements and -notices are reproduced in the materials provided, or in other obvious locations. -No other license to any other intellectual property rights is granted herein. - -This file, unmodified, shall be included with all copies or substantial portions -of the Software that are distributed in source code form. - -The Software cannot constitute the primary value of any new software derived -from or incorporating the Software. - -Any person dealing with the Software shall not misrepresent the source of the -Software. - - -Disclaimer - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE, QUALITY AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES (INCLUDING, -WITHOUT LIMITATION, DIRECT, SPECIAL, INDIRECT, PUNITIVE, CONSEQUENTIAL, -EXEMPLARY AND/ OR INCIDENTAL DAMAGES) OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Microsoft Mobile Oy retains the right to make changes to this document at any -time, without notice. diff --git a/README.md b/README.md index 5ac5143..f32473e 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,6 @@ total duration. The application will also register for receiving activity change notifications from the Lumia SensorCore and will display the change dynamically. -For more information on implementation, visit Lumia Developer's Library: -http://developer.nokia.com/resources/library/Lumia/sensorcore-sdk/samples.html -http://developer.nokia.com/resources/library/Lumia/sensorcore-sdk/activity-monitor-api.html - 1. Instructions -------------------------------------------------------------------------------- @@ -79,26 +75,21 @@ file the capabilities required for it to work: -3. License +3. Version history -------------------------------------------------------------------------------- - -See the license text file delivered with this project. The license file is also -available online at https://github.com/Microsoft/activities/blob/master/Licence.txt - - -4. Version history --------------------------------------------------------------------------------- - +* Version 1.1.0.13: + * Some bug fixes made in this release. * Version 1.0: The first release. -5. Downloads +4. Downloads --------- | Project | Release | Download | | ------- | --------| -------- | +| Activities | v1.1.0.13 | [activities-1.1.0.13.zip](https://github.com/Microsoft/activities/archive/v1.1.0.13.zip) | | Activities | v1.0 | [activities-1.0.zip](https://github.com/Microsoft/activities/archive/v1.0.zip) | -6. See also +5. See also -------------------------------------------------------------------------------- The projects listed below are exemplifying the usage of the SensorCore APIs