Skip to content

Commit

Permalink
Wrapped the remaining NSMutableArray properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Apr 22, 2015
1 parent 04e5d11 commit 78b7847
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async partial void SendMessageClick (UIButton sender)

// send a message with a dialog
try {
await client.NotificationManager.SendMessageTaskAsync (customId, "Hello", "Hello World!", DateTime.Now, true);
await client.NotificationManager.SendMessageTaskAsync (tileId, "Hello", "Hello World!", DateTime.Now, true);
Output ("Sent the message!!");
} catch (BandException ex) {
Output ("Failed to send the message:");
Expand Down
6 changes: 4 additions & 2 deletions Microsoft.Band/Microsoft.Band.iOS/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,14 @@ interface BandTile
bool BadgingEnabled { [Bind ("isBadgingEnabled")] get; set; }

// @property (readonly, nonatomic) NSMutableArray * pageIcons;
[Internal]
[Export ("pageIcons")]
NSMutableArray PageIcons { get; }
NSMutableArray PageIconsInternal { get; }

// @property (readonly, nonatomic) NSMutableArray * pageLayouts;
[Internal]
[Export ("pageLayouts")]
NSMutableArray PageLayouts { get; }
NSMutableArray PageLayoutsInternal { get; }

// +(MSBTile *)tileWithId:(NSUUID *)tileId name:(NSString *)tileName tileIcon:(MSBIcon *)tileIcon smallIcon:(MSBIcon *)smallIcon error:(NSError **)pError;
[Static]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<Compile Include="Tiles\BandTileManagerExtensions.cs" />
<Compile Include="Pages\BandPagePanel.cs" />
<Compile Include="BandCollection.cs" />
<Compile Include="Tiles\BandTile.cs" />
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
Expand Down
49 changes: 49 additions & 0 deletions Microsoft.Band/Microsoft.Band.iOS/Tiles/BandTile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Collections.Generic;

using Microsoft.Band.Pages;

namespace Microsoft.Band.Tiles
{
public partial class BandTile
{
private object pageIconsLock = new object();
private BandCollection<BandIcon> pageIcons;

public IList<BandIcon> PageIcons {
get {
// check outside to avoid unnecessary locking
if (pageIcons == null) {
// we lock for thread safety
lock (pageIconsLock) {
// do a check before init
if (pageIcons == null) {
pageIcons = new BandCollection<BandIcon> (PageIconsInternal);
}
}
}

return pageIcons;
}
}

private object pageLayoutsLock = new object();
private BandCollection<BandPageLayout> pageLayouts;

public IList<BandPageLayout> PageLayouts {
get {
// check outside to avoid unnecessary locking
if (pageLayouts == null) {
// we lock for thread safety
lock (pageLayoutsLock) {
// do a check before init
if (pageLayouts == null) {
pageLayouts = new BandCollection<BandPageLayout> (PageLayoutsInternal);
}
}
}

return pageLayouts;
}
}
}
}

0 comments on commit 78b7847

Please sign in to comment.