Skip to content

Commit

Permalink
WindowsPhone: Project now building with MPfm.MVP; same status as Wind…
Browse files Browse the repository at this point in the history
…owsStore.

Related to issue #424.
  • Loading branch information
ycastonguay committed Sep 13, 2013
1 parent c84893f commit 09e0543
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 91 deletions.
9 changes: 5 additions & 4 deletions MPfm/MPfm.Library/MPfm.Library.WindowsPhone.csproj
Expand Up @@ -111,15 +111,16 @@
<Compile Include="Database\Interfaces\ISQLiteGateway.cs" />
<Compile Include="Database\DatabaseFacade.cs" />
<Compile Include="Database\WinRTSQLiteGateway.cs" />
<Compile Include="ILibrary.cs" />
<Compile Include="Objects\NetworkState.cs" />
<Compile Include="Objects\PlaylistFile.cs" />
<Compile Include="Objects\History.cs" />
<Compile Include="Objects\Setting.cs" />
<Compile Include="Database\SQLiteGateway.cs" />
<Compile Include="Objects\Folder.cs" />
<Compile Include="Library.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\WinRT\SyncClientService.cs" />
<Compile Include="Services\WinRT\SyncDiscoveryService.cs" />
<Compile Include="Services\WinRT\SyncListenerService.cs" />
<Compile Include="SQLite.cs" />
<Compile Include="SQLiteAsync.cs" />
<Compile Include="UpdateLibrary\UpdateLibraryProgressDataSong.cs" />
Expand All @@ -138,8 +139,8 @@
<Compile Include="Objects\LibraryQuery.cs" />
<Compile Include="Messages\AudioFileCacheUpdatedMessage.cs" />
<Compile Include="Objects\SyncDevice.cs" />
<Compile Include="ISyncDeviceSpecifications.cs" />
<Compile Include="Services\WinRT\UpdateLibraryService.cs" />
<Compile Include="ISyncDeviceSpecifications.cs" />
<Compile Include="Services\WinRT\UpdateLibraryService.cs" />
<Compile Include="Services\Interfaces\IUpdateLibraryService.cs" />
<Compile Include="Services\Events\ProcessEndedEventArgs.cs" />
<Compile Include="Services\Events\RefreshStatusEventArgs.cs" />
Expand Down
154 changes: 77 additions & 77 deletions MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs
Expand Up @@ -16,7 +16,7 @@
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Concurrent;
//using System.Collections.Concurrent; // Not supported on WP8 but supported on W8...
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -77,89 +77,89 @@ public void SearchForDevices(string baseIP)
/// <param name="ips">IP addresses to search</param>
public void SearchForDevices(List<string> ips)
{
SearchForDevices(ips, (devices) => {
if(OnDiscoveryEnded != null)
OnDiscoveryEnded(devices);
});
//SearchForDevices(ips, (devices) => {
// if(OnDiscoveryEnded != null)
// OnDiscoveryEnded(devices);
//});
}

