Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added comments and fixed stylecop warnings #1547

Merged
merged 7 commits into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Services/Core/DataProviderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Toolkit.Services.Exceptions;
using System.Net.Http;

namespace Microsoft.Toolkit.Services
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Toolkit.Services.Core;
using Microsoft.Toolkit.Services.Exceptions;
using System.Net.Http;

namespace Microsoft.Toolkit.Services.Bing
{
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Services/Services/Bing/BingParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Microsoft.Toolkit.Services.Rss;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Toolkit.Services.Rss;

namespace Microsoft.Toolkit.Services.Bing
{
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Services/Services/Bing/BingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Toolkit.Services.Core;
using Microsoft.Toolkit.Collections;
using Microsoft.Toolkit.Services.Core;

namespace Microsoft.Toolkit.Services.Bing
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private void DeviceWatcher_EnumerationCompleted(DeviceWatcher sender, object arg
StopEnumeration();

EnumerationCompleted?.Invoke(sender, EventArgs.Empty);
}
}
}

/// <summary>
Expand All @@ -341,7 +341,6 @@ private async Task AddDeviceToList(DeviceInformation deviceInfo)
(device.DeviceInfo.Properties.Keys.Contains("System.Devices.Aep.IsConnected") &&
(bool)device.DeviceInfo.Properties["System.Devices.Aep.IsConnected"]);


