From dfd229cc23ef669bb8212df9f23daeaed3ea1891 Mon Sep 17 00:00:00 2001 From: Mauricio DIAZ ORLICH Date: Thu, 5 Dec 2013 17:22:23 +0100 Subject: [PATCH] Initial cleanup attempt --- WygwamToolkit.Common/Info/IDeviceInfo.cs | 7 ---- .../GeoPosition.cs} | 32 +++++++++++-------- .../Location/ILocationManager.cs | 29 +++++++++++++++++ .../Managers/BaseManifestManager.cs | 4 +-- .../Networking/InternetConnectionType.cs | 7 +--- .../Networking/NetworkChangedEventArgs.cs | 7 +--- .../Networking/NetworkManager.cs | 4 +-- WygwamToolkit.Common/Security/Credential.cs | 26 +++++++++------ .../Security/ISecurePassword.cs | 30 ++++++++++------- .../Security/SecurityPropertyAttribute.cs | 25 +++++++++++---- .../Store/RatingReminderSettings.cs | 5 +-- WygwamToolkit.Common/Tools/AsyncSemaphore.cs | 10 +++--- WygwamToolkit.Common/Tools/ITimer.cs | 22 +++++++------ WygwamToolkit.Common/Wygwam.Windows.csproj | 3 +- .../Managers/LocationManager.cs | 9 ++---- .../Security/SecurePassword.cs | 12 +++---- WygwamToolkit.Phone/Timer.cs | 2 -- .../Managers/LocationManager.cs | 2 +- 18 files changed, 138 insertions(+), 98 deletions(-) rename WygwamToolkit.Common/{Managers/ILocationManager.cs => Location/GeoPosition.cs} (55%) create mode 100644 WygwamToolkit.Common/Location/ILocationManager.cs diff --git a/WygwamToolkit.Common/Info/IDeviceInfo.cs b/WygwamToolkit.Common/Info/IDeviceInfo.cs index 8568609..f680449 100644 --- a/WygwamToolkit.Common/Info/IDeviceInfo.cs +++ b/WygwamToolkit.Common/Info/IDeviceInfo.cs @@ -12,19 +12,12 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// -// Based on the BindableBase class provided by Microsoft in -// Windows Store Application project templates. // //----------------------------------------------------------------------- namespace Wygwam.Windows.Info { using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; /// /// Instance grouping many information for the device diff --git a/WygwamToolkit.Common/Managers/ILocationManager.cs b/WygwamToolkit.Common/Location/GeoPosition.cs similarity index 55% rename from WygwamToolkit.Common/Managers/ILocationManager.cs rename to WygwamToolkit.Common/Location/GeoPosition.cs index a763d5b..14ecb8e 100644 --- a/WygwamToolkit.Common/Managers/ILocationManager.cs +++ b/WygwamToolkit.Common/Location/GeoPosition.cs @@ -1,18 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +//----------------------------------------------------------------------- +// +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//----------------------------------------------------------------------- -namespace WygwamToolkit.Common.Managers +namespace Wygwam.Windows.Location { - public interface ILocationManager - { - GeoPosition LastKnowPosition { get; set; } - - Task GetLocationAsync(); - Task AskForRightAsync(); - } + using System; public class GeoPosition { @@ -23,6 +28,7 @@ public enum Unit } public double Latitude { get; set; } + public double Longitude { get; set; } public GeoPosition(double latitude, double longitude) diff --git a/WygwamToolkit.Common/Location/ILocationManager.cs b/WygwamToolkit.Common/Location/ILocationManager.cs new file mode 100644 index 0000000..c39ce33 --- /dev/null +++ b/WygwamToolkit.Common/Location/ILocationManager.cs @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//----------------------------------------------------------------------- + +namespace Wygwam.Windows.Location +{ + using System.Threading.Tasks; + + public interface ILocationManager + { + GeoPosition LastKnowPosition { get; set; } + + Task GetLocationAsync(); + Task AskForRightAsync(); + } +} diff --git a/WygwamToolkit.Common/Managers/BaseManifestManager.cs b/WygwamToolkit.Common/Managers/BaseManifestManager.cs index 246211d..feb8b3e 100644 --- a/WygwamToolkit.Common/Managers/BaseManifestManager.cs +++ b/WygwamToolkit.Common/Managers/BaseManifestManager.cs @@ -211,9 +211,9 @@ private async Task LoadDefaultManifest() return _current; } - protected virtual async Task OnLoading() + protected virtual Task OnLoading() { - return null; + return Task.FromResult(null); } } } diff --git a/WygwamToolkit.Common/Networking/InternetConnectionType.cs b/WygwamToolkit.Common/Networking/InternetConnectionType.cs index a2887d8..cbdce31 100644 --- a/WygwamToolkit.Common/Networking/InternetConnectionType.cs +++ b/WygwamToolkit.Common/Networking/InternetConnectionType.cs @@ -15,14 +15,9 @@ // //----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Wygwam.Windows.Networking { + public enum InternetConnectionType { None, diff --git a/WygwamToolkit.Common/Networking/NetworkChangedEventArgs.cs b/WygwamToolkit.Common/Networking/NetworkChangedEventArgs.cs index 3b0aecf..637afc0 100644 --- a/WygwamToolkit.Common/Networking/NetworkChangedEventArgs.cs +++ b/WygwamToolkit.Common/Networking/NetworkChangedEventArgs.cs @@ -15,14 +15,9 @@ // //----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Wygwam.Windows.Networking { + using System; public class NetworkChangedEventArgs : EventArgs { diff --git a/WygwamToolkit.Common/Networking/NetworkManager.cs b/WygwamToolkit.Common/Networking/NetworkManager.cs index 4210460..6b7a4c3 100644 --- a/WygwamToolkit.Common/Networking/NetworkManager.cs +++ b/WygwamToolkit.Common/Networking/NetworkManager.cs @@ -15,10 +15,10 @@ // //----------------------------------------------------------------------- -using System; - namespace Wygwam.Windows.Networking { + using System; + /// /// Serves as a base for platform-specific classes that provide access to network connection information. /// diff --git a/WygwamToolkit.Common/Security/Credential.cs b/WygwamToolkit.Common/Security/Credential.cs index d9f3b60..694d394 100644 --- a/WygwamToolkit.Common/Security/Credential.cs +++ b/WygwamToolkit.Common/Security/Credential.cs @@ -1,9 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security; -using System.Text; -using System.Threading.Tasks; +//----------------------------------------------------------------------- +// +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//----------------------------------------------------------------------- namespace Wygwam.Windows.Security { @@ -12,8 +22,6 @@ namespace Wygwam.Windows.Security /// public class Credential { - #region Properties - /// /// Gets or sets the username. /// @@ -39,7 +47,5 @@ public class Credential /// [SecurityProperty] public string Password { get; set; } - - #endregion } } diff --git a/WygwamToolkit.Common/Security/ISecurePassword.cs b/WygwamToolkit.Common/Security/ISecurePassword.cs index 4d939b7..0eeedac 100644 --- a/WygwamToolkit.Common/Security/ISecurePassword.cs +++ b/WygwamToolkit.Common/Security/ISecurePassword.cs @@ -1,9 +1,23 @@ -namespace Wygwam.Windows.Security +//----------------------------------------------------------------------- +// +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//----------------------------------------------------------------------- + +namespace Wygwam.Windows.Security { - using System; using System.Collections.Generic; - using System.Linq; - using System.Text; using System.Threading.Tasks; /// @@ -11,8 +25,6 @@ /// public interface ISecurePassword { - #region Properties - /// /// Gets the count. /// @@ -21,10 +33,6 @@ public interface ISecurePassword /// int Count { get; } - #endregion - - #region Methods - /// /// Adds the specified credential. /// @@ -61,7 +69,5 @@ public interface ISecurePassword /// /// Task Commit(); - - #endregion } } diff --git a/WygwamToolkit.Common/Security/SecurityPropertyAttribute.cs b/WygwamToolkit.Common/Security/SecurityPropertyAttribute.cs index a0ad4a3..4d7759a 100644 --- a/WygwamToolkit.Common/Security/SecurityPropertyAttribute.cs +++ b/WygwamToolkit.Common/Security/SecurityPropertyAttribute.cs @@ -1,12 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +//----------------------------------------------------------------------- +// +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//----------------------------------------------------------------------- namespace Wygwam.Windows.Security { - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited=true)] + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)] public class SecurityPropertyAttribute : Attribute { } diff --git a/WygwamToolkit.Common/Store/RatingReminderSettings.cs b/WygwamToolkit.Common/Store/RatingReminderSettings.cs index 2bcf0f9..30c7a91 100644 --- a/WygwamToolkit.Common/Store/RatingReminderSettings.cs +++ b/WygwamToolkit.Common/Store/RatingReminderSettings.cs @@ -15,10 +15,11 @@ // //----------------------------------------------------------------------- -using System.Collections.Generic; -using System.Linq; namespace Wygwam.Windows.Store { + using System.Collections.Generic; + using System.Linq; + /// /// Provides settings to an instance of . /// diff --git a/WygwamToolkit.Common/Tools/AsyncSemaphore.cs b/WygwamToolkit.Common/Tools/AsyncSemaphore.cs index 0cb8334..ae9a2f0 100644 --- a/WygwamToolkit.Common/Tools/AsyncSemaphore.cs +++ b/WygwamToolkit.Common/Tools/AsyncSemaphore.cs @@ -4,14 +4,12 @@ // //----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Wygwam.Windows { + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public class AsyncSemaphore { private readonly static Task s_completed = Task.FromResult(true); diff --git a/WygwamToolkit.Common/Tools/ITimer.cs b/WygwamToolkit.Common/Tools/ITimer.cs index 49b4d53..820d98a 100644 --- a/WygwamToolkit.Common/Tools/ITimer.cs +++ b/WygwamToolkit.Common/Tools/ITimer.cs @@ -1,16 +1,18 @@ //----------------------------------------------------------------------- // -// MS-PL +// Copyright (c) 2013 Wygwam. +// Licensed under the Microsoft Public License (Ms-PL) (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://opensource.org/licenses/Ms-PL.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // -// -// This source code is subject to terms and conditions of the Microsoft -// Public License. A copy of the license can be found in the LICENSE.md -// file at the root of this distribution. -// By using this source code in any fashion, you are agreeing to be bound -// by the terms of the Microsoft Public License. You must not remove this -// notice, or any other, from this software. -// -//----------------------------------------------------------------------- namespace Wygwam.Windows { diff --git a/WygwamToolkit.Common/Wygwam.Windows.csproj b/WygwamToolkit.Common/Wygwam.Windows.csproj index 1fe591f..93a54a4 100644 --- a/WygwamToolkit.Common/Wygwam.Windows.csproj +++ b/WygwamToolkit.Common/Wygwam.Windows.csproj @@ -45,8 +45,9 @@ + + - diff --git a/WygwamToolkit.Phone/Managers/LocationManager.cs b/WygwamToolkit.Phone/Managers/LocationManager.cs index 2501832..8125027 100644 --- a/WygwamToolkit.Phone/Managers/LocationManager.cs +++ b/WygwamToolkit.Phone/Managers/LocationManager.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using System.Windows; using Windows.Devices.Geolocation; -using WygwamToolkit.Common.Managers; +using Wygwam.Windows.Location; namespace WygwamToolkit.Phone.Managers { @@ -10,17 +10,14 @@ public class LocationManager : ILocationManager { public GeoPosition LastKnowPosition { get; set; } - public async Task AskForRightAsync() + public Task AskForRightAsync() { MessageBoxResult result = MessageBox.Show("L'application a besoin de connaitre votre position, êtes vous d'accord?", "Position", MessageBoxButton.OKCancel); - if (result == MessageBoxResult.OK) - return true; - else - return false; + return Task.FromResult(result == MessageBoxResult.OK); } public async Task GetLocationAsync() diff --git a/WygwamToolkit.Phone/Security/SecurePassword.cs b/WygwamToolkit.Phone/Security/SecurePassword.cs index 96d3180..bd99f88 100644 --- a/WygwamToolkit.Phone/Security/SecurePassword.cs +++ b/WygwamToolkit.Phone/Security/SecurePassword.cs @@ -1,18 +1,18 @@ namespace Wygwam.Windows.Phone.Security { + using global::Windows.Phone.System.Analytics; using System; using System.Collections.Generic; + using System.Diagnostics; + using System.IO; using System.Linq; + using System.Reflection; + using System.Runtime.Serialization.Json; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; - using global::Windows.Phone.System.Analytics; - using Wygwam.Windows.Security; - using System.Reflection; using Wygwam.Windows.Phone.Managers; - using System.Diagnostics; - using System.Runtime.Serialization.Json; - using System.IO; + using Wygwam.Windows.Security; using Wygwam.Windows.Tools; /// diff --git a/WygwamToolkit.Phone/Timer.cs b/WygwamToolkit.Phone/Timer.cs index e8eef51..144e221 100644 --- a/WygwamToolkit.Phone/Timer.cs +++ b/WygwamToolkit.Phone/Timer.cs @@ -17,7 +17,6 @@ namespace Wygwam.Windows { using System; - using System.Windows.Threading; /// @@ -28,7 +27,6 @@ public class Timer : ITimer { private DispatcherTimer _timer; private TimeSpan _interval; - private bool _isEnabled; /// /// Initializes a new instance of the class. diff --git a/WygwamToolkit.WinRT/Managers/LocationManager.cs b/WygwamToolkit.WinRT/Managers/LocationManager.cs index 7aebbc3..b3873cc 100644 --- a/WygwamToolkit.WinRT/Managers/LocationManager.cs +++ b/WygwamToolkit.WinRT/Managers/LocationManager.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; using Windows.Devices.Geolocation; -using WygwamToolkit.Common.Managers; +using Wygwam.Windows.Location; namespace WygwamToolkit.WinRT.Managers {