/// <summary>
/// Searches for devices in the IP addresses passed in parameter.
/// </summary>
/// <param name="ips">IP addresses to search</param>
/// <param name="actionDiscoveryEnded">This action will be triggered when the discovery has ended</param>
private void SearchForDevices(List<string> ips, Action<ConcurrentBag<SyncDevice>> actionDiscoveryEnded)
{
//int ipCount = 0;
//_cancellationTokenSource = new CancellationTokenSource();
//ParallelOptions parallelOptions = new ParallelOptions();
//parallelOptions.CancellationToken = _cancellationTokenSource.Token;
//parallelOptions.MaxDegreeOfParallelism = System.Environment.ProcessorCount * 2;
//_currentTask = Task.Factory.StartNew(() => {
// try
// {
// Console.WriteLine("SyncDiscoveryService - SearchForDevices - processorCount: {0}", System.Environment.ProcessorCount);
// IsRunning = true;
// ConcurrentBag<SyncDevice> devices = new ConcurrentBag<SyncDevice>();
// Parallel.For(1, ips.Count, parallelOptions, (index, state) =>
// {
// //// Check for cancel (for some reason this doesn't work!)
// //if (_cancellationTokenSource.IsCancellationRequested)
// // state.Stop();
///// <summary>
///// Searches for devices in the IP addresses passed in parameter.
///// </summary>
///// <param name="ips">IP addresses to search</param>
///// <param name="actionDiscoveryEnded">This action will be triggered when the discovery has ended</param>
//private void SearchForDevices(List<string> ips, Action<ConcurrentBag<SyncDevice>> actionDiscoveryEnded)
//{
// //int ipCount = 0;
// //_cancellationTokenSource = new CancellationTokenSource();
// //ParallelOptions parallelOptions = new ParallelOptions();
// //parallelOptions.CancellationToken = _cancellationTokenSource.Token;
// //parallelOptions.MaxDegreeOfParallelism = System.Environment.ProcessorCount * 2;
// //_currentTask = Task.Factory.StartNew(() => {
// // try
// // {
// // Console.WriteLine("SyncDiscoveryService - SearchForDevices - processorCount: {0}", System.Environment.ProcessorCount);
// // IsRunning = true;
// // ConcurrentBag<SyncDevice> devices = new ConcurrentBag<SyncDevice>();
// // Parallel.For(1, ips.Count, parallelOptions, (index, state) =>
// // {
// // //// Check for cancel (for some reason this doesn't work!)
// // //if (_cancellationTokenSource.IsCancellationRequested)
// // // state.Stop();

// if (_isCancelling)
// {
// Console.WriteLine("SyncDiscoveryService - Cancelling parallel task...");
// state.Stop();
// }
// // if (_isCancelling)
// // {
// // Console.WriteLine("SyncDiscoveryService - Cancelling parallel task...");
// // state.Stop();
// // }

// try
// {
// //Console.WriteLine("SyncDiscoveryService - Pinging {0}...", ips[index]);
// WebClientTimeout client = new WebClientTimeout(800);
// string content = client.DownloadString(string.Format("http://{0}:{1}/sessionsapp.version", ips[index], Port));
// // try
// // {
// // //Console.WriteLine("SyncDiscoveryService - Pinging {0}...", ips[index]);
// // WebClientTimeout client = new WebClientTimeout(800);
// // string content = client.DownloadString(string.Format("http://{0}:{1}/sessionsapp.version", ips[index], Port));

// Console.WriteLine("SyncDiscoveryService - Got version from {0}: {1}", ips[index], content);
// var device = XmlSerialization.Deserialize<SyncDevice>(content);
// if (device.SyncVersionId.ToUpper() == SyncListenerService.SyncVersionId.ToUpper())
// {
// device.Url = String.Format("http://{0}:{1}/", ips[index], Port);
// devices.Add(device);
// Console.WriteLine("SyncDiscoveryService - Raising OnDeviceFound event...");
// if (OnDeviceFound != null)
// OnDeviceFound(device);
// Console.WriteLine("SyncDiscoveryService - The following host is available: {0}", ips[index]);
// }
// }
// catch (Exception ex)
// {
// // Ignore IP address
// }
// finally
// {
// ipCount++;
// float percentageDone = ((float)ipCount / (float)ips.Count) * 100;
// if (OnDiscoveryProgress != null)
// OnDiscoveryProgress(percentageDone, String.Format("Finding devices on local network ({0:0}%)", percentageDone));
// }
// });
// // Console.WriteLine("SyncDiscoveryService - Got version from {0}: {1}", ips[index], content);
// // var device = XmlSerialization.Deserialize<SyncDevice>(content);
// // if (device.SyncVersionId.ToUpper() == SyncListenerService.SyncVersionId.ToUpper())
// // {
// // device.Url = String.Format("http://{0}:{1}/", ips[index], Port);
// // devices.Add(device);
// // Console.WriteLine("SyncDiscoveryService - Raising OnDeviceFound event...");
// // if (OnDeviceFound != null)
// // OnDeviceFound(device);
// // Console.WriteLine("SyncDiscoveryService - The following host is available: {0}", ips[index]);
// // }
// // }
// // catch (Exception ex)
// // {
// // // Ignore IP address
// // }
// // finally
// // {
// // ipCount++;
// // float percentageDone = ((float)ipCount / (float)ips.Count) * 100;
// // if (OnDiscoveryProgress != null)
// // OnDiscoveryProgress(percentageDone, String.Format("Finding devices on local network ({0:0}%)", percentageDone));
// // }
// // });

// IsRunning = false;
// // IsRunning = false;

// Console.WriteLine("SyncDiscoveryService - Discovery done!");
// if (actionDiscoveryEnded != null)
// actionDiscoveryEnded(devices);
// }
// catch (OperationCanceledException ex)
// {
// Console.WriteLine("SyncDiscoveryService - SearchForDevices - OperationCanceledException: {0}", ex);
// }
// catch (Exception ex)
// {
// Console.WriteLine("SyncDiscoveryService - SearchForDevices - Exception: {0}", ex);
// }
//});
}
// // Console.WriteLine("SyncDiscoveryService - Discovery done!");
// // if (actionDiscoveryEnded != null)
// // actionDiscoveryEnded(devices);
// // }
// // catch (OperationCanceledException ex)
// // {
// // Console.WriteLine("SyncDiscoveryService - SearchForDevices - OperationCanceledException: {0}", ex);
// // }
// // catch (Exception ex)
// // {
// // Console.WriteLine("SyncDiscoveryService - SearchForDevices - Exception: {0}", ex);
// // }
// //});
//}