if (connectable)
{
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Windows.ApplicationModel.Core;
Expand All @@ -41,29 +41,36 @@ public class ObservableBluetoothLEDevice : INotifyPropertyChanged, IEquatable<Ob
/// </summary>
public class RSSIComparer : IComparer
{
/// <summary>
/// Compares two ObservableBluettothLEDevices and returns a value indicating
/// whether one is less than, equal to, or greater than the other.
/// </summary>
/// <param name="x">First object to compare</param>
/// <param name="y">Second object to compare</param>
/// <returns>Returns 0 if equal</returns>
public int Compare(object x, object y)
{
ObservableBluetoothLEDevice a = x as ObservableBluetoothLEDevice;
ObservableBluetoothLEDevice b = y as ObservableBluetoothLEDevice;

if( a == null || b == null)
if (a == null || b == null)
{
throw new InvalidOperationException("Compared objects are not ObservableBluetoothLEDevice");
}

// If they're equal
if(a.RSSI == b.RSSI)
if (a.RSSI == b.RSSI)
{
return 0;
}

// RSSI == 0 means we don't know it. Always make that the end.
if(b.RSSI == 0)
if (b.RSSI == 0)
{
return -1;
}

if(a.RSSI < b.RSSI || a.RSSI == 0)
if (a.RSSI < b.RSSI || a.RSSI == 0)
{
return 1;
}
Expand Down Expand Up @@ -113,17 +120,17 @@ public int Compare(object x, object y)
/// result of finding all the services
/// </summary>
private GattDeviceServicesResult _result;
/// <summary>
/// Queue to store the last 10 observed RSSI values
/// </summary>
private Queue<int> _rssiValue = new Queue<int>(10);

/// <summary>
/// Queue to store the last 10 observed RSSI values
/// </summary>
private Queue<int> _rssiValue = new Queue<int>(10);

/// <summary>
/// Source for <see cref="RSSI"/>
/// </summary>
private int _rssi;

/// <summary>
/// Source for <see cref="ServiceCount" />
/// </summary>
Expand Down Expand Up @@ -325,7 +332,6 @@ private set
}
}


/// <summary>
/// Gets the RSSI value of this device
/// </summary>
Expand All @@ -342,10 +348,11 @@ private set
{
_rssiValue.Dequeue();
}

_rssiValue.Enqueue(value);

int newValue = (int)Math.Round(_rssiValue.Average(), 0);

if (_rssi != newValue)
{
_rssi = newValue;
Expand Down Expand Up @@ -380,9 +387,9 @@ bool IEquatable<ObservableBluetoothLEDevice>.Equals(ObservableBluetoothLEDevice

private void ObservableBluetoothLEDevice_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if(e.PropertyName == "DeviceInfo")
if (e.PropertyName == "DeviceInfo")
{
if(DeviceInfo.Properties.ContainsKey("System.Devices.Aep.SignalStrength") && DeviceInfo.Properties["System.Devices.Aep.SignalStrength"] != null)
if (DeviceInfo.Properties.ContainsKey("System.Devices.Aep.SignalStrength") && DeviceInfo.Properties["System.Devices.Aep.SignalStrength"] != null)
{
RSSI = (int)DeviceInfo.Properties["System.Devices.Aep.SignalStrength"];
}
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Common/AnimationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
public static class AnimationHelper
{
private static float _defaultShowAnimationDuration = 300;
private static float _defaultHideAnimationDiration = 150;

private static bool? _isImpicitHideShowSupported;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<PackageCertificateThumbprint>7A086872CBF1D8A795A97B9559A3C88B3550527E</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
Binary file not shown.
12 changes: 6 additions & 6 deletions Microsoft.Toolkit.Uwp.SampleApp/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="52b9212c-97a9-4639-9426-3e1ea9c1569e" Publisher="CN=davca" Version="2.0.0.0" />
<Identity Name="52b9212c-97a9-4639-9426-3e1ea9c1569e" Publisher="CN=Nikola" Version="2.0.0.0" />
<mp:PhoneIdentity PhoneProductId="52b9212c-97a9-4639-9426-3e1ea9c1569e" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Microsoft.Toolkit.Uwp.SampleApp</DisplayName>
Expand All @@ -27,16 +27,16 @@
<uap:SplashScreen Image="Assets\UWPCommunityToolkitSampleAppSplashScreen.png" BackgroundColor="#3750D1" />
</uap:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="Microsoft.Toolkit.Uwp.Samples.BackgroundTasks.TestBackgroundTask">
<BackgroundTasks>
<Task Type="timer" />
</BackgroundTasks>
</Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="uwpct">
<uap:DisplayName>UWP Community Toolkit</uap:DisplayName>
</uap:Protocol>
</uap:Extension>
<Extension Category="windows.backgroundTasks" EntryPoint="Microsoft.Toolkit.Uwp.Samples.BackgroundTasks.TestBackgroundTask">
<BackgroundTasks>
<Task Type="timer" />
</BackgroundTasks>
</Extension>
</Extensions>
</Application>
</Applications>
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public sealed partial class Shell

private Compositor _compositor;
private float _defaultShowAnimationDuration = 300;
//private float _defaultHideAnimationDiration = 150;
private XamlRenderService _xamlRenderer = new XamlRenderService();
private bool _lastRenderedProperties = true;
private ThreadPoolTimer _autocompileTimer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public OneDriveStorageItem(IOneDriveClient oneDriveProvider, IItemRequestBuilder
}

// ParentReference null means is root
if(oneDriveItem.ParentReference?.Path != null)
if (oneDriveItem.ParentReference?.Path != null)
{
_path = oneDriveItem.ParentReference.Path.Replace("/drive/root:", string.Empty);
}
Expand Down Expand Up @@ -282,9 +282,11 @@ public bool IsOfType(StorageItemTypes type)
/// <returns>When this method completes successfully, it returns an OneDriveStorageItem that represents the specified folder.</returns>
public async Task<OneDriveStorageItem> RenameAsync(string desiredName, CancellationToken cancellationToken = default(CancellationToken))
{
Item newOneDriveItem = new Item();
newOneDriveItem.Name = desiredName;
newOneDriveItem.Description = "Item Renamed from UWP Toolkit";
Item newOneDriveItem = new Item
{
Name = desiredName,
Description = "Item Renamed from UWP Toolkit"
};

var itemRenamed = await RequestBuilder.Request().UpdateAsync(newOneDriveItem, cancellationToken).ConfigureAwait(false);
return new OneDriveStorageItem(_oneDriveProvider, RequestBuilder, newOneDriveItem);
Expand Down
2 changes: 2 additions & 0 deletions Microsoft.Toolkit.Uwp.UI.Controls/BladeView/BladeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ protected override void OnApplyTemplate()
_enlargeButton.Click += EnlargeButton_Click;
}

/// <inheritdoc/>
protected override void OnExpanded(EventArgs args)
{
base.OnExpanded(args);
Expand All @@ -75,6 +76,7 @@ protected override void OnExpanded(EventArgs args)
}
}

/// <inheritdoc/>
protected override void OnCollapsed(EventArgs args)
{
base.OnCollapsed(args);
Expand Down
46 changes: 35 additions & 11 deletions Microsoft.Toolkit.Uwp.UI.Controls/Carousel/Carousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public object SelectedItem
set { SetValue(SelectedItemProperty, value); }
}

// Using a DependencyProperty as the backing store for SelectedItem. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the SelectedItem Property
/// </summary>
public static readonly DependencyProperty SelectedItemProperty =
DependencyProperty.Register("SelectedItem", typeof(object), typeof(Carousel), new PropertyMetadata(null, OnCarouselPropertyChanged));

Expand All @@ -59,7 +61,9 @@ public int SelectedIndex
}
}

// Using a DependencyProperty as the backing store for SelectedIndex. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the SelectedIndex Property
/// </summary>
public static readonly DependencyProperty SelectedIndexProperty =
DependencyProperty.Register("SelectedIndex", typeof(int), typeof(Carousel), new PropertyMetadata(-1, OnCarouselPropertyChanged));

Expand All @@ -72,7 +76,9 @@ public int TransitionDuration
set { SetValue(TransitionDurationProperty, value); }
}

// Using a DependencyProperty as the backing store for TransitionDuration. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the TransitionDuration Property
/// </summary>
public static readonly DependencyProperty TransitionDurationProperty = DependencyProperty.Register("TransitionDuration", typeof(int), typeof(Carousel), new PropertyMetadata(200));

/// <summary>
Expand All @@ -84,7 +90,9 @@ public int ItemDepth
set { SetValue(ItemDepthProperty, value); }
}

