Skip to content

Commit

Permalink
Initial cleanup attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
madd0 committed Dec 5, 2013
1 parent 3b3fb30 commit dfd229c
Show file tree
Hide file tree
Showing 18 changed files with 138 additions and 98 deletions.
7 changes: 0 additions & 7 deletions WygwamToolkit.Common/Info/IDeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <c>BindableBase</c> class provided by Microsoft in
// Windows Store Application project templates.
// </copyright>
//-----------------------------------------------------------------------

namespace Wygwam.Windows.Info
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Instance grouping many information for the device
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//-----------------------------------------------------------------------
// <copyright file="GeoPosition.cs" company="Wygwam">
// 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.
// </copyright>
//-----------------------------------------------------------------------

namespace WygwamToolkit.Common.Managers
namespace Wygwam.Windows.Location
{
public interface ILocationManager
{
GeoPosition LastKnowPosition { get; set; }

Task<GeoPosition> GetLocationAsync();
Task<bool> AskForRightAsync();
}
using System;

public class GeoPosition
{
Expand All @@ -23,6 +28,7 @@ public enum Unit
}

public double Latitude { get; set; }

public double Longitude { get; set; }

public GeoPosition(double latitude, double longitude)
Expand Down
29 changes: 29 additions & 0 deletions WygwamToolkit.Common/Location/ILocationManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------
// <copyright file="ILocationManager.cs" company="Wygwam">
// 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.
// </copyright>
//-----------------------------------------------------------------------

namespace Wygwam.Windows.Location
{
using System.Threading.Tasks;

public interface ILocationManager
{
GeoPosition LastKnowPosition { get; set; }

Task<GeoPosition> GetLocationAsync();
Task<bool> AskForRightAsync();
}
}
4 changes: 2 additions & 2 deletions WygwamToolkit.Common/Managers/BaseManifestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ private async Task<IManifestManager> LoadDefaultManifest()
return _current;
}

protected virtual async Task<IManifestManager> OnLoading()
protected virtual Task<IManifestManager> OnLoading()
{
return null;
return Task.FromResult<IManifestManager>(null);
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions WygwamToolkit.Common/Networking/InternetConnectionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wygwam.Windows.Networking
{

public enum InternetConnectionType
{
None,
Expand Down
7 changes: 1 addition & 6 deletions WygwamToolkit.Common/Networking/NetworkChangedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@
// </copyright>
//-----------------------------------------------------------------------

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
{
Expand Down
4 changes: 2 additions & 2 deletions WygwamToolkit.Common/Networking/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// </copyright>
//-----------------------------------------------------------------------

using System;

namespace Wygwam.Windows.Networking
{
using System;

/// <summary>
/// Serves as a base for platform-specific classes that provide access to network connection information.
/// </summary>
Expand Down
26 changes: 16 additions & 10 deletions WygwamToolkit.Common/Security/Credential.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
//-----------------------------------------------------------------------
// <copyright file="Credential.cs" company="Wygwam">
// 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.
// </copyright>
//-----------------------------------------------------------------------

namespace Wygwam.Windows.Security
{
Expand All @@ -12,8 +22,6 @@ namespace Wygwam.Windows.Security
/// </summary>
public class Credential
{
#region Properties

/// <summary>
/// Gets or sets the username.
/// </summary>
Expand All @@ -39,7 +47,5 @@ public class Credential
/// </value>
[SecurityProperty]
public string Password { get; set; }

#endregion
}
}
30 changes: 18 additions & 12 deletions WygwamToolkit.Common/Security/ISecurePassword.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
namespace Wygwam.Windows.Security
//-----------------------------------------------------------------------
// <copyright file="ISecurePassword.cs" company="Wygwam">
// 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.
// </copyright>
//-----------------------------------------------------------------------

namespace Wygwam.Windows.Security
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Managed credential with secured password
/// </summary>
public interface ISecurePassword
{
#region Properties

/// <summary>
/// Gets the count.
/// </summary>
Expand All @@ -21,10 +33,6 @@ public interface ISecurePassword
/// </value>
int Count { get; }

#endregion

#region Methods

/// <summary>
/// Adds the specified credential.
/// </summary>
Expand Down Expand Up @@ -61,7 +69,5 @@ public interface ISecurePassword
/// </summary>
/// <returns></returns>
Task Commit();

#endregion
}
}
25 changes: 19 additions & 6 deletions WygwamToolkit.Common/Security/SecurityPropertyAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//-----------------------------------------------------------------------
// <copyright file="SecurityPropertyAttribute.cs" company="Wygwam">
// 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.
// </copyright>
//-----------------------------------------------------------------------

namespace Wygwam.Windows.Security
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited=true)]
using System;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public class SecurityPropertyAttribute : Attribute
{
}
Expand Down
5 changes: 3 additions & 2 deletions WygwamToolkit.Common/Store/RatingReminderSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
// </copyright>
//-----------------------------------------------------------------------

using System.Collections.Generic;
using System.Linq;
namespace Wygwam.Windows.Store
{
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Provides settings to an instance of <see cref="T:IRatingReminder"/>.
/// </summary>
Expand Down
10 changes: 4 additions & 6 deletions WygwamToolkit.Common/Tools/AsyncSemaphore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
// </copyright>
//-----------------------------------------------------------------------

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);
Expand Down
22 changes: 12 additions & 10 deletions WygwamToolkit.Common/Tools/ITimer.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
//-----------------------------------------------------------------------
// <copyright file="ITimer.cs" company="Wygwam">
// 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.
// </copyright>
// <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.
// </license>
//-----------------------------------------------------------------------

namespace Wygwam.Windows
{
Expand Down
3 changes: 2 additions & 1 deletion WygwamToolkit.Common/Wygwam.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
<Compile Include="Input\DelegateCommand{T}.cs" />
<Compile Include="Input\DelegateCommand.cs" />
<Compile Include="Input\IAsyncExecutable.cs" />
<Compile Include="Location\GeoPosition.cs" />
<Compile Include="Location\ILocationManager.cs" />
<Compile Include="Managers\BaseManifestManager.cs" />
<Compile Include="Managers\ILocationManager.cs" />
<Compile Include="Managers\IManifestManager.cs" />
<Compile Include="Networking\InternetConnectionType.cs" />
<Compile Include="Networking\NetworkChangedEventArgs.cs" />
Expand Down
9 changes: 3 additions & 6 deletions WygwamToolkit.Phone/Managers/LocationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@
using System.Threading.Tasks;
using System.Windows;
using Windows.Devices.Geolocation;
using WygwamToolkit.Common.Managers;
using Wygwam.Windows.Location;

namespace WygwamToolkit.Phone.Managers
{
public class LocationManager : ILocationManager
{
public GeoPosition LastKnowPosition { get; set; }

public async Task<bool> AskForRightAsync()
public Task<bool> 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<bool>(result == MessageBoxResult.OK);
}

public async Task<GeoPosition> GetLocationAsync()
Expand Down
Loading

0 comments on commit dfd229c

Please sign in to comment.