/// <summary>
/// Cancels the discovery process.
Expand Down
25 changes: 21 additions & 4 deletions MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj
Expand Up @@ -5,12 +5,12 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5CA0AA57-8F15-4DC2-B5C6-25692F200869}</ProjectGuid>
<ProjectGuid>{FC1E0293-0863-4C96-A514-98B70C695DAC}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MPfm.Core</RootNamespace>
<AssemblyName>MPfm.Core</AssemblyName>
<RootNamespace>MPfm.MVP</RootNamespace>
<AssemblyName>MPfm.MVP</AssemblyName>
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
Expand Down Expand Up @@ -82,7 +82,24 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\MPfm.Core\MPfm.Core.WindowsPhone.csproj">
<Project>{5CA0AA57-8F15-4DC2-B5C6-25692F200869}</Project>
<Name>MPfm.Core.WindowsPhone</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Library\MPfm.Library.WindowsPhone.csproj">
<Project>{317F03EF-9294-47D4-A915-7ABDC647897A}</Project>
<Name>MPfm.Library.WindowsPhone</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Player\MPfm.Player.WindowsPhone.csproj">
<Project>{4ACC27D9-C476-4BCA-B5BE-F1A067B5E317}</Project>
<Name>MPfm.Player.WindowsPhone</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Sound\MPfm.Sound.WindowsPhone.csproj">
<Project>{591A3842-87BC-467F-AA99-42749C8DBFB3}</Project>
<Name>MPfm.Sound.WindowsPhone</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Messages\ConnectionStatusChangedMessage.cs" />
Expand Down
7 changes: 4 additions & 3 deletions MPfm/MPfm.Sound/MPfm.Sound.WindowsPhone.csproj
Expand Up @@ -92,28 +92,29 @@
<Compile Include="AudioFiles\AudioFileFormatExtensions.cs" />
<Compile Include="AudioFiles\ConvertAudio.cs" />
<Compile Include="AudioFiles\AudioFileFormat.cs" />
<Compile Include="BassNetWrapper\DriverType.cs" />
<Compile Include="PeakFiles\PeakFileCorruptedException.cs" />
<Compile Include="PeakFiles\PeakFileDoneData.cs" />
<Compile Include="PeakFiles\PeakFileFormatIncompatibleException.cs" />
<Compile Include="PeakFiles\PeakFileProgressData.cs" />
<Compile Include="PeakFiles\PeakFileStartedData.cs" />
<Compile Include="PeakFiles\WinRT\PeakFileService.cs" />
<Compile Include="PeakFiles\WinRT\PeakFileService.cs" />
<Compile Include="Tags\APEMetadata.cs" />
<Compile Include="Playlists\Playlist.cs" />
<Compile Include="Playlists\PlaylistItem.cs" />
<Compile Include="Playlists\PlaylistTools.cs" />
<Compile Include="Playlists\PlaylistFileFormat.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BassNetWrapper\Device.cs" />
<Compile Include="BassNetWrapper\Exception.cs" />
<Compile Include="BassNetWrapper\Exception.cs" />
<Compile Include="Tags\APETag.cs" />
<Compile Include="Tags\SV7Metadata.cs" />
<Compile Include="Tags\SV7Tag.cs" />
<Compile Include="Tags\ID3v2Tag.cs" />
<Compile Include="Tags\ID3v2Metadata.cs" />
<Compile Include="Tags\SV8Tag.cs" />
<Compile Include="Tags\SV8Metadata.cs" />
<Compile Include="PeakFiles\IPeakFileService.cs" />
<Compile Include="PeakFiles\IPeakFileService.cs" />
<Compile Include="Readers\XingInfoHeaderReader.cs" />
<Compile Include="BassNetKey.cs" />
</ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions MPfm/MPfm.Sound/PeakFiles/WinRT/PeakFileService.cs
Expand Up @@ -17,9 +17,6 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using MPfm.Core;
Expand Down
4 changes: 4 additions & 0 deletions MPfm/MPfm.WindowsPhone/MPfm.WindowsPhone.csproj
Expand Up @@ -156,6 +156,10 @@
<Project>{317F03EF-9294-47D4-A915-7ABDC647897A}</Project>
<Name>MPfm.Library.WindowsPhone</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.MVP\MPfm.MVP.WindowsPhone.csproj">
<Project>{FC1E0293-0863-4C96-A514-98B70C695DAC}</Project>
<Name>MPfm.MVP.WindowsPhone</Name>
</ProjectReference>
<ProjectReference Include="..\MPfm.Player\MPfm.Player.WindowsPhone.csproj">
<Project>{4ACC27D9-C476-4BCA-B5BE-F1A067B5E317}</Project>
<Name>MPfm.Player.WindowsPhone</Name>
Expand Down
22 changes: 22 additions & 0 deletions MPfm/MPfm_WindowsPhone.sln
Expand Up @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPfm.Library.WindowsPhone",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sqlite", "..\..\sqlite-net-wp8\Sqlite.vcxproj", "{59B35F6C-E062-4F0E-88D8-13F3F82A24F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPfm.MVP.WindowsPhone", "MPfm.MVP\MPfm.MVP.WindowsPhone.csproj", "{FC1E0293-0863-4C96-A514-98B70C695DAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -155,6 +157,26 @@ Global
{59B35F6C-E062-4F0E-88D8-13F3F82A24F3}.Release|Win32.Build.0 = Release|Win32
{59B35F6C-E062-4F0E-88D8-13F3F82A24F3}.Release|x86.ActiveCfg = Release|Win32
{59B35F6C-E062-4F0E-88D8-13F3F82A24F3}.Release|x86.Build.0 = Release|Win32
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|ARM.ActiveCfg = Debug|ARM
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|ARM.Build.0 = Debug|ARM
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Mixed Platforms.Build.0 = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Win32.ActiveCfg = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|Win32.Build.0 = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|x86.ActiveCfg = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Debug|x86.Build.0 = Debug|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Any CPU.Build.0 = Release|Any CPU
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|ARM.ActiveCfg = Release|ARM
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|ARM.Build.0 = Release|ARM
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Mixed Platforms.ActiveCfg = Release|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Mixed Platforms.Build.0 = Release|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Win32.ActiveCfg = Release|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|Win32.Build.0 = Release|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|x86.ActiveCfg = Release|x86
{FC1E0293-0863-4C96-A514-98B70C695DAC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 09e0543

Please sign in to comment.