// Using a DependencyProperty as the backing store for Depth. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the ItemDepth Property
/// </summary>
public static readonly DependencyProperty ItemDepthProperty = DependencyProperty.Register("ItemDepth", typeof(int), typeof(Carousel), new PropertyMetadata(0, OnCarouselPropertyChanged));

/// <summary>
Expand All @@ -96,7 +104,9 @@ public EasingFunctionBase EasingFunction
set { SetValue(EasingFunctionProperty, value); }
}

// Using a DependencyProperty as the backing store for EasingFunction. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the EasingFunction Property
/// </summary>
public static readonly DependencyProperty EasingFunctionProperty = DependencyProperty.Register("EasingFunction", typeof(EasingFunctionBase), typeof(Carousel), new PropertyMetadata(new ExponentialEase { EasingMode = EasingMode.EaseOut }));

/// <summary>
Expand All @@ -108,7 +118,9 @@ public int ItemMargin
set { SetValue(ItemMarginProperty, value); }
}

// Using a DependencyProperty as the backing store for TranslateX. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the ItemMargin Property
/// </summary>
public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.Register("ItemMargin", typeof(int), typeof(Carousel), new PropertyMetadata(0, OnCarouselPropertyChanged));

/// <summary>
Expand All @@ -122,7 +134,9 @@ public bool InvertPositive
set { SetValue(InvertPositiveProperty, value); }
}

// Using a DependencyProperty as the backing store for InvertPostive. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the InvertPositive Property
/// </summary>
public static readonly DependencyProperty InvertPositiveProperty =
DependencyProperty.Register("InvertPositive", typeof(bool), typeof(Carousel), new PropertyMetadata(true, OnCarouselPropertyChanged));

Expand All @@ -135,7 +149,9 @@ public double ItemRotationX
set { SetValue(ItemRotationXProperty, value); }
}

// Using a DependencyProperty as the backing store for Rotation. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the ItemRotationX Property
/// </summary>
public static readonly DependencyProperty ItemRotationXProperty = DependencyProperty.Register("ItemRotationX", typeof(double), typeof(Carousel), new PropertyMetadata(0d, OnCarouselPropertyChanged));

/// <summary>
Expand All @@ -147,7 +163,9 @@ public double ItemRotationY
set { SetValue(ItemRotationYProperty, value); }
}

// Using a DependencyProperty as the backing store for Rotation. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the ItemRotationY Property
/// </summary>
public static readonly DependencyProperty ItemRotationYProperty = DependencyProperty.Register("ItemRotationY", typeof(double), typeof(Carousel), new PropertyMetadata(0d, OnCarouselPropertyChanged));

/// <summary>
Expand All @@ -159,7 +177,9 @@ public double ItemRotationZ
set { SetValue(ItemRotationZProperty, value); }
}

// Using a DependencyProperty as the backing store for Rotation. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the ItemRotation Property
/// </summary>
public static readonly DependencyProperty ItemRotationZProperty = DependencyProperty.Register("ItemRotationZ", typeof(double), typeof(Carousel), new PropertyMetadata(0d, OnCarouselPropertyChanged));

/// <summary>
Expand All @@ -171,7 +191,9 @@ public Orientation Orientation
set { SetValue(OrientationProperty, value); }
}

// Using a DependencyProperty as the backing store for MaxViewableItems. This enables animation, styling, binding, etc...
/// <summary>
/// Identifies the Orientation Property
/// </summary>
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(Carousel), new PropertyMetadata(Orientation.Horizontal, OnCarouselPropertyChanged));

/// <summary>
Expand Down Expand Up @@ -436,11 +458,13 @@ internal void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
e.Handled = true;
}

/// <inheritdoc/>
protected override bool IsItemItsOwnContainerOverride(object item)
{
return false;
}

/// <inheritdoc/>
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
Expand Down
Loading