From cbdd3b0c3e9c366231069b5658a241309b999036 Mon Sep 17 00:00:00 2001 From: Jonathan Robson Date: Tue, 28 Apr 2015 18:21:47 -0500 Subject: [PATCH 1/3] Build fixes - Fixed bad reference to MS Band dll's - Added missing reference to System.IO - Updated exception message as BluetoothDeviceInfo.Id is no longer available - switched to using Name --- .../BluetoothDeviceTransport.cs | 2 +- .../unBand.CargoClientExtender.csproj | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs b/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs index 1124713..cf90341 100644 --- a/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs +++ b/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs @@ -48,7 +48,7 @@ public async Task ConnectAsync(ushort maxConnectAttempts = 1) if (deviceService == null) { - throw new Exception("Failed to create RfcommDeviceService with id: " + _deviceInfo.Id.ToString()); + throw new Exception("Failed to create RfcommDeviceService with name: " + _deviceInfo.Name.ToString()); } var streamSocket = new StreamSocket(); diff --git a/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj b/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj index 62ce88b..d0e16e2 100644 --- a/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj +++ b/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj @@ -35,20 +35,21 @@ 8.1 - - ..\Microsoft.Band.Admin.Desktop.unband.dll + + ..\Microsoft.Band.dll - - ..\Microsoft.Band.Admin.unband.dll + + ..\Microsoft.Band.Admin.dll - - ..\Microsoft.Band.Desktop.unband.dll + + ..\Microsoft.Band.Admin.Desktop.dll - - ..\Microsoft.Band.unband.dll + + ..\Microsoft.Band.Desktop.dll + From 6423160ad5dce2226cdb7cac22e62c172a59fa6d Mon Sep 17 00:00:00 2001 From: Jonathan Robson Date: Tue, 28 Apr 2015 20:23:22 -0500 Subject: [PATCH 2/3] Issue #65 - Exported GPX distance, average speed and elevation gain are inaccurate Filter invalid map points before exporting to GPX. - Updated BikeEvent & RunEvent to return IEnumerable<> instead of naked List<>. - IEnumerable backed by new BandMapPointCollection which serves as central place to execute any filtering/processing etc on map points as they get exported. Just runs a simple filter on bad mappoints currently. - Added Unit --- .../BandMapPointCollectionTests.cs | 58 +++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++ src/unBand.Cloud.Tests/packages.config | 4 + .../unBand.Cloud.Tests.csproj | 96 +++++++++++++++++++ .../Events/BandMapPointCollection.cs | 41 ++++++++ src/unBand.Cloud/Events/BikeEvent.cs | 11 +-- .../Events/IBandEventWithMapPoints.cs | 11 +-- src/unBand.Cloud/Events/RunEvent.cs | 11 +-- src/unBand.Cloud/Properties/AssemblyInfo.cs | 1 + src/unBand.Cloud/unBand.Cloud.csproj | 1 + src/unBand.sln | 12 ++- 11 files changed, 262 insertions(+), 20 deletions(-) create mode 100644 src/unBand.Cloud.Tests/BandMapPointCollectionTests.cs create mode 100644 src/unBand.Cloud.Tests/Properties/AssemblyInfo.cs create mode 100644 src/unBand.Cloud.Tests/packages.config create mode 100644 src/unBand.Cloud.Tests/unBand.Cloud.Tests.csproj create mode 100644 src/unBand.Cloud/Events/BandMapPointCollection.cs diff --git a/src/unBand.Cloud.Tests/BandMapPointCollectionTests.cs b/src/unBand.Cloud.Tests/BandMapPointCollectionTests.cs new file mode 100644 index 0000000..eb1fa99 --- /dev/null +++ b/src/unBand.Cloud.Tests/BandMapPointCollectionTests.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Ploeh.AutoFixture; +using unBand.Cloud.Events; + +namespace unBand.Cloud.Tests +{ + [TestClass] + public class BandMapPointCollectionTests + { + private IFixture _fixture; + private BandMapPointCollection _subjectUnderTest; + + [TestInitialize] + public void SetUp() + { + _fixture = new Fixture(); + } + + [TestMethod] + public void FiltersInvalidBeginMiddleEndMapPointFromCollection() + { + DoTest(3, 0); + DoTest(3, 1); + DoTest(3, 2); + } + + private void DoTest(int collectionSize, int indexOfInvalidMapPoint) + { + _subjectUnderTest = new BandMapPointCollection(); + var mapPoints = CreateTestData(collectionSize); + MakeInvalid(mapPoints[indexOfInvalidMapPoint]); + PopulateCollection(mapPoints); + + Assert.AreEqual(_subjectUnderTest.Count(), collectionSize - 1); + Assert.IsFalse(_subjectUnderTest.Contains(mapPoints[indexOfInvalidMapPoint])); + } + + private List CreateTestData(int repeatCount) + { + _fixture.RepeatCount = repeatCount; + return _fixture.CreateMany().ToList(); + } + + private void PopulateCollection(List data) + { + data.ForEach(x => _subjectUnderTest.Add(x)); + } + + private void MakeInvalid(BandMapPoint subject) + { + subject.Latitude = 0.0; + subject.Longitude = 0.0; + subject.Altitude = 0.0; + } + } +} \ No newline at end of file diff --git a/src/unBand.Cloud.Tests/Properties/AssemblyInfo.cs b/src/unBand.Cloud.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..494d2b4 --- /dev/null +++ b/src/unBand.Cloud.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("unBand.Cloud.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("unBand.Cloud.Tests")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b184addb-a2f1-422f-912f-05e57f3d83be")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/unBand.Cloud.Tests/packages.config b/src/unBand.Cloud.Tests/packages.config new file mode 100644 index 0000000..dbe6228 --- /dev/null +++ b/src/unBand.Cloud.Tests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/unBand.Cloud.Tests/unBand.Cloud.Tests.csproj b/src/unBand.Cloud.Tests/unBand.Cloud.Tests.csproj new file mode 100644 index 0000000..ab44705 --- /dev/null +++ b/src/unBand.Cloud.Tests/unBand.Cloud.Tests.csproj @@ -0,0 +1,96 @@ + + + + Debug + AnyCPU + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41} + Library + Properties + unBand.Cloud.Tests + unBand.Cloud.Tests + v4.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\AutoFixture.3.30.3\lib\net40\Ploeh.AutoFixture.dll + True + + + + + + + + + + + + + + + + + + + + + + {c65bd296-f5e1-400e-886e-bc3def6476ef} + unBand.Cloud + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/src/unBand.Cloud/Events/BandMapPointCollection.cs b/src/unBand.Cloud/Events/BandMapPointCollection.cs new file mode 100644 index 0000000..bd2692c --- /dev/null +++ b/src/unBand.Cloud/Events/BandMapPointCollection.cs @@ -0,0 +1,41 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace unBand.Cloud.Events +{ + internal class BandMapPointCollection : IEnumerable + { + private readonly List _mapPoints = new List(); + + internal void Add(BandMapPoint mapPoint) + { + _mapPoints.Add(mapPoint); + } + + public IEnumerator GetEnumerator() + { + return _mapPoints.FilterInvalidCoordinates().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + internal static class BandMapPointFilterExtensions + { + public static IEnumerable FilterInvalidCoordinates(this IEnumerable self) + { + return self.Where(IsValid); + } + + private static bool IsValid(BandMapPoint point) + { + return !((int) point.Latitude == 0 && + (int) point.Longitude == 0 && + (int) point.Altitude == 0); + } + } +} \ No newline at end of file diff --git a/src/unBand.Cloud/Events/BikeEvent.cs b/src/unBand.Cloud/Events/BikeEvent.cs index 3c75db9..1d8e8ed 100644 --- a/src/unBand.Cloud/Events/BikeEvent.cs +++ b/src/unBand.Cloud/Events/BikeEvent.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using unBand.Cloud.Events; using unBand.Cloud.Exporters.EventExporters; namespace unBand.Cloud @@ -47,7 +48,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, System.Global [TypeConverter(typeof(BikeEventConverter))] public class BikeEvent : BandExerciseEventBase, IBandEventWithMapPoints { - + private readonly BandMapPointCollection _mapPoints = new BandMapPointCollection(); private static List _exporters; public override List Exporters @@ -69,7 +70,7 @@ public override BandEventExpandType[] Expanders get { return new BandEventExpandType[] { BandEventExpandType.Info, BandEventExpandType.Sequences, BandEventExpandType.MapPoints }; } } - public List MapPoints { get; private set; } + public IEnumerable MapPoints { get{return _mapPoints;} } /// /// Calculated property which indicates whether or not any actual GPS points were @@ -86,9 +87,7 @@ public override BandEventExpandType[] Expanders public int Pace { get; set; } public BikeEvent(JObject json) : base(json) - { - MapPoints = new List(); - + { dynamic eventSummary = (dynamic)json; TotalDistance = eventSummary.TotalDistance; @@ -146,7 +145,7 @@ public override void InitFullEventData(JObject json) HasGPSPoints = true; } - MapPoints.Add(runMapPoint); + _mapPoints.Add(runMapPoint); } } } diff --git a/src/unBand.Cloud/Events/IBandEventWithMapPoints.cs b/src/unBand.Cloud/Events/IBandEventWithMapPoints.cs index 7ad0f7d..dd190a0 100644 --- a/src/unBand.Cloud/Events/IBandEventWithMapPoints.cs +++ b/src/unBand.Cloud/Events/IBandEventWithMapPoints.cs @@ -1,14 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; +using unBand.Cloud.Events; namespace unBand.Cloud { public interface IBandEventWithMapPoints { bool HasGPSPoints { get; set; } - - List MapPoints { get; } + IEnumerable MapPoints { get; } } -} +} \ No newline at end of file diff --git a/src/unBand.Cloud/Events/RunEvent.cs b/src/unBand.Cloud/Events/RunEvent.cs index 52500c4..f0b98d2 100644 --- a/src/unBand.Cloud/Events/RunEvent.cs +++ b/src/unBand.Cloud/Events/RunEvent.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using unBand.Cloud.Events; using unBand.Cloud.Exporters.EventExporters; namespace unBand.Cloud @@ -51,7 +52,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, System.Global [TypeConverter(typeof(RunEventConverter))] public class RunEvent : BandExerciseEventBase, IBandEventWithMapPoints { - + private readonly BandMapPointCollection _mapPoints = new BandMapPointCollection(); private static List _exporters; public override List Exporters @@ -73,7 +74,7 @@ public override BandEventExpandType[] Expanders get { return new BandEventExpandType[] { BandEventExpandType.Info, BandEventExpandType.Sequences, BandEventExpandType.MapPoints }; } } - public List MapPoints { get; private set; } + public IEnumerable MapPoints { get { return _mapPoints; } } /// /// Calculated property which indicates whether or not any actual GPS points were @@ -90,9 +91,7 @@ public override BandEventExpandType[] Expanders public int Pace { get; set; } public RunEvent(JObject json) : base(json) - { - MapPoints = new List(); - + { dynamic eventSummary = (dynamic)json; TotalDistance = eventSummary.TotalDistance; @@ -151,7 +150,7 @@ public override void InitFullEventData(JObject json) HasGPSPoints = true; } - MapPoints.Add(runMapPoint); + _mapPoints.Add(runMapPoint); } } } diff --git a/src/unBand.Cloud/Properties/AssemblyInfo.cs b/src/unBand.Cloud/Properties/AssemblyInfo.cs index 6499ea6..b7d4189 100644 --- a/src/unBand.Cloud/Properties/AssemblyInfo.cs +++ b/src/unBand.Cloud/Properties/AssemblyInfo.cs @@ -34,3 +34,4 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: InternalsVisibleTo("unBand.Cloud.Tests")] \ No newline at end of file diff --git a/src/unBand.Cloud/unBand.Cloud.csproj b/src/unBand.Cloud/unBand.Cloud.csproj index 509595d..a927c09 100644 --- a/src/unBand.Cloud/unBand.Cloud.csproj +++ b/src/unBand.Cloud/unBand.Cloud.csproj @@ -54,6 +54,7 @@ + diff --git a/src/unBand.sln b/src/unBand.sln index 127407a..c0319f1 100644 --- a/src/unBand.sln +++ b/src/unBand.sln @@ -1,7 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unBand", "unBand\unBand.csproj", "{37740797-A1D3-4452-AB73-DC24EAD9CFBF}" EndProject @@ -15,6 +14,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unBand.dev.Bootstrap", "unB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unBand.CargoClientEditor", "unBand.CargoClientEditor\unBand.CargoClientEditor.csproj", "{3BD070E3-1D3C-437D-B079-81879654F228}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{681082A6-0D5C-47BA-BA85-D4B91E0D1A52}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unBand.Cloud.Tests", "unBand.Cloud.Tests\unBand.Cloud.Tests.csproj", "{32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,8 +48,15 @@ Global {3BD070E3-1D3C-437D-B079-81879654F228}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BD070E3-1D3C-437D-B079-81879654F228}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BD070E3-1D3C-437D-B079-81879654F228}.Release|Any CPU.Build.0 = Release|Any CPU + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {32DEEBC3-DB59-4D5C-AE4B-FB7CE2E96B41} = {681082A6-0D5C-47BA-BA85-D4B91E0D1A52} + EndGlobalSection EndGlobal From f855268d23e731718b92dfc763c3c0466536eebb Mon Sep 17 00:00:00 2001 From: Jonathan Robson Date: Wed, 29 Apr 2015 19:58:41 -0500 Subject: [PATCH 3/3] Fixes for - New crash #72 Updated to compile and work with v1.3.10423.3 of the MS Band dll's --- .../BluetoothDeviceTransport.cs | 2 +- .../BluetoothStreamWrapper.cs | 9 ++++++++- .../unBand.CargoClientExtender.csproj | 1 + src/unBand/BandHelpers/BandProperties.cs | 2 +- src/unBand/BandHelpers/BandStrapp.cs | 10 +++++----- src/unBand/BandHelpers/BandTheme.cs | 3 ++- src/unBand/BandHelpers/BandTiles.cs | 10 +++++----- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs b/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs index cf90341..051f0a9 100644 --- a/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs +++ b/src/unBand.CargoClientExtender/BluetoothDeviceTransport.cs @@ -21,7 +21,7 @@ public class BluetoothDeviceTransport : IDeviceTransport, IDisposable private bool _disposed; public CargoStreamReader CargoReader { get; private set; } - public Stream CargoStream { get; private set; } + public ICargoStream CargoStream { get; private set; } public CargoStreamWriter CargoWriter { get; private set; } public bool IsConnected { get; private set; } public int MaxDataPayloadSize { get; private set; } diff --git a/src/unBand.CargoClientExtender/BluetoothStreamWrapper.cs b/src/unBand.CargoClientExtender/BluetoothStreamWrapper.cs index 6aca5a2..09634db 100644 --- a/src/unBand.CargoClientExtender/BluetoothStreamWrapper.cs +++ b/src/unBand.CargoClientExtender/BluetoothStreamWrapper.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.Networking.Sockets; +using Microsoft.Band; namespace unBand.CargoClientExtender { @@ -13,7 +14,7 @@ namespace unBand.CargoClientExtender /// Small StreamSocket wrapper (really around Stream, but implemented on top of a StreamSocket) /// that implemented Read/Write Timeouts /// - internal class BluetoothStreamWrapper : Stream + internal class BluetoothStreamWrapper : Stream, ICargoStream { const int DEFAULT_WRITE_TIMEOUT = 1000; const int DEFAULT_READ_TIMEOUT = 1000; @@ -33,6 +34,12 @@ internal class BluetoothStreamWrapper : Stream public override int ReadTimeout { get; set; } public override int WriteTimeout { get; set; } + public CancellationToken Cancel + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + public override long Length { get { throw new NotImplementedException(); } } public override long Position diff --git a/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj b/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj index d0e16e2..b9c21b9 100644 --- a/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj +++ b/src/unBand.CargoClientExtender/unBand.CargoClientExtender.csproj @@ -56,6 +56,7 @@ False C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Runtime.WindowsRuntime.dll + diff --git a/src/unBand/BandHelpers/BandProperties.cs b/src/unBand/BandHelpers/BandProperties.cs index 00be728..b0c905a 100644 --- a/src/unBand/BandHelpers/BandProperties.cs +++ b/src/unBand/BandHelpers/BandProperties.cs @@ -94,7 +94,7 @@ public async Task InitAsync() FirmwareVersions = await _client.GetFirmwareVersionsAsync(); EphemerisCoverageDates = await _client.GetGpsEphemerisCoverageDatesFromDeviceAsync(); LogVersion = await _client.GetLogVersionAsync(); - MaxStrappCount = await _client.GetMaxStrappCountAsync(); + MaxStrappCount = await _client.GetMaxTileCountAsync(); PendingDeviceDataBytes = await _client.GetPendingDeviceDataBytesAsync(); // var j = await _client.GetPendingLocalDataBytesAsync(); NullException diff --git a/src/unBand/BandHelpers/BandStrapp.cs b/src/unBand/BandHelpers/BandStrapp.cs index 6929744..175ba55 100644 --- a/src/unBand/BandHelpers/BandStrapp.cs +++ b/src/unBand/BandHelpers/BandStrapp.cs @@ -19,7 +19,7 @@ class BandStrapp : INotifyPropertyChanged // to others / edit it), so let's detect that private static readonly Guid STARBUCKS_GUID = new Guid("{64a29f65-70bb-4f32-99a2-0f250a05d427}"); - public CargoStrapp Strapp { get; private set; } + public AdminBandTile Strapp { get; private set; } public WriteableBitmap TileImage { get; private set; } @@ -29,16 +29,16 @@ public bool IsDefault { get { - return _tiles.DefaultStrapps.Any(i => i.StrappID == Strapp.StrappID); + return _tiles.DefaultStrapps.Any(i => i.TileId == Strapp.TileId); } } public bool IsStarbucks { - get { return Strapp.StrappID == STARBUCKS_GUID; } + get { return Strapp.TileId == STARBUCKS_GUID; } } - public BandStrapp(BandTiles tiles, CargoStrapp strapp) + public BandStrapp(BandTiles tiles, AdminBandTile strapp) { Strapp = strapp; _tiles = tiles; @@ -65,7 +65,7 @@ internal void SetIcon(string fileName) var images = new List() { bmp.ToBandIcon(), bmp.ToBandIcon() }; - Strapp.SetImageList(Strapp.StrappID, images, 0); + Strapp.SetImageList(Strapp.TileId, images, 0); _tiles.UpdateStrapp(Strapp); diff --git a/src/unBand/BandHelpers/BandTheme.cs b/src/unBand/BandHelpers/BandTheme.cs index 198b9cb..4c7829a 100644 --- a/src/unBand/BandHelpers/BandTheme.cs +++ b/src/unBand/BandHelpers/BandTheme.cs @@ -39,7 +39,7 @@ public class BandTheme : INotifyPropertyChanged private bool _inited; private WriteableBitmap _background; - private Microsoft.Band.Personalization.BandTheme _themeColor; + private Microsoft.Band.BandTheme _themeColor; private SolidColorBrush _baseColor; private SolidColorBrush _highlightColor; @@ -204,6 +204,7 @@ public async Task InitAsync() if (meTileImage != null) _background = meTileImage.ToWriteableBitmap(); + _themeColor = await _client.PersonalizationManager.GetThemeAsync(); SetColorProperties(); diff --git a/src/unBand/BandHelpers/BandTiles.cs b/src/unBand/BandHelpers/BandTiles.cs index 5bc45ba..643b69c 100644 --- a/src/unBand/BandHelpers/BandTiles.cs +++ b/src/unBand/BandHelpers/BandTiles.cs @@ -15,7 +15,7 @@ class BandTiles public ObservableCollection Strip { get; private set; } - public List DefaultStrapps { get; private set; } + public List DefaultStrapps { get; private set; } public BandTiles(CargoClient client) { @@ -42,7 +42,7 @@ public async Task InitAsync() Strip = new ObservableCollection(bandStrip); - DefaultStrapps = (List)(await _client.GetDefaultStrappsAsync()); + DefaultStrapps = (List)(await _client.GetDefaultTilesAsync()); } public Task Save() @@ -58,13 +58,13 @@ public async Task ClearAllCounts() { foreach (var bandStrapp in Strip) { - await _client.ClearStrappAsync(bandStrapp.Strapp.StrappID); + await _client.ClearTileAsync(bandStrapp.Strapp.TileId); } } - internal void UpdateStrapp(CargoStrapp strapp) + internal void UpdateStrapp(AdminBandTile strapp) { - _client.UpdateStrapp(strapp); + _client.UpdateTile(strapp); // here is where it gets a bit hairy. If we just call UpdateStrapp alone // it will shove the updated Tile at the end of the strip, which is undesirable