Bug fiexes+coding format included
This commit is contained in:
Родитель
7bf772c602
Коммит
09f1d327a7
|
@ -7,26 +7,21 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="#FF1bA1E2">
|
||||
|
||||
<Grid x:Name="LayoutRoot">
|
||||
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- TitlePanel -->
|
||||
<StackPanel Grid.Row="0" Margin="24,24,24,0">
|
||||
<TextBlock x:Uid="ApplicationName" Style="{ThemeResource TitleTextBlockStyle}" Typography.Capitals="SmallCaps" Foreground="White"/>
|
||||
<TextBlock x:Uid="AboutPage" Style="{ThemeResource HeaderTextBlockStyle}" Foreground="White"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="24,24,24,0">
|
||||
<RichTextBlock FontSize="16">
|
||||
<Paragraph>
|
||||
|
@ -49,6 +44,5 @@
|
|||
<HyperlinkButton x:Uid="AboutHyperlinkProject" NavigateUri="http://"
|
||||
Content="_project link" FontSize="24"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556
|
||||
/// </summary>
|
||||
namespace ActivitiesExample
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -33,18 +38,23 @@ namespace ActivitiesExample
|
|||
/// </summary>
|
||||
public sealed partial class AboutPage : Page
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public AboutPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
Loaded += AboutPage_Loaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loaded event raised after the component is initialized
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event arguments</param>
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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">
|
||||
|
||||
</Application>
|
||||
|
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556
|
||||
/// </summary>
|
||||
namespace ActivitiesExample
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -47,7 +61,6 @@ namespace ActivitiesExample
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.CanGoBack)
|
||||
{
|
||||
frame.GoBack();
|
||||
|
@ -63,7 +76,6 @@ namespace ActivitiesExample
|
|||
/// <param name="e">Details about the launch request and process.</param>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,41 +30,62 @@ using Windows.UI.Xaml.Data;
|
|||
|
||||
namespace ActivitiesExample.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert activity to activity hint
|
||||
/// </summary>
|
||||
class ActivityToActivityHint : IValueConverter
|
||||
{
|
||||
private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
|
||||
#region Private members
|
||||
/// <summary>
|
||||
/// Constructs a new ResourceLoader object
|
||||
/// </summary>
|
||||
private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("Resources");
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Get activity description
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove activity description
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert activity to image
|
||||
/// </summary>
|
||||
class ActivityToImage : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Get activity icon
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove activity icon
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert time span to elipsis
|
||||
/// </summary>
|
||||
public class ElipsisVisible : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Elipsis added if duration > 12h
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return ((TimeSpan)value).TotalMinutes >= 720 ? Visibility.Visible:Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove elipsis
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert time span to string
|
||||
/// </summary>
|
||||
public class TimeSpanToString : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert time span to string
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "(" + ((TimeSpan)value).ToString(@"hh\:mm") + ")";
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove time span string
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert time span to width
|
||||
/// </summary>
|
||||
public class TimeSpanToWidth : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert activity duration to rectangle
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove rectangle
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert time window to string
|
||||
/// </summary>
|
||||
class TimeWindowToString : IValueConverter
|
||||
{
|
||||
private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
|
||||
#region Private members
|
||||
/// <summary>
|
||||
/// Constructs a new ResourceLoader object
|
||||
/// </summary>
|
||||
private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("Resources");
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Convert activity time window to string
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove time window string
|
||||
/// </summary>
|
||||
/// <param name="value">The source data being passed to the target.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference </param>
|
||||
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
|
||||
/// <param name="language">The language of the conversion.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Data class for getting users activities
|
||||
/// </summary>
|
||||
public class MyData : INotifyPropertyChanged
|
||||
{
|
||||
private List<MyQuantifiedData> _ListData = null;
|
||||
#region Private members
|
||||
/// <summary>
|
||||
/// List of activities and durations
|
||||
/// </summary>
|
||||
private List<MyQuantifiedData> _listData = null;
|
||||
|
||||
private static MyData _self;
|
||||
/// <summary>
|
||||
/// Data instance
|
||||
/// </summary>
|
||||
private static MyData _selfData;
|
||||
|
||||
private IList<ActivityMonitorReading> _history;
|
||||
private Activity _activity = Activity.Idle;
|
||||
/// <summary>
|
||||
/// List of history data
|
||||
/// </summary>
|
||||
private IList<ActivityMonitorReading> _historyData;
|
||||
|
||||
// time window index, 0 = today, -1 = yesterday
|
||||
private double timeWindowIndex = 0;
|
||||
/// <summary>
|
||||
/// Activity instance
|
||||
/// </summary>
|
||||
private Activity _activityMode = Activity.Idle;
|
||||
|
||||
/// <summary>
|
||||
/// Time window index, 0 = today, -1 = yesterday
|
||||
/// </summary>
|
||||
private double _timeWindowIndex = 0;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="propertyName"></param>
|
||||
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
|
@ -35,194 +79,228 @@ namespace ActivitiesExample.Data
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public MyData()
|
||||
{
|
||||
_ListData = new List<MyQuantifiedData>();
|
||||
_listData = new List<MyQuantifiedData>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create new instance of the class
|
||||
/// </summary>
|
||||
/// <returns>Data instance</returns>
|
||||
static public MyData Instance()
|
||||
{
|
||||
if (_self == null)
|
||||
_self = new MyData();
|
||||
return _self;
|
||||
if (_selfData == null)
|
||||
_selfData = new MyData();
|
||||
return _selfData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current activity
|
||||
/// </summary>
|
||||
public string CurrentActivity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _activity.ToString().ToLower();
|
||||
return _activityMode.ToString().ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the current activity
|
||||
/// </summary>
|
||||
public Activity ActivityEnum
|
||||
{
|
||||
set
|
||||
{
|
||||
_activity = value;
|
||||
_activityMode = value;
|
||||
NotifyPropertyChanged("CurrentActivity");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the time window
|
||||
/// </summary>
|
||||
public double TimeWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return timeWindowIndex;
|
||||
return _timeWindowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the time window to today
|
||||
/// </summary>
|
||||
public void NextDay()
|
||||
{
|
||||
if (timeWindowIndex < 0)
|
||||
if (_timeWindowIndex < 0)
|
||||
{
|
||||
timeWindowIndex++;
|
||||
_timeWindowIndex++;
|
||||
NotifyPropertyChanged("TimeWindow");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the time window to previous day
|
||||
/// </summary>
|
||||
public void PreviousDay()
|
||||
{
|
||||
if (timeWindowIndex >= -9)
|
||||
if (_timeWindowIndex >= -9)
|
||||
{
|
||||
timeWindowIndex--;
|
||||
_timeWindowIndex--;
|
||||
NotifyPropertyChanged("TimeWindow");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List of activities occured during given time period.
|
||||
/// </summary>
|
||||
public IList<ActivityMonitorReading> History
|
||||
{
|
||||
get
|
||||
{
|
||||
return _history;
|
||||
return _historyData;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_history == null)
|
||||
if (_historyData == null)
|
||||
{
|
||||
_history = new List<ActivityMonitorReading>();
|
||||
_historyData = new List<ActivityMonitorReading>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_history.Clear();
|
||||
_historyData.Clear();
|
||||
}
|
||||
|
||||
_history = value;
|
||||
_historyData = value;
|
||||
QuantifyData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of activities and durations
|
||||
/// </summary>
|
||||
public List<MyQuantifiedData> ListData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ListData;
|
||||
return _listData;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate the list of activities and durations to display in the UI
|
||||
/// </summary>
|
||||
private void QuantifyData()
|
||||
{
|
||||
if (_ListData != null)
|
||||
if (_listData != null)
|
||||
{
|
||||
_ListData.Clear();
|
||||
_listData.Clear();
|
||||
}
|
||||
|
||||
_ListData = new List<MyQuantifiedData>();
|
||||
|
||||
_listData = new List<MyQuantifiedData>();
|
||||
if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
|
||||
{
|
||||
List<string> _activitiesList = new List<string>(Enum.GetNames(typeof(Activity)));
|
||||
Dictionary<Activity, int> indexer = new Dictionary<Activity, int>();
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper class to create a list of activities and their timestamp
|
||||
/// </summary>
|
||||
public class MyQuantifiedData
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public MyQuantifiedData(string s, TimeSpan i)
|
||||
{
|
||||
ActivityName = s;
|
||||
ActivityTime = i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activity name
|
||||
/// </summary>
|
||||
public string ActivityName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activity time
|
||||
/// </summary>
|
||||
public TimeSpan ActivityTime
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Data class for design mode
|
||||
/// </summary>
|
||||
public class MyDesignData : INotifyPropertyChanged
|
||||
{
|
||||
private List<MyQuantifiedData> _ListData = null;
|
||||
private static MyDesignData _self;
|
||||
#region Private members
|
||||
/// <summary>
|
||||
/// List of activities and durations
|
||||
/// </summary>
|
||||
private List<MyQuantifiedData> _listData = null;
|
||||
|
||||
// time window index, 0 = today, -1 = yesterday
|
||||
private double timeWindowIndex = 0;
|
||||
/// <summary>
|
||||
/// Design data instance
|
||||
/// </summary>
|
||||
private static MyDesignData _selfData;
|
||||
|
||||
/// <summary>
|
||||
/// Time window index, 0 = today, -1 = yesterday
|
||||
/// </summary>
|
||||
private double _timeWindowIndex = 0;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="propertyName"></param>
|
||||
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
|
@ -30,27 +67,36 @@ namespace ActivitiesExample.Data
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public MyDesignData()
|
||||
{
|
||||
_ListData = new List<MyQuantifiedData>();
|
||||
|
||||
_listData = new List<MyQuantifiedData>();
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create new instance of the class
|
||||
/// </summary>
|
||||
/// <returns>Design data instance</returns>
|
||||
static public MyDesignData Instance()
|
||||
{
|
||||
if (_self == null)
|
||||
_self = new MyDesignData();
|
||||
return _self;
|
||||
if (_selfData == null)
|
||||
_selfData = new MyDesignData();
|
||||
return _selfData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current activity
|
||||
/// </summary>
|
||||
public string CurrentActivity
|
||||
{
|
||||
get
|
||||
|
@ -59,22 +105,26 @@ namespace ActivitiesExample.Data
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of activities and durations
|
||||
/// </summary>
|
||||
public List<MyQuantifiedData> ListData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ListData;
|
||||
return _listData;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the time window
|
||||
/// </summary>
|
||||
public double TimeWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return timeWindowIndex;
|
||||
return _timeWindowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="#FF1bA1E2">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:ElipsisVisible x:Key="VisibleElipsis"/>
|
||||
<converters:TimeSpanToString x:Key="TimeToString"/>
|
||||
|
@ -19,19 +18,16 @@
|
|||
<converters:ActivityToActivityHint x:Key="ActivityToHint"/>
|
||||
<converters:TimeWindowToString x:Key="TimeWindowToString"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel contains the name of the application and page title-->
|
||||
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="24,24,24,0" >
|
||||
<TextBlock x:Uid="ApplicationSuite" Text="_SensorCore Example" Style="{ThemeResource TitleTextBlockStyle}" Typography.Capitals="SmallCaps" Foreground="White"/>
|
||||
<TextBlock x:Uid="ApplicationName" Text="_activities" Style="{ThemeResource HeaderTextBlockStyle}" Foreground="White"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid Grid.Row="1" Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
|
@ -40,16 +36,13 @@
|
|||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- current activity text -->
|
||||
<StackPanel Grid.Row="0" Margin="24,24,0,24" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock x:Uid="CurrentActivityHeader" Text="_Current activity:" FontSize="{StaticResource TextStyleMediumFontSize}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Path=CurrentActivity, Mode=OneWay}" HorizontalAlignment="Left" FontSize="{StaticResource TextStyleExtraLargePlusFontSize}" Margin="12,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- current activity icon -->
|
||||
<Image Source="{Binding CurrentActivity, Converter={StaticResource ActivityToIcon}}" Grid.Row="2" Height="300" Width="300" Opacity="0.3"/>
|
||||
|
||||
<!-- List of activities -->
|
||||
<TextBlock Text="{Binding Path=TimeWindow, Converter={StaticResource ResourceKey=TimeWindowToString}, Mode=OneWay}" Grid.Row="1" Margin="24,0,0,6" FontSize="{StaticResource TextStyleMediumFontSize}"/>
|
||||
<ListView x:Name="ActivityListView" Grid.Row="2" Margin="24,0" ItemsSource="{Binding Path=ListData, Mode=OneWay}" Background="#3FFFFFFF" SelectionMode="None" MinHeight="310">
|
||||
|
@ -85,7 +78,6 @@
|
|||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
<!-- x coordinates -->
|
||||
<Grid Grid.Row="4" Margin="24,0,24,12" >
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -103,10 +95,9 @@
|
|||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Page.BottomAppBar>
|
||||
<CommandBar Opacity="0.5">
|
||||
<AppBarButton x:Uid="PrevButton" x:Name="prevButton" Label="_previous" IsEnabled="True" Click="prevButton_Click" >
|
||||
<AppBarButton x:Uid="PrevButton" x:Name="prevButton" Label="_previous" IsEnabled="True" Click="PrevButton_Click" >
|
||||
<AppBarButton.Icon>
|
||||
<BitmapIcon UriSource="/Assets/back.png"/>
|
||||
</AppBarButton.Icon>
|
||||
|
@ -116,16 +107,14 @@
|
|||
<BitmapIcon UriSource="/Assets/refresh.png"/>
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton x:Uid="NextButton" x:Name="nextButton" Label="_next" IsEnabled="False" Click="nextButton_Click" >
|
||||
<AppBarButton x:Uid="NextButton" x:Name="nextButton" Label="_next" IsEnabled="False" Click="NextButton_Click" >
|
||||
<AppBarButton.Icon>
|
||||
<BitmapIcon UriSource="/Assets/next.png"/>
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<CommandBar.SecondaryCommands>
|
||||
<!-- <AppBarButton x:Uid="Refresh" Label="_refresh _todays' _activities" Click="RefreshButton_Click"/> -->
|
||||
<AppBarButton x:Uid="About" Label="_about" Click="AboutButton_Click"/>
|
||||
</CommandBar.SecondaryCommands>
|
||||
</CommandBar>
|
||||
</Page.BottomAppBar>
|
||||
|
||||
</Page>
|
||||
|
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556
|
||||
/// </summary>
|
||||
namespace ActivitiesExample
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -37,8 +48,16 @@ namespace ActivitiesExample
|
|||
/// Activity monitor instance
|
||||
/// </summary>
|
||||
private IActivityMonitor _activityMonitor = null;
|
||||
|
||||
/// <summary>
|
||||
/// Check if running in emulator
|
||||
/// </summary>
|
||||
private bool _runningInEmulator = false;
|
||||
private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new ResourceLoader object
|
||||
/// </summary>
|
||||
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
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loaded event raised after the component is initialized
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event argument</param>
|
||||
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
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs asynchronous Sense SDK operation and handles any exceptions
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="action">The function delegate to execute asynchronously when one task in the tasks completes</param>
|
||||
/// <returns><c>true</c> if call was successful, <c>false</c> otherwise</returns>
|
||||
private async Task<bool> CallSensorCoreApiAsync(Func<Task> 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
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigate to about page
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event arguments</param>
|
||||
private void AboutButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Frame.Navigate(typeof(AboutPage));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh data for the current day
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event arguments</param>
|
||||
private void RefreshButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PollHistory();
|
||||
}
|
||||
|
||||
private void prevButton_Click(object sender, RoutedEventArgs e)
|
||||
/// <summary>
|
||||
/// Read the data for the past day
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event arguments</param>
|
||||
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)
|
||||
/// <summary>
|
||||
/// Read the data for the next day
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of the event</param>
|
||||
/// <param name="e">Event arguments</param>
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
|
||||
<Identity Name="74dcbd9a-3772-41a5-b7d4-f1e511e6b0cd" Publisher="CN=sujesh" Version="1.1.0.10" />
|
||||
<Identity Name="NokiaDeveloper.ActivitiesLumiaSensorCoreSDKsample" Publisher="CN=4AD6DA08-6C39-4A10-98CC-3243374DA59C" Version="1.1.0.13" />
|
||||
<Properties>
|
||||
<DisplayName>Activities</DisplayName>
|
||||
<PublisherDisplayName>Nokia Developer</PublisherDisplayName>
|
||||
<DisplayName>Activities – Lumia SensorCore SDK sample</DisplayName>
|
||||
<PublisherDisplayName>Lumia SDK</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Prerequisites>
|
||||
<OSMinVersion>6.3.0</OSMinVersion>
|
||||
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
|
||||
</Prerequisites>
|
||||
<mp:PhoneIdentity PhoneProductId="74dcbd9a-3772-41a5-b7d4-f1e511e6b0cd" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<mp:PhoneIdentity PhoneProductId="2ced6ce9-b515-497f-a774-1038f33ce598" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
|
|
@ -176,14 +176,6 @@
|
|||
<TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\$(TargetPlatformVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>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}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\LumiaSensorCoreSDK.1.0.3.263\build\wpa81\LumiaSensorCoreSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LumiaSensorCoreSDK.1.0.3.263\build\wpa81\LumiaSensorCoreSDK.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\LumiaSensorCoreSDKTesting.1.0.3.263\build\wpa81\LumiaSensorCoreSDKTesting.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LumiaSensorCoreSDKTesting.1.0.3.263\build\wpa81\LumiaSensorCoreSDKTesting.targets'))" />
|
||||
</Target>
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Import Project="..\packages\LumiaSensorCoreSDK.1.0.3.263\build\wpa81\LumiaSensorCoreSDK.targets" Condition="Exists('..\packages\LumiaSensorCoreSDK.1.0.3.263\build\wpa81\LumiaSensorCoreSDK.targets')" />
|
||||
<Import Project="..\packages\LumiaSensorCoreSDKTesting.1.0.3.263\build\wpa81\LumiaSensorCoreSDKTesting.targets" Condition="Exists('..\packages\LumiaSensorCoreSDKTesting.1.0.3.263\build\wpa81\LumiaSensorCoreSDKTesting.targets')" />
|
||||
|
|
45
Licence.txt
45
Licence.txt
|
@ -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.
|
21
README.md
21
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:
|
|||
</m2:DeviceCapability>
|
||||
|
||||
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче