From 0f665bbf2a69b97a389f7dc700b67750c5821330 Mon Sep 17 00:00:00 2001 From: Yanick Castonguay Date: Mon, 14 Oct 2013 21:11:55 -0400 Subject: [PATCH 1/2] WindowsStore: Now extending system splash screen into splash page. InitializationService now runs successfully and creates a SQLite database using SQL scripts. The gateway isn't finished yet though. Related to issue #424. --- .../Preferences/ConfigurationHelper.cs | 93 +++ MPfm/MPfm.Core/Preferences/PreferenceKeys.cs | 27 + .../Preferences/XmlPreferencesManager.cs | 46 ++ .../Database/WinRTSQLiteGateway.cs | 116 +--- .../MPfm.Library.WindowsStore.csproj | 1 + MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs | 9 +- .../Presenters/LibraryBrowserPresenter.cs | 612 +++++++++--------- .../Services/InitializationService.cs | 99 ++- MPfm/MPfm.Windows/Classes/Forms/frmMain.cs | 8 +- MPfm/MPfm.WindowsStore/App.xaml.cs | 89 +-- .../WindowsStoreNavigationManager.cs | 13 +- .../Classes/Pages/MainPage.xaml.cs | 4 +- .../Classes/Pages/SplashPage.xaml | 100 +-- .../Classes/Pages/SplashPage.xaml.cs | 64 +- .../MPfm.WindowsStore.csproj | 4 + MPfm/MPfm.WindowsStore/packages.config | 4 + ProjectSync/ProjectFileReader.cs | 116 ++-- ProjectSync/ProjectFileWriter.cs | 138 ++-- ProjectSync/ProjectSync.csproj | 98 +-- ProjectSync/ProjectSync.sln | 40 +- ProjectSync/README.md | 10 +- ProjectSync/SolutionFileReader.cs | 116 ++-- 22 files changed, 929 insertions(+), 878 deletions(-) create mode 100644 MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs create mode 100644 MPfm/MPfm.Core/Preferences/PreferenceKeys.cs create mode 100644 MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs create mode 100644 MPfm/MPfm.WindowsStore/packages.config diff --git a/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs b/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs new file mode 100644 index 00000000..0736f238 --- /dev/null +++ b/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs @@ -0,0 +1,93 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System.IO; +using MPfm.MVP.Config; + +namespace MPfm.Core.Preferences +{ + /// + /// Helper static class for configuration paths. + /// + public static class ConfigurationHelper + { + public static string HomeDirectory; + public static string PeakFileDirectory; + public static string ConfigurationFilePath; + public static string DatabaseFilePath; + public static string LogFilePath; + + static ConfigurationHelper() + { + // Get assembly directory + //string assemblyDirectory = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + //// Get application data folder path + //// Vista/Windows7: C:\Users\%username%\AppData\Roaming\ + //// XP: C:\Documents and Settings\%username%\Application Data\ + //applicationDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\MPfm"; + +#if IOS || ANDROID + HomeDirectory = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); + PeakFileDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "PeakFiles"); +#elif WINDOWSSTORE || WINDOWS_PHONE + HomeDirectory = "TODO"; + PeakFileDirectory = "TODO"; +#else + HomeDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), ".MPfm"); + PeakFileDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), ".MPfm", "PeakFiles"); +#endif + + ConfigurationFilePath = Path.Combine(HomeDirectory, "MPfm.Configuration.xml"); + DatabaseFilePath = Path.Combine(HomeDirectory, "MPfm.Database.db"); + LogFilePath = Path.Combine(HomeDirectory, "MPfm.Log.txt"); + } + + /// + /// Loads MPfmConfig from file. + /// + /// Configuration file path + /// MPfmConfig object + public static MPfmConfig Load(string filePath) + { +#if WINDOWSSTORE + return new MPfmConfig(); +#else + XmlSerializer deserializer = new XmlSerializer(typeof(MPfmConfig)); + TextReader textReader = new StreamReader(filePath); + Object obj = deserializer.Deserialize(textReader); + MPfmConfig theme = (MPfmConfig)obj; + return theme; +#endif + } + + /// + /// Saves MPfmConfig to file. + /// + /// Configuration file path + /// MPfmConfig object + public static void Save(string filePath, MPfmConfig config) + { +#if !WINDOWSSTORE + XmlSerializer serializer = new XmlSerializer(typeof(MPfmConfig)); + TextWriter textWriter = new StreamWriter(filePath); + serializer.Serialize(textWriter, config); + textWriter.Dispose(); +#endif + } + } +} + diff --git a/MPfm/MPfm.Core/Preferences/PreferenceKeys.cs b/MPfm/MPfm.Core/Preferences/PreferenceKeys.cs new file mode 100644 index 00000000..d53cd7a0 --- /dev/null +++ b/MPfm/MPfm.Core/Preferences/PreferenceKeys.cs @@ -0,0 +1,27 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System; + +namespace MPfm.Core.Preferences +{ + public static class PreferenceKeys + { + public const string AudioBufferLength = "AudioBufferLength"; + public const string LibrarySyncServerPort = "LibrarySyncServerPort"; + } +} diff --git a/MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs b/MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs new file mode 100644 index 00000000..94c8758e --- /dev/null +++ b/MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs @@ -0,0 +1,46 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.Core.Preferences +{ + public class XmlPreferencesManager : IPreferencesManager + { + public XmlPreferencesManager() + { + //var stuff = new Xml + } + + public bool GetBool(string key) + { + return false; + } + + public int GetInt(string key) + { + return 0; + } + + public string GetString(string key) + { + return string.Empty; + } + + public void SetValue(string key, object value) + { + } + } +} diff --git a/MPfm/MPfm.Library/Database/WinRTSQLiteGateway.cs b/MPfm/MPfm.Library/Database/WinRTSQLiteGateway.cs index 252dc70d..ece12ba1 100644 --- a/MPfm/MPfm.Library/Database/WinRTSQLiteGateway.cs +++ b/MPfm/MPfm.Library/Database/WinRTSQLiteGateway.cs @@ -64,7 +64,7 @@ public WinRTSQLiteGateway(string databaseFilePath) /// public static void CreateDatabaseFile(string databaseFilePath) { - // Not available on WinRT... the database needs to already exist! + // Just create a connection, if the file doesn't exist, it will create the file. } /// @@ -348,108 +348,30 @@ public T SelectOne(string sql) where T : new() public List Select(string sql) where T : new() { SQLiteConnection connection = null; - //DbDataReader reader = null; SQLiteCommand command = null; List list = new List(); var maps = GetMap(); - return list; - - //try - //{ - // // Create and open _connection - // connection = GenerateConnection(); - // connection.Open(); - - // // Create command - // command = factory.CreateCommand(); - // command.CommandText = sql; - // command.Connection = connection; - - // // Create and execute reader - // reader = command.ExecuteReader(); - // while (reader.Read()) - // { - // // Create object and fill data - // T data = new T(); - - // // Cycle through columns - // for (int a = 0; a < reader.FieldCount; a++) - // { - // // Get column info - // string fieldName = reader.GetName(a); - // Type fieldType = reader.GetFieldType(a); - // object fieldValue = reader.GetValue(a); - - // // Check for map - // string propertyName = fieldName; - // if(dictMap.ContainsKey(fieldName)) - // { - // propertyName = dictMap[fieldName]; - // } - - // // Get property info and fill column if valid - // PropertyInfo info = typeof(T).GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty); - // if (info != null) - // { - // // Set value to null - // if (fieldValue is System.DBNull) - // fieldValue = null; - - // // Check if the type is an enum - // if (info.PropertyType.IsEnum) - // { - // fieldValue = Enum.Parse(info.PropertyType, fieldValue.ToString()); - // } - // else if (info.PropertyType.FullName.ToUpper() == "SYSTEM.GUID") - // { - // // Guid aren't supported in SQLite, so they are stored as strings. - // fieldValue = new Guid(fieldValue.ToString()); - // } - // else if (info.PropertyType.FullName != fieldType.FullName) - // { - // // Call a convert method in the Convert static class, if available - // MethodInfo castMethod = typeof(Convert).GetMethod("To" + info.PropertyType.Name, new Type[] { fieldType }); - // if (castMethod != null) - // { - // fieldValue = castMethod.Invoke(null, new object[] { fieldValue }); - // } - // } - - // // Set property value - // info.SetValue(data, fieldValue, null); - // } - // } - - // // Add item to list - // list.Add(data); - // } - - // return list; - //} - ////catch - ////{ - //// throw; - ////} - //finally - //{ - // // Clean up reader and _connection - // if (reader != null) - // { - // reader.Close(); - // reader.Dispose(); - // } + try + { + //var mapping = new TableMapping(T); + connection = GenerateConnection(); + command = connection.CreateCommand(sql, new object[0]); + list = command.ExecuteQuery(); - // // Dispose command - // command.Dispose(); + return list; + } + catch + { + throw; + } + finally + { + connection.Close(); + connection.Dispose(); + } - // // Close and clean up _connection - // if (connection.State == ConnectionState.Open) - // { - // connection.Close(); - // connection.Dispose(); - // } - //} + return list; } /// diff --git a/MPfm/MPfm.Library/MPfm.Library.WindowsStore.csproj b/MPfm/MPfm.Library/MPfm.Library.WindowsStore.csproj index 76b63d25..8987b534 100644 --- a/MPfm/MPfm.Library/MPfm.Library.WindowsStore.csproj +++ b/MPfm/MPfm.Library/MPfm.Library.WindowsStore.csproj @@ -99,6 +99,7 @@ true + diff --git a/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs b/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs index d79fa40b..478c7284 100644 --- a/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs +++ b/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs @@ -20,6 +20,10 @@ using System.Xml.Serialization; using MPfm.MVP.Config; +#if WINDOWSSTORE +using Windows.Storage; +#endif + namespace MPfm.MVP.Helpers { /// @@ -45,7 +49,10 @@ static ConfigurationHelper() #if IOS || ANDROID HomeDirectory = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); PeakFileDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "PeakFiles"); -#elif WINDOWSSTORE || WINDOWS_PHONE +#elif WINDOWSSTORE + HomeDirectory = ApplicationData.Current.LocalFolder.Path; + PeakFileDirectory = Path.Combine(ApplicationData.Current.LocalFolder.Path, "PeakFiles"); +#elif WINDOWS_PHONE HomeDirectory = "TODO"; PeakFileDirectory = "TODO"; #else diff --git a/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs b/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs index 2fb10c72..95dc8112 100644 --- a/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs @@ -1,306 +1,306 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System.Collections.Generic; -using System.Linq; -using MPfm.MVP.Messages; -using MPfm.MVP.Models; -using MPfm.MVP.Presenters.Interfaces; -using MPfm.MVP.Services.Interfaces; -using MPfm.MVP.Views; -using MPfm.Sound.AudioFiles; -using MPfm.Core; -using TinyMessenger; -using MPfm.Library.Services.Interfaces; -using MPfm.Library.Objects; - -namespace MPfm.MVP.Presenters -{ - /// - /// Library browser presenter. - /// - public class LibraryBrowserPresenter : BasePresenter, ILibraryBrowserPresenter - { - //ILibraryBrowserView view; - readonly ITinyMessengerHub messageHub; - readonly ILibraryService libraryService; - readonly IAudioFileCacheService audioFileCacheService; - - public AudioFileFormat Filter { get; private set; } - - #region Constructor and Dispose - - /// - /// Initializes a new instance of the class. - /// - public LibraryBrowserPresenter(ITinyMessengerHub messageHub, - ILibraryService libraryService, - IAudioFileCacheService audioFileCacheService) - { - // Set properties - this.messageHub = messageHub; - this.libraryService = libraryService; - this.audioFileCacheService = audioFileCacheService; - - // Set default filter - Filter = AudioFileFormat.All; - } - - #endregion - - #region ILibraryBrowserPresenter implementation - - public void BindView(ILibraryBrowserView view) - { - base.BindView(view); - - view.OnAudioFileFormatFilterChanged = (format) => { AudioFileFormatFilterChanged(format); }; - view.OnTreeNodeSelected = (entity) => { TreeNodeSelected(entity); }; - view.OnTreeNodeExpanded = (entity, obj) => { TreeNodeExpanded(entity, obj); }; - view.OnTreeNodeExpandable = (entity) => { return TreeNodeExpandable(entity); }; - view.OnTreeNodeDoubleClicked = (entity) => { TreeNodeDoubleClicked(entity); }; - -// // Load configuration -// if (MPfmConfig.Instance.ShowTooltips) - - // Refresh view (first level nodes) - view.RefreshLibraryBrowser(GetFirstLevelNodes()); - } - - /// - /// Call this method when the Audio File Format combo box selected value has changed. - /// - /// Audio file format - public void AudioFileFormatFilterChanged(AudioFileFormat format) - { - // Refresh view (first level nodes) - Tracing.Log("LibraryBrowserPresenter.AudioFileFormatFilterChanged -- Getting first level nodes and refreshing view..."); - this.Filter = format; - View.RefreshLibraryBrowser(GetFirstLevelNodes()); - } - - /// - /// Call this method when a tree node has been selected to update the Song Browser. - /// - /// Library Browser entity - public void TreeNodeSelected(LibraryBrowserEntity entity) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeSelected -- Broadcasting LibraryBrowserItemSelected message (" + entity.Title + ")..."); - messageHub.PublishAsync(new LibraryBrowserItemSelectedMessage(this){ - Item = entity - }); - } - - /// - /// Call this method when the tree node has expanded to fetch the additional tree nodes to add to the tree. - /// The view is updated when the data has been extracted from the database. - /// - /// Library Browser entity - /// User data (i.e. tree node object) - public void TreeNodeExpanded(LibraryBrowserEntity entity, object userData) - { - // Check node type - if (entity.EntityType == LibraryBrowserEntityType.Artists) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting Artist nodes and refreshing view (RefreshLibraryBrowserNode)..."); - View.RefreshLibraryBrowserNode( - entity, - GetArtistNodes(Filter), - userData - ); - } - else if (entity.EntityType == LibraryBrowserEntityType.Albums) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting Album nodes and refreshing view (RefreshLibraryBrowserNode)..."); - View.RefreshLibraryBrowserNode( - entity, - GetAlbumNodes(Filter), - userData - ); - } - else if (entity.EntityType == LibraryBrowserEntityType.Artist) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting ArtistAlbum nodes and refreshing view (RefreshLibraryBrowserNode)..."); - View.RefreshLibraryBrowserNode( - entity, - GetArtistAlbumNodes(Filter, entity.Query.ArtistName), - userData - ); - } - } - - /// - /// Call this method on Mac OS X when adding the subitems of the LibraryBrowserDataSource. - /// This method returns the list of nodes to add to the NSOutlineView. - /// - /// Library Browser entity - /// List of nodes to ad to the NSOutlineView - public IEnumerable TreeNodeExpandable(LibraryBrowserEntity entity) - { - // Check node type and get appropriate list - if (entity.EntityType == LibraryBrowserEntityType.Artists) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct artists..."); - return GetArtistNodes(Filter); - } - else if (entity.EntityType == LibraryBrowserEntityType.Albums) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct albums..."); - return GetAlbumNodes(Filter); - } - else if (entity.EntityType == LibraryBrowserEntityType.Artist) - { - Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct artist albums..."); - return GetArtistAlbumNodes(Filter, entity.Query.ArtistName); - } - - return null; - } - - /// - /// Call this method when the tree node has been double clicked. - /// This will start a new playlist in the Player presenter. - /// - /// Library Browser entity - public void TreeNodeDoubleClicked(LibraryBrowserEntity entity) - { - // Call player presenter - Tracing.Log("LibraryBrowserPresenter.TreeNodeDoubleClicked -- Publishing LibraryBrowserItemDoubleClickedMessageay with item " + entity.Title); - messageHub.PublishAsync(new LibraryBrowserItemDoubleClickedMessage(this){ - Query = entity.Query - }); - } - - #endregion - - #region Data Methods - - /// - /// Returns the first level nodes of the library browser. - /// - /// - /// First level nodes. - /// - private IEnumerable GetFirstLevelNodes() - { - List list = new List(); - - list.Add(new LibraryBrowserEntity(){ - Title = "All Songs", - EntityType = LibraryBrowserEntityType.AllSongs - }); - - list.Add(new LibraryBrowserEntity(){ - Title = "Artists", - EntityType = LibraryBrowserEntityType.Artists, - SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node - }); - - list.Add(new LibraryBrowserEntity(){ - Title = "Albums", - EntityType = LibraryBrowserEntityType.Albums, - SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node - }); - - return list; - } - - /// - /// Returns a list of distinct artist names. - /// - /// - /// List of artist names. - /// - private IEnumerable GetArtistNodes(AudioFileFormat format) - { - List list = new List(); - - List artists = libraryService.SelectDistinctArtistNames(format); - foreach(string artist in artists) - { - list.Add(new LibraryBrowserEntity(){ - Title = artist, - EntityType = LibraryBrowserEntityType.Artist, - Query = new LibraryQuery(){ - Format = format, - ArtistName = artist - }, - SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node - }); - } - - return list; - } - - /// - /// Returns a list of distinct album titles. - /// - /// Audio file format - /// List of album titles - private IEnumerable GetAlbumNodes(AudioFileFormat format) - { - return GetArtistAlbumNodes(format, string.Empty); - } - - /// - /// Returns a list of distinct album titles of a specific artist. - /// - /// Audio file format - /// Artist name - /// List of album titles - private IEnumerable GetArtistAlbumNodes(AudioFileFormat format, string artistName) - { - // Declare variables - List list = new List(); - List albums = new List(); - - // Get distinct album titles - Dictionary> albumTitles = libraryService.SelectDistinctAlbumTitles(format, artistName); - - // For each song - foreach (KeyValuePair> keyValue in albumTitles) - { - foreach (string albumTitle in keyValue.Value) - { - albums.Add(albumTitle); - } - } - - // Order the albums by title - albums = albums.OrderBy(x => x).ToList(); - - // Convert to entities - foreach(string album in albums) - { - list.Add(new LibraryBrowserEntity(){ - Title = album, - EntityType = LibraryBrowserEntityType.Album, - Query = new LibraryQuery(){ - Format = format, - ArtistName = artistName, - AlbumTitle = album - } - }); - } - - return list; - } - - #endregion - } -} - +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System.Collections.Generic; +using System.Linq; +using MPfm.MVP.Messages; +using MPfm.MVP.Models; +using MPfm.MVP.Presenters.Interfaces; +using MPfm.MVP.Services.Interfaces; +using MPfm.MVP.Views; +using MPfm.Sound.AudioFiles; +using MPfm.Core; +using TinyMessenger; +using MPfm.Library.Services.Interfaces; +using MPfm.Library.Objects; + +namespace MPfm.MVP.Presenters +{ + /// + /// Library browser presenter. + /// + public class LibraryBrowserPresenter : BasePresenter, ILibraryBrowserPresenter + { + //ILibraryBrowserView view; + readonly ITinyMessengerHub messageHub; + readonly ILibraryService libraryService; + readonly IAudioFileCacheService audioFileCacheService; + + public AudioFileFormat Filter { get; private set; } + + #region Constructor and Dispose + + /// + /// Initializes a new instance of the class. + /// + public LibraryBrowserPresenter(ITinyMessengerHub messageHub, + ILibraryService libraryService, + IAudioFileCacheService audioFileCacheService) + { + // Set properties + this.messageHub = messageHub; + this.libraryService = libraryService; + this.audioFileCacheService = audioFileCacheService; + + // Set default filter + Filter = AudioFileFormat.All; + } + + #endregion + + #region ILibraryBrowserPresenter implementation + + public void BindView(ILibraryBrowserView view) + { + base.BindView(view); + + view.OnAudioFileFormatFilterChanged = (format) => { AudioFileFormatFilterChanged(format); }; + view.OnTreeNodeSelected = (entity) => { TreeNodeSelected(entity); }; + view.OnTreeNodeExpanded = (entity, obj) => { TreeNodeExpanded(entity, obj); }; + view.OnTreeNodeExpandable = (entity) => { return TreeNodeExpandable(entity); }; + view.OnTreeNodeDoubleClicked = (entity) => { TreeNodeDoubleClicked(entity); }; + +// // Load configuration +// if (MPfmConfig.Instance.ShowTooltips) + + // Refresh view (first level nodes) + view.RefreshLibraryBrowser(GetFirstLevelNodes()); + } + + /// + /// Call this method when the Audio File Format combo box selected value has changed. + /// + /// Audio file format + public void AudioFileFormatFilterChanged(AudioFileFormat format) + { + // Refresh view (first level nodes) + Tracing.Log("LibraryBrowserPresenter.AudioFileFormatFilterChanged -- Getting first level nodes and refreshing view..."); + this.Filter = format; + View.RefreshLibraryBrowser(GetFirstLevelNodes()); + } + + /// + /// Call this method when a tree node has been selected to update the Song Browser. + /// + /// Library Browser entity + public void TreeNodeSelected(LibraryBrowserEntity entity) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeSelected -- Broadcasting LibraryBrowserItemSelected message (" + entity.Title + ")..."); + messageHub.PublishAsync(new LibraryBrowserItemSelectedMessage(this){ + Item = entity + }); + } + + /// + /// Call this method when the tree node has expanded to fetch the additional tree nodes to add to the tree. + /// The view is updated when the data has been extracted from the database. + /// + /// Library Browser entity + /// User data (i.e. tree node object) + public void TreeNodeExpanded(LibraryBrowserEntity entity, object userData) + { + // Check node type + if (entity.EntityType == LibraryBrowserEntityType.Artists) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting Artist nodes and refreshing view (RefreshLibraryBrowserNode)..."); + View.RefreshLibraryBrowserNode( + entity, + GetArtistNodes(Filter), + userData + ); + } + else if (entity.EntityType == LibraryBrowserEntityType.Albums) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting Album nodes and refreshing view (RefreshLibraryBrowserNode)..."); + View.RefreshLibraryBrowserNode( + entity, + GetAlbumNodes(Filter), + userData + ); + } + else if (entity.EntityType == LibraryBrowserEntityType.Artist) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpanded -- Getting ArtistAlbum nodes and refreshing view (RefreshLibraryBrowserNode)..."); + View.RefreshLibraryBrowserNode( + entity, + GetArtistAlbumNodes(Filter, entity.Query.ArtistName), + userData + ); + } + } + + /// + /// Call this method on Mac OS X when adding the subitems of the LibraryBrowserDataSource. + /// This method returns the list of nodes to add to the NSOutlineView. + /// + /// Library Browser entity + /// List of nodes to ad to the NSOutlineView + public IEnumerable TreeNodeExpandable(LibraryBrowserEntity entity) + { + // Check node type and get appropriate list + if (entity.EntityType == LibraryBrowserEntityType.Artists) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct artists..."); + return GetArtistNodes(Filter); + } + else if (entity.EntityType == LibraryBrowserEntityType.Albums) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct albums..."); + return GetAlbumNodes(Filter); + } + else if (entity.EntityType == LibraryBrowserEntityType.Artist) + { + Tracing.Log("LibraryBrowserPresenter.TreeNodeExpandable -- Getting list of distinct artist albums..."); + return GetArtistAlbumNodes(Filter, entity.Query.ArtistName); + } + + return null; + } + + /// + /// Call this method when the tree node has been double clicked. + /// This will start a new playlist in the Player presenter. + /// + /// Library Browser entity + public void TreeNodeDoubleClicked(LibraryBrowserEntity entity) + { + // Call player presenter + Tracing.Log("LibraryBrowserPresenter.TreeNodeDoubleClicked -- Publishing LibraryBrowserItemDoubleClickedMessageay with item " + entity.Title); + messageHub.PublishAsync(new LibraryBrowserItemDoubleClickedMessage(this){ + Query = entity.Query + }); + } + + #endregion + + #region Data Methods + + /// + /// Returns the first level nodes of the library browser. + /// + /// + /// First level nodes. + /// + private IEnumerable GetFirstLevelNodes() + { + List list = new List(); + + list.Add(new LibraryBrowserEntity(){ + Title = "All Songs", + EntityType = LibraryBrowserEntityType.AllSongs + }); + + list.Add(new LibraryBrowserEntity(){ + Title = "Artists", + EntityType = LibraryBrowserEntityType.Artists, + SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node + }); + + list.Add(new LibraryBrowserEntity(){ + Title = "Albums", + EntityType = LibraryBrowserEntityType.Albums, + SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node + }); + + return list; + } + + /// + /// Returns a list of distinct artist names. + /// + /// + /// List of artist names. + /// + private IEnumerable GetArtistNodes(AudioFileFormat format) + { + List list = new List(); + + List artists = libraryService.SelectDistinctArtistNames(format); + foreach(string artist in artists) + { + list.Add(new LibraryBrowserEntity(){ + Title = artist, + EntityType = LibraryBrowserEntityType.Artist, + Query = new LibraryQuery(){ + Format = format, + ArtistName = artist + }, + SubItems = new List(){ new LibraryBrowserEntity() { EntityType = LibraryBrowserEntityType.Dummy, Title = "dummy" }} // dummy node + }); + } + + return list; + } + + /// + /// Returns a list of distinct album titles. + /// + /// Audio file format + /// List of album titles + private IEnumerable GetAlbumNodes(AudioFileFormat format) + { + return GetArtistAlbumNodes(format, string.Empty); + } + + /// + /// Returns a list of distinct album titles of a specific artist. + /// + /// Audio file format + /// Artist name + /// List of album titles + private IEnumerable GetArtistAlbumNodes(AudioFileFormat format, string artistName) + { + // Declare variables + List list = new List(); + List albums = new List(); + + // Get distinct album titles + Dictionary> albumTitles = libraryService.SelectDistinctAlbumTitles(format, artistName); + + // For each song + foreach (KeyValuePair> keyValue in albumTitles) + { + foreach (string albumTitle in keyValue.Value) + { + albums.Add(albumTitle); + } + } + + // Order the albums by title + albums = albums.OrderBy(x => x).ToList(); + + // Convert to entities + foreach(string album in albums) + { + list.Add(new LibraryBrowserEntity(){ + Title = album, + EntityType = LibraryBrowserEntityType.Album, + Query = new LibraryQuery(){ + Format = format, + ArtistName = artistName, + AlbumTitle = album + } + }); + } + + return list; + } + + #endregion + } +} + diff --git a/MPfm/MPfm.MVP/Services/InitializationService.cs b/MPfm/MPfm.MVP/Services/InitializationService.cs index 360572f9..b7bdf481 100644 --- a/MPfm/MPfm.MVP/Services/InitializationService.cs +++ b/MPfm/MPfm.MVP/Services/InitializationService.cs @@ -20,6 +20,7 @@ using System.IO; using System.Reflection; using MPfm.Core; +using MPfm.Core.WinRT; using MPfm.Library; using MPfm.Library.Database; using MPfm.Library.Objects; @@ -28,6 +29,10 @@ using MPfm.MVP.Services.Interfaces; using MPfm.Library.Services.Interfaces; +#if WINDOWSSTORE +using Windows.Storage; +#endif + namespace MPfm.MVP.Services { /// @@ -64,31 +69,21 @@ public InitializationService(IAudioFileCacheService audioFileCacheService, ISync /// public void Initialize() { -#if !WINDOWSSTORE && !WINDOWS_PHONE - // Create missing directories - if(!Directory.Exists(ConfigurationHelper.HomeDirectory)) - Directory.CreateDirectory(ConfigurationHelper.HomeDirectory); - if (!Directory.Exists(ConfigurationHelper.PeakFileDirectory)) - Directory.CreateDirectory(ConfigurationHelper.PeakFileDirectory); -#endif - + // Maybe create different implementations per platform? + CreateDirectories(); CreateTraceListener(); - Tracing.Log("===================================================================="); -#if !IOS && !ANDROID && !WINDOWSSTORE && !WINDOWS_PHONE - Tracing.Log("Sessions - " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " ALPHA"); -#endif - - Tracing.Log(string.Format("Started on {0}", DateTime.Now)); + Tracing.Log("===================================================================="); + Tracing.Log(string.Format("Sessions - Started on {0}", DateTime.Now)); - // Load data needed to start the application LoadConfiguration(); - LoadLibrary(); - _audioFileCacheService.RefreshCache(); + LoadDatabase(); + StartSyncService(); + RefreshAudioFileCache(); } - private void CreateTraceListener() - { + private void CreateTraceListener() + { #if (!IOS && !ANDROID && !WINDOWSSTORE && !WINDOWS_PHONE) // Check if trace file exists if (!File.Exists(ConfigurationHelper.LogFilePath)) @@ -100,13 +95,33 @@ private void CreateTraceListener() #endif } + private void CreateDirectories() + { +#if !WINDOWSSTORE && !WINDOWS_PHONE + // Create missing directories + if(!Directory.Exists(ConfigurationHelper.HomeDirectory)) + Directory.CreateDirectory(ConfigurationHelper.HomeDirectory); + if (!Directory.Exists(ConfigurationHelper.PeakFileDirectory)) + Directory.CreateDirectory(ConfigurationHelper.PeakFileDirectory); +#else + CreateDirectoriesWinRT(); +#endif + } + + private async void CreateDirectoriesWinRT() + { + var localFolder = ApplicationData.Current.LocalFolder; + var localSettings = ApplicationData.Current.LocalSettings; + var storageFolder = await localFolder.CreateFolderAsync("PeakFiles", CreationCollisionOption.OpenIfExists); + } + private void LoadConfiguration() { // Check for configuration file Tracing.Log("InitializationService.CreateConfiguration -- Checking for configuration file..."); #if WINDOWSSTORE || WINDOWS_PHONE - // TODO: Implement this (async?) + // #else if (File.Exists(ConfigurationHelper.ConfigurationFilePath)) MPfmConfig.Instance.Load(); @@ -116,14 +131,39 @@ private void LoadConfiguration() //EQPresetHelper.Save("/Users/animal/Documents/test.txt", new EQPreset()); } - private void LoadLibrary() + private void StartSyncService() + { + try + { + _syncListenerService.Start(); + } + catch (Exception ex) + { + throw new Exception("Error initializing MPfm: The sync listener could not be started!", ex); + } + } + + private void RefreshAudioFileCache() + { + _audioFileCacheService.RefreshCache(); + } + + private void LoadDatabase() { try { -#if WINDOWSSTORE || WINDOWS_PHONE - // TODO: Implement this +#if WINDOWSSTORE + Tracing.Log(string.Format("InitializationService.CreateLibrary -- Checking if the database file exists ({0})...", ConfigurationHelper.DatabaseFilePath)); + var storageFolder = ApplicationData.Current.LocalFolder; + var task = storageFolder.FileExistsAsync(Path.GetFileName(ConfigurationHelper.DatabaseFilePath)); + bool databaseExists = task.Result; + if (!databaseExists) + { + // Create database file + Tracing.Log("InitializationService.CreateLibrary -- Creating new database file..."); + CreateDatabaseFile(ConfigurationHelper.DatabaseFilePath); + } #else - // Check if the database file exists Tracing.Log(string.Format("InitializationService.CreateLibrary -- Checking if the database file exists ({0})...", ConfigurationHelper.DatabaseFilePath)); if (!File.Exists(ConfigurationHelper.DatabaseFilePath)) { @@ -166,16 +206,7 @@ private void LoadLibrary() catch (Exception ex) { throw new Exception("Error initializing MPfm: The MPfm database could not be updated!", ex); - } - - try - { - _syncListenerService.Start(); - } - catch (Exception ex) - { - throw new Exception("Error initializing MPfm: The sync listener could not be started!", ex); - } + } } /// diff --git a/MPfm/MPfm.Windows/Classes/Forms/frmMain.cs b/MPfm/MPfm.Windows/Classes/Forms/frmMain.cs index e3ae5d08..bd367dd9 100644 --- a/MPfm/MPfm.Windows/Classes/Forms/frmMain.cs +++ b/MPfm/MPfm.Windows/Classes/Forms/frmMain.cs @@ -2012,7 +2012,7 @@ public void RefreshLibraryBrowser(IEnumerable entities) { var node = new TreeNode(entity.Title); node.Tag = entity; - switch (entity.Type) + switch (entity.EntityType) { case LibraryBrowserEntityType.AllSongs: node.ImageIndex = 12; @@ -2028,7 +2028,7 @@ public void RefreshLibraryBrowser(IEnumerable entities) break; } - if (entity.Type != LibraryBrowserEntityType.AllSongs) + if (entity.EntityType != LibraryBrowserEntityType.AllSongs) node.Nodes.Add("dummy", "dummy"); treeLibraryBrowser.Nodes.Add(node); @@ -2057,7 +2057,7 @@ public void RefreshLibraryBrowserNode(LibraryBrowserEntity entity, IEnumerable sealed partial class App : Application { + private WindowsStoreNavigationManager _navigationManager; + /// /// Initializes the singleton Application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). @@ -71,53 +73,56 @@ public App() protected override async void OnLaunched(LaunchActivatedEventArgs args) { Debug.WriteLine("App - OnLaunched"); - Frame rootFrame = Window.Current.Content as Frame; + //Frame rootFrame = Window.Current.Content as Frame; - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - - if (rootFrame == null) - { - BootstrapApp(); + //// Do not repeat app initialization when the Window already has content, + //// just ensure that the window is active + //if (rootFrame == null) + //{ + // BootstrapApp(); - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - //Associate the frame with a SuspensionManager key - SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); + // // Create a Frame to act as the navigation context and navigate to the first page + // rootFrame = new Frame(); + // // Associate the frame with a SuspensionManager key + // SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); - if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - // Restore the saved session state only when appropriate - try - { - Debug.WriteLine("App - SuspensionManager.RestoreAsync"); - await SuspensionManager.RestoreAsync(); - } - catch (SuspensionManagerException) - { - //Something went wrong restoring state. - //Assume there is no state and continue - } - } + // if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) + // { + // // Restore the saved session state only when appropriate + // try + // { + // Debug.WriteLine("App - SuspensionManager.RestoreAsync"); + // await SuspensionManager.RestoreAsync(); + // } + // catch (SuspensionManagerException) + // { + // //Something went wrong restoring state. + // //Assume there is no state and continue + // } + // } - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - Debug.WriteLine("RootFrame.Content == null; trying to navigate to MainPage"); - //if (!rootFrame.Navigate(typeof(ArtistBrowserPage), "AllGroups")) - //if(!rootFrame.Navigate(typeof(SyncPage), args.Arguments)) - if(!rootFrame.Navigate(typeof(MainPage), "AllGroups")) - { - throw new Exception("Failed to create initial page"); - } - } + // // Place the frame in the current Window + // Window.Current.Content = rootFrame; + //} + //if (rootFrame.Content == null) + //{ + // // When the navigation stack isn't restored navigate to the first page, + // // configuring the new page by passing required information as a navigation + // // parameter + // Debug.WriteLine("RootFrame.Content == null; trying to navigate to MainPage"); + // if(!rootFrame.Navigate(typeof(MainPage), "AllGroups")) + // { + // throw new Exception("Failed to create initial page"); + // } + //} // Ensure the current window is active - Window.Current.Activate(); + //Window.Current.Activate(); + + BootstrapApp(); + _navigationManager = (WindowsStoreNavigationManager)Bootstrapper.GetContainer().Resolve(); + _navigationManager.SplashImageLocation = args.SplashScreen.ImageLocation; + //_navigationManager.BindOptionsMenuView(this); + _navigationManager.Start(); } /// diff --git a/MPfm/MPfm.WindowsStore/Classes/Navigation/WindowsStoreNavigationManager.cs b/MPfm/MPfm.WindowsStore/Classes/Navigation/WindowsStoreNavigationManager.cs index c7a38090..9cdde8d5 100644 --- a/MPfm/MPfm.WindowsStore/Classes/Navigation/WindowsStoreNavigationManager.cs +++ b/MPfm/MPfm.WindowsStore/Classes/Navigation/WindowsStoreNavigationManager.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; +using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using MPfm.Library.Objects; @@ -30,16 +31,24 @@ namespace MPfm.WindowsStore.Classes.Navigation { public class WindowsStoreNavigationManager : MobileNavigationManager { + public Rect SplashImageLocation { get; set; } + private Action _onSyncViewReady; private Action _onSyncMenuViewReady; private Action _onSyncDownloadViewReady; public override void ShowSplash(ISplashView view) { + var splashPage = (SplashPage) view; + splashPage.SetImageLocation(SplashImageLocation); + Window.Current.Content = splashPage; + Window.Current.Activate(); } public override void HideSplash() { + var mainPage = new MainPage(); + Window.Current.Content = mainPage; } public override void AddTab(MobileNavigationTabType type, string title, IBaseView view) @@ -59,11 +68,11 @@ public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrow { } - public override void PushDialogView(string viewTitle, IBaseView sourceView, IBaseView view) + public override void PushDialogView(MobileDialogPresentationType presentationType, string viewTitle, IBaseView sourceView, IBaseView view) { } - public override void PushDialogSubview(string parentViewTitle, IBaseView view) + public override void PushDialogSubview(MobileDialogPresentationType presentationType, string parentViewTitle, IBaseView view) { } diff --git a/MPfm/MPfm.WindowsStore/Classes/Pages/MainPage.xaml.cs b/MPfm/MPfm.WindowsStore/Classes/Pages/MainPage.xaml.cs index ab0938e2..0c25f541 100644 --- a/MPfm/MPfm.WindowsStore/Classes/Pages/MainPage.xaml.cs +++ b/MPfm/MPfm.WindowsStore/Classes/Pages/MainPage.xaml.cs @@ -33,10 +33,10 @@ public MainPage() { this.InitializeComponent(); - Tracing.Log("MainPage - Ctor - Starting navigation manager..."); + //Tracing.Log("MainPage - Ctor - Starting navigation manager..."); _navigationManager = (WindowsStoreNavigationManager)Bootstrapper.GetContainer().Resolve(); _navigationManager.BindOptionsMenuView(this); - _navigationManager.Start(); + //_navigationManager.Start(); } /// diff --git a/MPfm/MPfm.WindowsStore/Classes/Pages/SplashPage.xaml b/MPfm/MPfm.WindowsStore/Classes/Pages/SplashPage.xaml index 3cba8d8c..9d448802 100644 --- a/MPfm/MPfm.WindowsStore/Classes/Pages/SplashPage.xaml +++ b/MPfm/MPfm.WindowsStore/Classes/Pages/SplashPage.xaml @@ -1,7 +1,6 @@  - - - - - - - - Sessions - - - - - - - - - - - - - - - - public sealed partial class SplashPage : BasePage, ISplashView { - public SplashPage() - { - this.InitializeComponent(); - } + private Action _onViewReady; - /// - /// Populates the page with content passed during navigation. Any saved state is also - /// provided when recreating a page from a prior session. - /// - /// The parameter value passed to - /// when this page was initially requested. - /// - /// A dictionary of state preserved by this page during an earlier - /// session. This will be null the first time a page is visited. - protected override void LoadState(Object navigationParameter, Dictionary pageState) + public SplashPage(Action onViewReady) { - // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"] - Debug.WriteLine("SplashPage - LoadState"); - - // View is ready + _onViewReady = onViewReady; + this.InitializeComponent(); } - private async void Button_Click(object sender, RoutedEventArgs e) + public void SetImageLocation(Rect imageLocation) { - greetingOutput.Text = "Hello,, " + nameInput.Text + "!"; + // Position the extended splash screen image in the same location as the splash screen image. + this.extendedSplashImage.SetValue(Canvas.LeftProperty, imageLocation.X); + this.extendedSplashImage.SetValue(Canvas.TopProperty, imageLocation.Y); + this.extendedSplashImage.Height = imageLocation.Height; + this.extendedSplashImage.Width = imageLocation.Width; - FileOpenPicker openPicker = new FileOpenPicker(); - openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; - openPicker.ViewMode = PickerViewMode.List; + this.lblStatus.SetValue(Canvas.LeftProperty, imageLocation.X + (imageLocation.Width / 2) - 100); + this.lblStatus.SetValue(Canvas.TopProperty, imageLocation.Y + imageLocation.Height + 72); - openPicker.FileTypeFilter.Clear(); - openPicker.FileTypeFilter.Add(".mp3"); - openPicker.FileTypeFilter.Add(".flac"); + // Position the extended splash screen's progress ring. + this.ProgressRing.SetValue(Canvas.TopProperty, imageLocation.Y + imageLocation.Height + 12); + this.ProgressRing.SetValue(Canvas.LeftProperty, imageLocation.X + (imageLocation.Width / 2) - 15); - var file = await openPicker.PickSingleFileAsync(); - - if (file == null) - return; - - try - { - AudioFile audioFile = new AudioFile(file.Path); - string a = audioFile.FilePath; - } - catch (Exception ex) - { - throw; - } + _onViewReady(this); } #region ISplashView implementation public void RefreshStatus(string message) { + Dispatcher.RunAsync(CoreDispatcherPriority.High, () => + { + lblStatus.Text = message; + }); } public void InitDone(bool isAppFirstStart) diff --git a/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj b/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj index 5021bf57..10653433 100644 --- a/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj +++ b/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj @@ -162,6 +162,7 @@ + @@ -221,6 +222,9 @@ False ..\MPfm.Core\Lib\PCL\TinyIoC.dll + + ..\packages\WinRTXamlToolkit.1.5.3.0\lib\netcore45\WinRTXamlToolkit.dll + diff --git a/MPfm/MPfm.WindowsStore/packages.config b/MPfm/MPfm.WindowsStore/packages.config new file mode 100644 index 00000000..bf9118f4 --- /dev/null +++ b/MPfm/MPfm.WindowsStore/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ProjectSync/ProjectFileReader.cs b/ProjectSync/ProjectFileReader.cs index a80912a5..ece48121 100644 --- a/ProjectSync/ProjectFileReader.cs +++ b/ProjectSync/ProjectFileReader.cs @@ -1,58 +1,58 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace ProjectSync -{ - public static class ProjectFileReader - { - public static List ExtractProjectCompileFilePaths(string projectFilePath) - { - // Read XML content - List filePaths = new List(); - string fileContents = File.ReadAllText(projectFilePath); - XDocument xdoc = XDocument.Parse(fileContents); - XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003"; - - XElement elProject = xdoc.Element(ns + "Project"); - List elItemGroups = xdoc.Descendants(ns + "ItemGroup").ToList(); - List elGlobalCompiles = xdoc.Descendants(ns + "Compile").ToList(); - if(elProject == null) - throw new Exception("Could not find the Project xml node."); - - foreach (XElement elItemGroup in elItemGroups) - { - List elCompiles = elItemGroup.Descendants(ns + "Compile").ToList(); - foreach (XElement elCompile in elCompiles) - { - XAttribute include = elCompile.Attribute("Include"); - if (include != null) - { - filePaths.Add(include.Value); - } - } - } - - return filePaths; - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace ProjectSync +{ + public static class ProjectFileReader + { + public static List ExtractProjectCompileFilePaths(string projectFilePath) + { + // Read XML content + List filePaths = new List(); + string fileContents = File.ReadAllText(projectFilePath); + XDocument xdoc = XDocument.Parse(fileContents); + XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003"; + + XElement elProject = xdoc.Element(ns + "Project"); + List elItemGroups = xdoc.Descendants(ns + "ItemGroup").ToList(); + List elGlobalCompiles = xdoc.Descendants(ns + "Compile").ToList(); + if(elProject == null) + throw new Exception("Could not find the Project xml node."); + + foreach (XElement elItemGroup in elItemGroups) + { + List elCompiles = elItemGroup.Descendants(ns + "Compile").ToList(); + foreach (XElement elCompile in elCompiles) + { + XAttribute include = elCompile.Attribute("Include"); + if (include != null) + { + filePaths.Add(include.Value); + } + } + } + + return filePaths; + } + } +} diff --git a/ProjectSync/ProjectFileWriter.cs b/ProjectSync/ProjectFileWriter.cs index 1acaa7bb..2b782f0f 100644 --- a/ProjectSync/ProjectFileWriter.cs +++ b/ProjectSync/ProjectFileWriter.cs @@ -1,69 +1,69 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace ProjectSync -{ - public static class ProjectFileWriter - { - public static void UpdateProjectFileCompileList(string filePath, List compileList) - { - // Read XML content - string fileContents = File.ReadAllText(filePath); - XDocument xdoc = XDocument.Parse(fileContents); - XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003"; - XElement elProject = xdoc.Element(ns + "Project"); - List elGlobalCompiles = xdoc.Descendants(ns + "Compile").ToList(); - if (elProject == null) - throw new Exception("Could not find the Project xml node."); - - // Remove Compile nodes - foreach (XElement elCompile in elGlobalCompiles) - elCompile.Remove(); - - // Add a ItemGroup with all compiles - XElement elGlobalItemGroup = new XElement(ns + "ItemGroup"); - foreach (string compile in compileList) - { - XElement elCompile = new XElement(ns + "Compile"); - XAttribute attrInclude = new XAttribute("Include", compile); - elCompile.Add(attrInclude); - elGlobalItemGroup.Add(elCompile); - } - elProject.Add(elGlobalItemGroup); - - // Remove empty ItemGroup nodes - List elItemGroups = xdoc.Descendants(ns + "ItemGroup").ToList(); - foreach (XElement elItemGroup in elItemGroups) - { - if (!elItemGroup.HasElements) - { - elItemGroup.Remove(); - } - } - - // Save project file - xdoc.Save(filePath); - } - - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace ProjectSync +{ + public static class ProjectFileWriter + { + public static void UpdateProjectFileCompileList(string filePath, List compileList) + { + // Read XML content + string fileContents = File.ReadAllText(filePath); + XDocument xdoc = XDocument.Parse(fileContents); + XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003"; + XElement elProject = xdoc.Element(ns + "Project"); + List elGlobalCompiles = xdoc.Descendants(ns + "Compile").ToList(); + if (elProject == null) + throw new Exception("Could not find the Project xml node."); + + // Remove Compile nodes + foreach (XElement elCompile in elGlobalCompiles) + elCompile.Remove(); + + // Add a ItemGroup with all compiles + XElement elGlobalItemGroup = new XElement(ns + "ItemGroup"); + foreach (string compile in compileList) + { + XElement elCompile = new XElement(ns + "Compile"); + XAttribute attrInclude = new XAttribute("Include", compile); + elCompile.Add(attrInclude); + elGlobalItemGroup.Add(elCompile); + } + elProject.Add(elGlobalItemGroup); + + // Remove empty ItemGroup nodes + List elItemGroups = xdoc.Descendants(ns + "ItemGroup").ToList(); + foreach (XElement elItemGroup in elItemGroups) + { + if (!elItemGroup.HasElements) + { + elItemGroup.Remove(); + } + } + + // Save project file + xdoc.Save(filePath); + } + + } +} diff --git a/ProjectSync/ProjectSync.csproj b/ProjectSync/ProjectSync.csproj index 27b2dd30..4b307744 100644 --- a/ProjectSync/ProjectSync.csproj +++ b/ProjectSync/ProjectSync.csproj @@ -1,50 +1,50 @@ - - - - Debug - x86 - 10.0.0 - 2.0 - {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE} - Exe - ProjectSync - ProjectSync - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - x86 - true - /Users/ycastonguay/Projects/MPfm/MPFM.sln - - - none - true - bin\Release - prompt - 4 - x86 - true - - - - - - - - - - - - - - - - - + + + + Debug + x86 + 10.0.0 + 2.0 + {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE} + Exe + ProjectSync + ProjectSync + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + x86 + true + /Users/ycastonguay/Projects/MPfm/MPFM.sln + + + none + true + bin\Release + prompt + 4 + x86 + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjectSync/ProjectSync.sln b/ProjectSync/ProjectSync.sln index 72ad16ef..8be22b92 100644 --- a/ProjectSync/ProjectSync.sln +++ b/ProjectSync/ProjectSync.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectSync", "ProjectSync.csproj", "{7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Debug|x86.ActiveCfg = Debug|x86 - {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Debug|x86.Build.0 = Debug|x86 - {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Release|x86.ActiveCfg = Release|x86 - {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = ProjectSync.csproj - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectSync", "ProjectSync.csproj", "{7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Debug|x86.ActiveCfg = Debug|x86 + {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Debug|x86.Build.0 = Debug|x86 + {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Release|x86.ActiveCfg = Release|x86 + {7C78A6DF-7564-4490-8BBB-DDC8A45BD9EE}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = ProjectSync.csproj + EndGlobalSection +EndGlobal diff --git a/ProjectSync/README.md b/ProjectSync/README.md index 3d2b7a5a..0c395366 100644 --- a/ProjectSync/README.md +++ b/ProjectSync/README.md @@ -1,6 +1,6 @@ -Project File Synchronization Tool -(C) 2013 Yanick Castonguay - -This tool synchronizes Visual Studio/MonoDevelop project files. It works by watching changes in all project files listed in a solution. It then synchronizes file additions/deletion between project files located in the same directory. You can use this tool to synchronize class library project files between .NET/Mono/MonoTouch/Mono for Android projects. - +Project File Synchronization Tool +(C) 2013 Yanick Castonguay + +This tool synchronizes Visual Studio/MonoDevelop project files. It works by watching changes in all project files listed in a solution. It then synchronizes file additions/deletion between project files located in the same directory. You can use this tool to synchronize class library project files between .NET/Mono/MonoTouch/Mono for Android projects. + It is compatible with Windows, Linux and OS X. \ No newline at end of file diff --git a/ProjectSync/SolutionFileReader.cs b/ProjectSync/SolutionFileReader.cs index fe1fc58e..e51fff77 100644 --- a/ProjectSync/SolutionFileReader.cs +++ b/ProjectSync/SolutionFileReader.cs @@ -1,58 +1,58 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System; -using System.Collections.Generic; -using System.IO; - -namespace ProjectSync -{ - public static class SolutionFileReader - { - public static List ExtractProjectFilePaths(string solutionFilePath) - { - // Read solution file as an array of strings - string[] solutionFileLines = File.ReadAllLines(solutionFilePath); - string baseDirectory = Path.GetDirectoryName(solutionFilePath); - - // Read lines - List listProjectFilePaths = new List(); - foreach (string line in solutionFileLines) - { - // We only are intered in CSPROJ file paths, so these lines always start with "Project" - if(line.ToUpper().StartsWith("PROJECT")) - { - // Try to find the CSPROJ file path - string[] parts = line.Split(new string[] { "\"" }, StringSplitOptions.RemoveEmptyEntries); - foreach (string part in parts) - { - if (part.ToUpper().Contains(".CSPROJ")) - { - // Make sure the directory separator is right on every platform (the solution file contains '\') - string combinedPath = Path.GetFullPath(Path.Combine(baseDirectory, part)); - combinedPath = combinedPath.Replace('\\', Path.DirectorySeparatorChar); - bool combinedPathExists = File.Exists(combinedPath); - listProjectFilePaths.Add(combinedPath); - } - } - } - } - - return listProjectFilePaths; - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System; +using System.Collections.Generic; +using System.IO; + +namespace ProjectSync +{ + public static class SolutionFileReader + { + public static List ExtractProjectFilePaths(string solutionFilePath) + { + // Read solution file as an array of strings + string[] solutionFileLines = File.ReadAllLines(solutionFilePath); + string baseDirectory = Path.GetDirectoryName(solutionFilePath); + + // Read lines + List listProjectFilePaths = new List(); + foreach (string line in solutionFileLines) + { + // We only are intered in CSPROJ file paths, so these lines always start with "Project" + if(line.ToUpper().StartsWith("PROJECT")) + { + // Try to find the CSPROJ file path + string[] parts = line.Split(new string[] { "\"" }, StringSplitOptions.RemoveEmptyEntries); + foreach (string part in parts) + { + if (part.ToUpper().Contains(".CSPROJ")) + { + // Make sure the directory separator is right on every platform (the solution file contains '\') + string combinedPath = Path.GetFullPath(Path.Combine(baseDirectory, part)); + combinedPath = combinedPath.Replace('\\', Path.DirectorySeparatorChar); + bool combinedPathExists = File.Exists(combinedPath); + listProjectFilePaths.Add(combinedPath); + } + } + } + } + + return listProjectFilePaths; + } + } +} From 7c8c636593713721d9a96d2e03696c8b929cf860 Mon Sep 17 00:00:00 2001 From: Yanick Castonguay Date: Mon, 14 Oct 2013 22:45:39 -0400 Subject: [PATCH 2/2] All platforms: Refactored AppConfig with new providers per platform. --- .../MobileLibraryBrowserListAdapter.cs | 2 +- MPfm/MPfm.Android/Classes/Application.cs | 3 + .../Fragments/PlayerMetadataFragment.cs | 2 +- .../Navigation/AndroidNavigationManager.cs | 4 +- .../Providers/AndroidAppConfigProvider.cs} | 28 +- MPfm/MPfm.Android/MPfm.Android.csproj | 1 + .../Preferences/ConfigurationHelper.cs | 93 ---- .../Services/WinRT/SyncClientService.cs | 4 + .../Services/WinRT/SyncDiscoveryService.cs | 2 + .../Services/WinRT/SyncListenerService.cs | 2 + .../Services/WinRT/UpdateLibraryService.cs | 2 + MPfm/MPfm.MVP/Config/AppConfig.cs | 67 +++ .../{MPfmAudioConfig.cs => AudioAppConfig.cs} | 86 +-- ...ControlsConfig.cs => ControlsAppConfig.cs} | 496 +++++++++--------- .../Config/Providers/IAppConfigProvider.cs} | 10 +- .../Config/Providers/XmlAppConfigProvider.cs | 58 ++ .../{MPfmConfig.cs => RootAppConfig.cs} | 142 ++--- ...bleViewConfig.cs => TableViewAppConfig.cs} | 70 +-- ...nConfig.cs => TableViewColumnAppConfig.cs} | 76 +-- ...MPfmWindowConfig.cs => WindowAppConfig.cs} | 80 +-- ...fmWindowsConfig.cs => WindowsAppConfig.cs} | 78 +-- MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs | 20 +- MPfm/MPfm.MVP/MPfm.MVP.Android.csproj | 17 +- MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj | 17 +- MPfm/MPfm.MVP/MPfm.MVP.WindowsStore.csproj | 17 +- MPfm/MPfm.MVP/MPfm.MVP.csproj | 17 +- MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj | 17 +- .../Presenters/AudioPreferencesPresenter.cs | 64 +-- .../Presenters/EqualizerPresetsPresenter.cs | 2 +- .../Interfaces/IAudioPreferencesPresenter.cs | 58 +- .../Presenters/LibraryBrowserPresenter.cs | 4 +- MPfm/MPfm.MVP/Presenters/PlayerPresenter.cs | 2 +- MPfm/MPfm.MVP/Presenters/PlaylistPresenter.cs | 2 +- .../Presenters/PreferencesPresenter.cs | 2 +- .../Presenters/SyncDownloadPresenter.cs | 2 +- .../Presenters/UpdateLibraryPresenter.cs | 2 +- .../Services/InitializationService.cs | 31 +- MPfm/MPfm.MVP/Views/IAudioPreferencesView.cs | 54 +- MPfm/MPfm.Windows/Classes/Program.cs | 2 + MPfm/MPfm.WindowsPhone/App.xaml.cs | 3 + .../WindowsPhoneNavigationManager.cs | 4 +- .../WindowsPhoneAppConfigProvider.cs | 34 ++ .../MPfm.WindowsPhone.csproj | 1 + MPfm/MPfm.WindowsStore/App.xaml.cs | 9 +- .../WindowsStoreAppConfigProvider.cs | 34 ++ .../MPfm.WindowsStore.csproj | 1 + 46 files changed, 905 insertions(+), 817 deletions(-) rename MPfm/{MPfm.Core/Preferences/XmlPreferencesManager.cs => MPfm.Android/Classes/Providers/AndroidAppConfigProvider.cs} (60%) delete mode 100644 MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs create mode 100644 MPfm/MPfm.MVP/Config/AppConfig.cs rename MPfm/MPfm.MVP/Config/{MPfmAudioConfig.cs => AudioAppConfig.cs} (92%) rename MPfm/MPfm.MVP/Config/{MPfmControlsConfig.cs => ControlsAppConfig.cs} (66%) rename MPfm/{MPfm.Core/Preferences/PreferenceKeys.cs => MPfm.MVP/Config/Providers/IAppConfigProvider.cs} (75%) create mode 100644 MPfm/MPfm.MVP/Config/Providers/XmlAppConfigProvider.cs rename MPfm/MPfm.MVP/Config/{MPfmConfig.cs => RootAppConfig.cs} (58%) rename MPfm/MPfm.MVP/Config/{MPfmTableViewConfig.cs => TableViewAppConfig.cs} (75%) rename MPfm/MPfm.MVP/Config/{MPfmTableViewColumnConfig.cs => TableViewColumnAppConfig.cs} (90%) rename MPfm/MPfm.MVP/Config/{MPfmWindowConfig.cs => WindowAppConfig.cs} (91%) rename MPfm/MPfm.MVP/Config/{MPfmWindowsConfig.cs => WindowsAppConfig.cs} (60%) create mode 100644 MPfm/MPfm.WindowsPhone/Classes/Providers/WindowsPhoneAppConfigProvider.cs create mode 100644 MPfm/MPfm.WindowsStore/Classes/Providers/WindowsStoreAppConfigProvider.cs diff --git a/MPfm/MPfm.Android/Classes/Adapters/MobileLibraryBrowserListAdapter.cs b/MPfm/MPfm.Android/Classes/Adapters/MobileLibraryBrowserListAdapter.cs index e0efcdd4..f7b38a7f 100644 --- a/MPfm/MPfm.Android/Classes/Adapters/MobileLibraryBrowserListAdapter.cs +++ b/MPfm/MPfm.Android/Classes/Adapters/MobileLibraryBrowserListAdapter.cs @@ -122,7 +122,7 @@ public override View GetView(int position, View convertView, ViewGroup parent) lblSubtitle.Text = item.AudioFile.Length; } - switch (item.Type) + switch (item.EntityType) { case LibraryBrowserEntityType.Song: layoutAlbums.Visibility = ViewStates.Gone; diff --git a/MPfm/MPfm.Android/Classes/Application.cs b/MPfm/MPfm.Android/Classes/Application.cs index e0556df0..d22b97aa 100644 --- a/MPfm/MPfm.Android/Classes/Application.cs +++ b/MPfm/MPfm.Android/Classes/Application.cs @@ -22,9 +22,11 @@ using Android.Runtime; using MPfm.Android.Classes.Fragments; using MPfm.Android.Classes.Navigation; +using MPfm.Android.Classes.Providers; using MPfm.Android.Classes.Receivers; using MPfm.Library; using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; using MPfm.MVP.Navigation; using MPfm.MVP.Views; using MPfm.Android.Classes.Services; @@ -149,6 +151,7 @@ private void BootstrapApp() // Complete IoC configuration TinyIoC.TinyIoCContainer container = Bootstrapper.GetContainer(); container.Register().AsSingleton(); + container.Register().AsSingleton(); container.Register().AsSingleton(); container.Register().AsMultiInstance(); container.Register().AsMultiInstance(); diff --git a/MPfm/MPfm.Android/Classes/Fragments/PlayerMetadataFragment.cs b/MPfm/MPfm.Android/Classes/Fragments/PlayerMetadataFragment.cs index 6b9dd519..fffa9b72 100644 --- a/MPfm/MPfm.Android/Classes/Fragments/PlayerMetadataFragment.cs +++ b/MPfm/MPfm.Android/Classes/Fragments/PlayerMetadataFragment.cs @@ -58,7 +58,7 @@ public override View OnCreateView(LayoutInflater inflater, ViewGroup container, public Action OnToggleShuffle { get; set; } public Action OnToggleRepeat { get; set; } - public void RefreshAudioFile(AudioFile audioFile) + public void RefreshMetadata(AudioFile audioFile, int playlistIndex, int playlistCount) { Activity.RunOnUiThread(() => { if (audioFile != null) diff --git a/MPfm/MPfm.Android/Classes/Navigation/AndroidNavigationManager.cs b/MPfm/MPfm.Android/Classes/Navigation/AndroidNavigationManager.cs index 8328fd75..8edd9272 100644 --- a/MPfm/MPfm.Android/Classes/Navigation/AndroidNavigationManager.cs +++ b/MPfm/MPfm.Android/Classes/Navigation/AndroidNavigationManager.cs @@ -177,12 +177,12 @@ public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrow // Not used on Android } - public override void PushDialogView(string viewTitle, IBaseView sourceView, IBaseView view) + public override void PushDialogView(MobileDialogPresentationType presentationType, string viewTitle, IBaseView sourceView, IBaseView view) { MainActivity.PushDialogView(viewTitle, sourceView, view); } - public override void PushDialogSubview(string parentViewTitle, IBaseView view) + public override void PushDialogSubview(MobileDialogPresentationType presentationType, string parentViewTitle, IBaseView view) { MainActivity.PushDialogSubview(parentViewTitle, view); } diff --git a/MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs b/MPfm/MPfm.Android/Classes/Providers/AndroidAppConfigProvider.cs similarity index 60% rename from MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs rename to MPfm/MPfm.Android/Classes/Providers/AndroidAppConfigProvider.cs index 94c8758e..47b5072f 100644 --- a/MPfm/MPfm.Core/Preferences/XmlPreferencesManager.cs +++ b/MPfm/MPfm.Android/Classes/Providers/AndroidAppConfigProvider.cs @@ -15,31 +15,19 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . -namespace MPfm.Core.Preferences +using MPfm.MVP.Config; +using MPfm.MVP.Config.Providers; + +namespace MPfm.Android.Classes.Providers { - public class XmlPreferencesManager : IPreferencesManager + public class AndroidAppConfigProvider : IAppConfigProvider { - public XmlPreferencesManager() - { - //var stuff = new Xml - } - - public bool GetBool(string key) - { - return false; - } - - public int GetInt(string key) - { - return 0; - } - - public string GetString(string key) + public RootAppConfig Load(string filePath) { - return string.Empty; + return new RootAppConfig(); } - public void SetValue(string key, object value) + public void Save(string filePath, RootAppConfig config) { } } diff --git a/MPfm/MPfm.Android/MPfm.Android.csproj b/MPfm/MPfm.Android/MPfm.Android.csproj index 658c4482..1c1d1eed 100644 --- a/MPfm/MPfm.Android/MPfm.Android.csproj +++ b/MPfm/MPfm.Android/MPfm.Android.csproj @@ -129,6 +129,7 @@ + diff --git a/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs b/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs deleted file mode 100644 index 0736f238..00000000 --- a/MPfm/MPfm.Core/Preferences/ConfigurationHelper.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System.IO; -using MPfm.MVP.Config; - -namespace MPfm.Core.Preferences -{ - /// - /// Helper static class for configuration paths. - /// - public static class ConfigurationHelper - { - public static string HomeDirectory; - public static string PeakFileDirectory; - public static string ConfigurationFilePath; - public static string DatabaseFilePath; - public static string LogFilePath; - - static ConfigurationHelper() - { - // Get assembly directory - //string assemblyDirectory = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - //// Get application data folder path - //// Vista/Windows7: C:\Users\%username%\AppData\Roaming\ - //// XP: C:\Documents and Settings\%username%\Application Data\ - //applicationDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\MPfm"; - -#if IOS || ANDROID - HomeDirectory = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); - PeakFileDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "PeakFiles"); -#elif WINDOWSSTORE || WINDOWS_PHONE - HomeDirectory = "TODO"; - PeakFileDirectory = "TODO"; -#else - HomeDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), ".MPfm"); - PeakFileDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), ".MPfm", "PeakFiles"); -#endif - - ConfigurationFilePath = Path.Combine(HomeDirectory, "MPfm.Configuration.xml"); - DatabaseFilePath = Path.Combine(HomeDirectory, "MPfm.Database.db"); - LogFilePath = Path.Combine(HomeDirectory, "MPfm.Log.txt"); - } - - /// - /// Loads MPfmConfig from file. - /// - /// Configuration file path - /// MPfmConfig object - public static MPfmConfig Load(string filePath) - { -#if WINDOWSSTORE - return new MPfmConfig(); -#else - XmlSerializer deserializer = new XmlSerializer(typeof(MPfmConfig)); - TextReader textReader = new StreamReader(filePath); - Object obj = deserializer.Deserialize(textReader); - MPfmConfig theme = (MPfmConfig)obj; - return theme; -#endif - } - - /// - /// Saves MPfmConfig to file. - /// - /// Configuration file path - /// MPfmConfig object - public static void Save(string filePath, MPfmConfig config) - { -#if !WINDOWSSTORE - XmlSerializer serializer = new XmlSerializer(typeof(MPfmConfig)); - TextWriter textWriter = new StreamWriter(filePath); - serializer.Serialize(textWriter, config); - textWriter.Dispose(); -#endif - } - } -} - diff --git a/MPfm/MPfm.Library/Services/WinRT/SyncClientService.cs b/MPfm/MPfm.Library/Services/WinRT/SyncClientService.cs index 541b5593..85c33de8 100644 --- a/MPfm/MPfm.Library/Services/WinRT/SyncClientService.cs +++ b/MPfm/MPfm.Library/Services/WinRT/SyncClientService.cs @@ -15,6 +15,8 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +#if WINDOWSSTORE || WINDOWS_PHONE + using System; using System.Collections.Generic; using System.Net.Http; @@ -301,3 +303,5 @@ private string GetLibraryLocalPath(AudioFile audioFile) } } } + +#endif \ No newline at end of file diff --git a/MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs b/MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs index 27ca5002..38efee02 100644 --- a/MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs +++ b/MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +#if WINDOWSSTORE || WINDOWS_PHONE using System; using System.Collections.Generic; using System.Diagnostics; @@ -213,3 +214,4 @@ public void Cancel() } } } +#endif \ No newline at end of file diff --git a/MPfm/MPfm.Library/Services/WinRT/SyncListenerService.cs b/MPfm/MPfm.Library/Services/WinRT/SyncListenerService.cs index aa79878b..7526aa28 100644 --- a/MPfm/MPfm.Library/Services/WinRT/SyncListenerService.cs +++ b/MPfm/MPfm.Library/Services/WinRT/SyncListenerService.cs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +#if WINDOWSSTORE || WINDOWS_PHONE using System; using System.Collections.Generic; using System.IO; @@ -621,3 +622,4 @@ public SyncDevice GetInternalSyncDevice() } } } +#endif \ No newline at end of file diff --git a/MPfm/MPfm.Library/Services/WinRT/UpdateLibraryService.cs b/MPfm/MPfm.Library/Services/WinRT/UpdateLibraryService.cs index ed93d540..69a4b168 100644 --- a/MPfm/MPfm.Library/Services/WinRT/UpdateLibraryService.cs +++ b/MPfm/MPfm.Library/Services/WinRT/UpdateLibraryService.cs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +#if WINDOWSSTORE || WINDOWS_PHONE using System; using System.Collections.Generic; using System.ComponentModel; @@ -464,3 +465,4 @@ public List SearchMediaFilesInFolders(string folderPath, bool recursive) } } } +#endif diff --git a/MPfm/MPfm.MVP/Config/AppConfig.cs b/MPfm/MPfm.MVP/Config/AppConfig.cs new file mode 100644 index 00000000..7df76de2 --- /dev/null +++ b/MPfm/MPfm.MVP/Config/AppConfig.cs @@ -0,0 +1,67 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; +using MPfm.MVP.Helpers; +using MPfm.Sound.AudioFiles; + +namespace MPfm.MVP.Config +{ + /// + /// Singleton containing all application settings. + /// + public class AppConfig + { + private readonly IAppConfigProvider _provider; + public RootAppConfig Root { get; private set; } + + #region Singleton + + private static AppConfig instance; + /// + /// AppConfig instance. + /// + public static AppConfig Instance + { + get + { + if(instance == null) + instance = new AppConfig(); + return instance; + } + } + + #endregion + + public AppConfig() + { + _provider = Bootstrapper.GetContainer().Resolve(); + Root = new RootAppConfig(); + } + + public void Load() + { + Root = _provider.Load(ConfigurationHelper.ConfigurationFilePath); + } + + public void Save() + { + _provider.Save(ConfigurationHelper.ConfigurationFilePath, Root); + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmAudioConfig.cs b/MPfm/MPfm.MVP/Config/AudioAppConfig.cs similarity index 92% rename from MPfm/MPfm.MVP/Config/MPfmAudioConfig.cs rename to MPfm/MPfm.MVP/Config/AudioAppConfig.cs index e7a25d3e..67df2037 100644 --- a/MPfm/MPfm.MVP/Config/MPfmAudioConfig.cs +++ b/MPfm/MPfm.MVP/Config/AudioAppConfig.cs @@ -1,43 +1,43 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using MPfm.Sound.BassNetWrapper; - -namespace MPfm.MVP.Config -{ - /// - /// Class containing all audio settings for MPfm. - /// - public class MPfmAudioConfig - { - public Device AudioDevice { get; set; } - public int SampleRate { get; set; } - public float Volume { get; set; } - public int BufferSize { get; set; } - public bool IsEQEnabled { get; set; } - public string EQPreset { get; set; } - - public MPfmAudioConfig() - { - // Set defaults - AudioDevice = new Device(); - SampleRate = 44100; - Volume = 1; - BufferSize = 100; - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.Sound.BassNetWrapper; + +namespace MPfm.MVP.Config +{ + /// + /// Class containing all audio settings for MPfm. + /// + public class AudioAppConfig + { + public Device AudioDevice { get; set; } + public int SampleRate { get; set; } + public float Volume { get; set; } + public int BufferSize { get; set; } + public bool IsEQEnabled { get; set; } + public string EQPreset { get; set; } + + public AudioAppConfig() + { + // Set defaults + AudioDevice = new Device(); + SampleRate = 44100; + Volume = 1; + BufferSize = 100; + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmControlsConfig.cs b/MPfm/MPfm.MVP/Config/ControlsAppConfig.cs similarity index 66% rename from MPfm/MPfm.MVP/Config/MPfmControlsConfig.cs rename to MPfm/MPfm.MVP/Config/ControlsAppConfig.cs index 86a0a1a6..6c91492e 100644 --- a/MPfm/MPfm.MVP/Config/MPfmControlsConfig.cs +++ b/MPfm/MPfm.MVP/Config/ControlsAppConfig.cs @@ -1,248 +1,248 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -namespace MPfm.MVP.Config -{ - /// - /// Class containing all control settings for MPfm. - /// - public class MPfmControlsConfig - { - public MPfmTableViewConfig TableViewSongBrowser { get; private set; } - public MPfmTableViewConfig TableViewPlaylistBrowser { get; private set; } - - public MPfmControlsConfig() - { - // Set defaults - TableViewSongBrowser = new MPfmTableViewConfig(); - TableViewPlaylistBrowser = new MPfmTableViewConfig(); - - // Add default columns for Song Browser - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "IsPlaying", - FieldName = "IsPlaying", - Order = 0, - Width = 20 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "FileType", - FieldName = "Type", - Order = 1, - Width = 40, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "DiscTrackNumber", - FieldName = "Tr#", - Order = 2, - Width = 30 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "TrackCount", - FieldName = "Track Count", - Order = 3, - Width = 30, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "File Path", - FieldName = "FilePath", - Order = 4, - Width = 200, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Song Title", - FieldName = "Title", - Order = 5, - Width = 200 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Length", - FieldName = "Length", - Order = 6, - Width = 70 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Artist Name", - FieldName = "ArtistName", - Order = 7, - Width = 140 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Album Title", - FieldName = "AlbumTitle", - Order = 8, - Width = 140 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Genre", - FieldName = "Genre", - Order = 9, - Width = 140, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Play Count", - FieldName = "PlayCount", - Order = 10, - Width = 50 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Last Played", - FieldName = "LastPlayed", - Order = 11, - Width = 80 - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Bitrate", - FieldName = "Bitrate", - Order = 12, - Width = 50, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Sample Rate", - FieldName = "SampleRate", - Order = 13, - Width = 50, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Tempo", - FieldName = "Tempo", - Order = 14, - Width = 50, - IsVisible = false - }); - TableViewSongBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Year", - FieldName = "Year", - Order = 15, - Width = 50, - IsVisible = false - }); - - // Add default columns for Playlist Browser - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "IsPlaying", - FieldName = "IsPlaying", - Order = 0, - Width = 20 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "FileType", - FieldName = "Type", - Order = 1, - Width = 40, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "DiscTrackNumber", - FieldName = "Tr#", - Order = 2, - Width = 30 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "TrackCount", - FieldName = "Track Count", - Order = 3, - Width = 30, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "File Path", - FieldName = "FilePath", - Order = 4, - Width = 200, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Song Title", - FieldName = "Title", - Order = 5, - Width = 200 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Length", - FieldName = "Length", - Order = 6, - Width = 70 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Artist Name", - FieldName = "ArtistName", - Order = 7, - Width = 140 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Album Title", - FieldName = "AlbumTitle", - Order = 8, - Width = 140 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Genre", - FieldName = "Genre", - Order = 9, - Width = 140, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Play Count", - FieldName = "PlayCount", - Order = 10, - Width = 50 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Last Played", - FieldName = "LastPlayed", - Order = 11, - Width = 80 - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Bitrate", - FieldName = "Bitrate", - Order = 12, - Width = 50, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Sample Rate", - FieldName = "SampleRate", - Order = 13, - Width = 50, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Tempo", - FieldName = "Tempo", - Order = 14, - Width = 50, - IsVisible = false - }); - TableViewPlaylistBrowser.Columns.Add(new MPfmTableViewColumnConfig() { - Title = "Year", - FieldName = "Year", - Order = 15, - Width = 50, - IsVisible = false - }); - - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.MVP.Config +{ + /// + /// Class containing all control settings for MPfm. + /// + public class ControlsAppConfig + { + public TableViewAppConfig TableViewAppSongBrowser { get; set; } + public TableViewAppConfig TableViewAppPlaylistBrowser { get; set; } + + public ControlsAppConfig() + { + // Set defaults + TableViewAppSongBrowser = new TableViewAppConfig(); + TableViewAppPlaylistBrowser = new TableViewAppConfig(); + + // Add default columns for Song Browser + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "IsPlaying", + FieldName = "IsPlaying", + Order = 0, + Width = 20 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "FileType", + FieldName = "Type", + Order = 1, + Width = 40, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "DiscTrackNumber", + FieldName = "Tr#", + Order = 2, + Width = 30 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "TrackCount", + FieldName = "Track Count", + Order = 3, + Width = 30, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "File Path", + FieldName = "FilePath", + Order = 4, + Width = 200, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Song Title", + FieldName = "Title", + Order = 5, + Width = 200 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Length", + FieldName = "Length", + Order = 6, + Width = 70 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Artist Name", + FieldName = "ArtistName", + Order = 7, + Width = 140 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Album Title", + FieldName = "AlbumTitle", + Order = 8, + Width = 140 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Genre", + FieldName = "Genre", + Order = 9, + Width = 140, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Play Count", + FieldName = "PlayCount", + Order = 10, + Width = 50 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Last Played", + FieldName = "LastPlayed", + Order = 11, + Width = 80 + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Bitrate", + FieldName = "Bitrate", + Order = 12, + Width = 50, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Sample Rate", + FieldName = "SampleRate", + Order = 13, + Width = 50, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Tempo", + FieldName = "Tempo", + Order = 14, + Width = 50, + IsVisible = false + }); + TableViewAppSongBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Year", + FieldName = "Year", + Order = 15, + Width = 50, + IsVisible = false + }); + + // Add default columns for Playlist Browser + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "IsPlaying", + FieldName = "IsPlaying", + Order = 0, + Width = 20 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "FileType", + FieldName = "Type", + Order = 1, + Width = 40, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "DiscTrackNumber", + FieldName = "Tr#", + Order = 2, + Width = 30 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "TrackCount", + FieldName = "Track Count", + Order = 3, + Width = 30, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "File Path", + FieldName = "FilePath", + Order = 4, + Width = 200, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Song Title", + FieldName = "Title", + Order = 5, + Width = 200 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Length", + FieldName = "Length", + Order = 6, + Width = 70 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Artist Name", + FieldName = "ArtistName", + Order = 7, + Width = 140 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Album Title", + FieldName = "AlbumTitle", + Order = 8, + Width = 140 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Genre", + FieldName = "Genre", + Order = 9, + Width = 140, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Play Count", + FieldName = "PlayCount", + Order = 10, + Width = 50 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Last Played", + FieldName = "LastPlayed", + Order = 11, + Width = 80 + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Bitrate", + FieldName = "Bitrate", + Order = 12, + Width = 50, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Sample Rate", + FieldName = "SampleRate", + Order = 13, + Width = 50, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Tempo", + FieldName = "Tempo", + Order = 14, + Width = 50, + IsVisible = false + }); + TableViewAppPlaylistBrowser.Columns.Add(new TableViewColumnAppConfig() { + Title = "Year", + FieldName = "Year", + Order = 15, + Width = 50, + IsVisible = false + }); + + } + } +} diff --git a/MPfm/MPfm.Core/Preferences/PreferenceKeys.cs b/MPfm/MPfm.MVP/Config/Providers/IAppConfigProvider.cs similarity index 75% rename from MPfm/MPfm.Core/Preferences/PreferenceKeys.cs rename to MPfm/MPfm.MVP/Config/Providers/IAppConfigProvider.cs index d53cd7a0..b83b49aa 100644 --- a/MPfm/MPfm.Core/Preferences/PreferenceKeys.cs +++ b/MPfm/MPfm.MVP/Config/Providers/IAppConfigProvider.cs @@ -15,13 +15,11 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . -using System; - -namespace MPfm.Core.Preferences +namespace MPfm.MVP.Config.Providers { - public static class PreferenceKeys + public interface IAppConfigProvider { - public const string AudioBufferLength = "AudioBufferLength"; - public const string LibrarySyncServerPort = "LibrarySyncServerPort"; + RootAppConfig Load(string filePath); + void Save(string filePath, RootAppConfig config); } } diff --git a/MPfm/MPfm.MVP/Config/Providers/XmlAppConfigProvider.cs b/MPfm/MPfm.MVP/Config/Providers/XmlAppConfigProvider.cs new file mode 100644 index 00000000..c3c96444 --- /dev/null +++ b/MPfm/MPfm.MVP/Config/Providers/XmlAppConfigProvider.cs @@ -0,0 +1,58 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System; +using System.IO; +using System.Xml.Serialization; + +#if !WINDOWSSTORE +namespace MPfm.MVP.Config.Providers +{ + public class XmlAppConfigProvider : IAppConfigProvider + { + /// + /// Loads application settings from file. + /// + /// Configuration file path + /// AppConfig object + public RootAppConfig Load(string filePath) + { + if (!File.Exists(filePath)) + return new RootAppConfig(); + + XmlSerializer deserializer = new XmlSerializer(typeof(RootAppConfig)); + TextReader textReader = new StreamReader(filePath); + Object obj = deserializer.Deserialize(textReader); + RootAppConfig theme = (RootAppConfig)obj; + return theme; + } + + /// + /// Saves AppConfig to file. + /// + /// Configuration file path + /// AppConfig object + public void Save(string filePath, RootAppConfig config) + { + XmlSerializer serializer = new XmlSerializer(typeof(RootAppConfig)); + TextWriter textWriter = new StreamWriter(filePath); + serializer.Serialize(textWriter, config); + textWriter.Dispose(); + } + } +} +#endif diff --git a/MPfm/MPfm.MVP/Config/MPfmConfig.cs b/MPfm/MPfm.MVP/Config/RootAppConfig.cs similarity index 58% rename from MPfm/MPfm.MVP/Config/MPfmConfig.cs rename to MPfm/MPfm.MVP/Config/RootAppConfig.cs index 25055919..4dcf9c68 100644 --- a/MPfm/MPfm.MVP/Config/MPfmConfig.cs +++ b/MPfm/MPfm.MVP/Config/RootAppConfig.cs @@ -1,85 +1,57 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using MPfm.MVP.Helpers; -using MPfm.Sound.AudioFiles; - -namespace MPfm.MVP.Config -{ - /// - /// Singleton containing all settings for MPfm. - /// - public class MPfmConfig - { - #region Singleton - - private static MPfmConfig instance; - /// - /// MPfmConfig instance. - /// - public static MPfmConfig Instance - { - get - { - if(instance == null) - instance = new MPfmConfig(); - return instance; - } - } - - #endregion - - #region Properties - - public bool IsFirstRun { get; set; } - public bool ShowTooltips { get; set; } - public AudioFileFormat FilterSoundFormat { get; set; } - - public int WindowSplitterDistance { get; set; } - public int PositionUpdateFrequency { get; set; } - public int OutputMeterUpdateFrequency { get; set; } - - public bool PeakFileUseCustomDirectory { get; set; } - public string PeakFileCustomDirectory { get; set; } - public bool PeakFileIsDisplayWarning { get; set; } - public int PeakFileWarningThreshold { get; set; } - - public MPfmAudioConfig Audio { get; set; } - public MPfmControlsConfig Controls { get; set; } - public MPfmWindowsConfig Windows { get; set; } - - #endregion - - public MPfmConfig() - { - // Set defaults - IsFirstRun = true; - ShowTooltips = true; - PositionUpdateFrequency = 10; - OutputMeterUpdateFrequency = 10; - - Audio = new MPfmAudioConfig(); - Controls = new MPfmControlsConfig(); - Windows = new MPfmWindowsConfig(); - } - - public void Load() - { - instance = ConfigurationHelper.Load(ConfigurationHelper.ConfigurationFilePath); - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; +using MPfm.MVP.Helpers; +using MPfm.Sound.AudioFiles; + +namespace MPfm.MVP.Config +{ + public class RootAppConfig + { + public bool IsFirstRun { get; set; } + public bool ShowTooltips { get; set; } + public AudioFileFormat FilterSoundFormat { get; set; } + + public int WindowSplitterDistance { get; set; } + public int PositionUpdateFrequency { get; set; } + public int OutputMeterUpdateFrequency { get; set; } + + public bool PeakFileUseCustomDirectory { get; set; } + public string PeakFileCustomDirectory { get; set; } + public bool PeakFileIsDisplayWarning { get; set; } + public int PeakFileWarningThreshold { get; set; } + + public AudioAppConfig Audio { get; set; } + public ControlsAppConfig Controls { get; set; } + public WindowsAppConfig Windows { get; set; } + + public RootAppConfig() + { + // Set defaults + IsFirstRun = true; + ShowTooltips = true; + PositionUpdateFrequency = 10; + OutputMeterUpdateFrequency = 10; + + Audio = new AudioAppConfig(); + Controls = new ControlsAppConfig(); + Windows = new WindowsAppConfig(); + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmTableViewConfig.cs b/MPfm/MPfm.MVP/Config/TableViewAppConfig.cs similarity index 75% rename from MPfm/MPfm.MVP/Config/MPfmTableViewConfig.cs rename to MPfm/MPfm.MVP/Config/TableViewAppConfig.cs index 6d1bb72a..2a2057e1 100644 --- a/MPfm/MPfm.MVP/Config/MPfmTableViewConfig.cs +++ b/MPfm/MPfm.MVP/Config/TableViewAppConfig.cs @@ -1,35 +1,35 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using System.Collections.Generic; - -namespace MPfm.MVP.Config -{ - /// - /// Class containing all table view settings for MPfm. - /// - public class MPfmTableViewConfig - { - public List Columns { get; private set; } - - public MPfmTableViewConfig() - { - // Set defaults - Columns = new List(); - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using System.Collections.Generic; + +namespace MPfm.MVP.Config +{ + /// + /// Class containing all table view settings for MPfm. + /// + public class TableViewAppConfig + { + public List Columns { get; private set; } + + public TableViewAppConfig() + { + // Set defaults + Columns = new List(); + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmTableViewColumnConfig.cs b/MPfm/MPfm.MVP/Config/TableViewColumnAppConfig.cs similarity index 90% rename from MPfm/MPfm.MVP/Config/MPfmTableViewColumnConfig.cs rename to MPfm/MPfm.MVP/Config/TableViewColumnAppConfig.cs index cbf07aa3..b302cb27 100644 --- a/MPfm/MPfm.MVP/Config/MPfmTableViewColumnConfig.cs +++ b/MPfm/MPfm.MVP/Config/TableViewColumnAppConfig.cs @@ -1,38 +1,38 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -namespace MPfm.MVP.Config -{ - /// - /// Class containing settings for a single table view column for MPfm. - /// - public class MPfmTableViewColumnConfig - { - public string FieldName { get; set; } - public string Title { get; set; } - public int Order { get; set; } - public int Width { get; set; } - public bool IsVisible { get; set; } - - public MPfmTableViewColumnConfig() - { - // Set defaults - Width = 50; - IsVisible = true; - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.MVP.Config +{ + /// + /// Class containing settings for a single table view column for MPfm. + /// + public class TableViewColumnAppConfig + { + public string FieldName { get; set; } + public string Title { get; set; } + public int Order { get; set; } + public int Width { get; set; } + public bool IsVisible { get; set; } + + public TableViewColumnAppConfig() + { + // Set defaults + Width = 50; + IsVisible = true; + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmWindowConfig.cs b/MPfm/MPfm.MVP/Config/WindowAppConfig.cs similarity index 91% rename from MPfm/MPfm.MVP/Config/MPfmWindowConfig.cs rename to MPfm/MPfm.MVP/Config/WindowAppConfig.cs index 832dbe59..5a9ae15b 100644 --- a/MPfm/MPfm.MVP/Config/MPfmWindowConfig.cs +++ b/MPfm/MPfm.MVP/Config/WindowAppConfig.cs @@ -1,40 +1,40 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -namespace MPfm.MVP.Config -{ - /// - /// Class containing all settings for a single Window for MPfm. - /// - public class MPfmWindowConfig - { - public string Title { get; set; } - public float X { get; set; } - public float Y { get; set; } - public float Width { get; set; } - public float Height { get; set; } - public bool IsMaximized { get; set; } - public bool IsVisible { get; set; } - - public MPfmWindowConfig() - { - // Set defaults - Width = 640; - Height = 480; - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.MVP.Config +{ + /// + /// Class containing all settings for a single Window for MPfm. + /// + public class WindowAppConfig + { + public string Title { get; set; } + public float X { get; set; } + public float Y { get; set; } + public float Width { get; set; } + public float Height { get; set; } + public bool IsMaximized { get; set; } + public bool IsVisible { get; set; } + + public WindowAppConfig() + { + // Set defaults + Width = 640; + Height = 480; + } + } +} diff --git a/MPfm/MPfm.MVP/Config/MPfmWindowsConfig.cs b/MPfm/MPfm.MVP/Config/WindowsAppConfig.cs similarity index 60% rename from MPfm/MPfm.MVP/Config/MPfmWindowsConfig.cs rename to MPfm/MPfm.MVP/Config/WindowsAppConfig.cs index 1d8b29d2..799b8980 100644 --- a/MPfm/MPfm.MVP/Config/MPfmWindowsConfig.cs +++ b/MPfm/MPfm.MVP/Config/WindowsAppConfig.cs @@ -1,39 +1,39 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -namespace MPfm.MVP.Config -{ - /// - /// Class containing settings for all windows for MPfm. - /// - public class MPfmWindowsConfig - { - public MPfmWindowConfig MainWindow { get; private set; } - public MPfmWindowConfig PlaylistWindow { get; private set; } - public MPfmWindowConfig EffectsWindow { get; private set; } - public MPfmWindowConfig PreferencesWindow { get; private set; } - - public MPfmWindowsConfig() - { - // Set defaults - MainWindow = new MPfmWindowConfig(); - PlaylistWindow = new MPfmWindowConfig(); - EffectsWindow = new MPfmWindowConfig(); - PreferencesWindow = new MPfmWindowConfig(); - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.MVP.Config +{ + /// + /// Class containing settings for all windows for MPfm. + /// + public class WindowsAppConfig + { + public WindowAppConfig MainWindowApp { get; set; } + public WindowAppConfig PlaylistWindowApp { get; set; } + public WindowAppConfig EffectsWindowApp { get; set; } + public WindowAppConfig PreferencesWindowApp { get; set; } + + public WindowsAppConfig() + { + // Set defaults + MainWindowApp = new WindowAppConfig(); + PlaylistWindowApp = new WindowAppConfig(); + EffectsWindowApp = new WindowAppConfig(); + PreferencesWindowApp = new WindowAppConfig(); + } + } +} diff --git a/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs b/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs index 478c7284..1a4c04af 100644 --- a/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs +++ b/MPfm/MPfm.MVP/Helpers/ConfigurationHelper.cs @@ -66,32 +66,32 @@ static ConfigurationHelper() } /// - /// Loads MPfmConfig from file. + /// Loads AppConfig from file. /// /// Configuration file path - /// MPfmConfig object - public static MPfmConfig Load(string filePath) + /// AppConfig object + public static AppConfig Load(string filePath) { #if WINDOWSSTORE - return new MPfmConfig(); + return new AppConfig(); #else - XmlSerializer deserializer = new XmlSerializer(typeof(MPfmConfig)); + XmlSerializer deserializer = new XmlSerializer(typeof(AppConfig)); TextReader textReader = new StreamReader(filePath); Object obj = deserializer.Deserialize(textReader); - MPfmConfig theme = (MPfmConfig)obj; + AppConfig theme = (AppConfig)obj; return theme; #endif } /// - /// Saves MPfmConfig to file. + /// Saves AppConfig to file. /// /// Configuration file path - /// MPfmConfig object - public static void Save(string filePath, MPfmConfig config) + /// AppConfig object + public static void Save(string filePath, AppConfig config) { #if !WINDOWSSTORE - XmlSerializer serializer = new XmlSerializer(typeof(MPfmConfig)); + XmlSerializer serializer = new XmlSerializer(typeof(AppConfig)); TextWriter textWriter = new StreamWriter(filePath); serializer.Serialize(textWriter, config); textWriter.Dispose(); diff --git a/MPfm/MPfm.MVP/MPfm.MVP.Android.csproj b/MPfm/MPfm.MVP/MPfm.MVP.Android.csproj index 8cec5586..ab99920a 100644 --- a/MPfm/MPfm.MVP/MPfm.MVP.Android.csproj +++ b/MPfm/MPfm.MVP/MPfm.MVP.Android.csproj @@ -194,13 +194,16 @@ - - - - - - - + + + + + + + + + + diff --git a/MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj b/MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj index d4fdc96d..0a8fa6c5 100644 --- a/MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj +++ b/MPfm/MPfm.MVP/MPfm.MVP.WindowsPhone.csproj @@ -198,13 +198,16 @@ - - - - - - - + + + + + + + + + + diff --git a/MPfm/MPfm.MVP/MPfm.MVP.WindowsStore.csproj b/MPfm/MPfm.MVP/MPfm.MVP.WindowsStore.csproj index 2a6e4505..74fd3286 100644 --- a/MPfm/MPfm.MVP/MPfm.MVP.WindowsStore.csproj +++ b/MPfm/MPfm.MVP/MPfm.MVP.WindowsStore.csproj @@ -100,6 +100,9 @@ + + + @@ -165,13 +168,13 @@ - - - - - - - + + + + + + + diff --git a/MPfm/MPfm.MVP/MPfm.MVP.csproj b/MPfm/MPfm.MVP/MPfm.MVP.csproj index 1337d189..ad9d5f0c 100644 --- a/MPfm/MPfm.MVP/MPfm.MVP.csproj +++ b/MPfm/MPfm.MVP/MPfm.MVP.csproj @@ -178,13 +178,16 @@ - - - - - - - + + + + + + + + + + diff --git a/MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj b/MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj index 0a410af3..538d3cd3 100644 --- a/MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj +++ b/MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj @@ -235,13 +235,16 @@ - - - - - - - + + + + + + + + + + diff --git a/MPfm/MPfm.MVP/Presenters/AudioPreferencesPresenter.cs b/MPfm/MPfm.MVP/Presenters/AudioPreferencesPresenter.cs index 4d637a69..5298403c 100644 --- a/MPfm/MPfm.MVP/Presenters/AudioPreferencesPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/AudioPreferencesPresenter.cs @@ -1,32 +1,32 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using MPfm.MVP.Presenters.Interfaces; -using MPfm.MVP.Views; - -namespace MPfm.MVP.Presenters -{ - /// - /// Audio preferences presenter. - /// - public class AudioPreferencesPresenter : BasePresenter, IAudioPreferencesPresenter - { - public AudioPreferencesPresenter() - { - } - } -} +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Presenters.Interfaces; +using MPfm.MVP.Views; + +namespace MPfm.MVP.Presenters +{ + /// + /// Audio preferences presenter. + /// + public class AudioPreferencesPresenter : BasePresenter, IAudioPreferencesPresenter + { + public AudioPreferencesPresenter() + { + } + } +} diff --git a/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs b/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs index a67f538c..9bccd522 100644 --- a/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Presenters/Interfaces/IAudioPreferencesPresenter.cs b/MPfm/MPfm.MVP/Presenters/Interfaces/IAudioPreferencesPresenter.cs index 27c86363..c7a9cb38 100644 --- a/MPfm/MPfm.MVP/Presenters/Interfaces/IAudioPreferencesPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/Interfaces/IAudioPreferencesPresenter.cs @@ -1,29 +1,29 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -using MPfm.MVP.Views; - -namespace MPfm.MVP.Presenters.Interfaces -{ - /// - /// Audio preferences presenter interface. - /// - public interface IAudioPreferencesPresenter : IBasePresenter - { - } -} - +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Views; + +namespace MPfm.MVP.Presenters.Interfaces +{ + /// + /// Audio preferences presenter interface. + /// + public interface IAudioPreferencesPresenter : IBasePresenter + { + } +} + diff --git a/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs b/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs index 95dc8112..bfaeeb78 100644 --- a/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/LibraryBrowserPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // @@ -75,7 +75,7 @@ public void BindView(ILibraryBrowserView view) view.OnTreeNodeDoubleClicked = (entity) => { TreeNodeDoubleClicked(entity); }; // // Load configuration -// if (MPfmConfig.Instance.ShowTooltips) +// if (AppConfig.Instance.ShowTooltips) // Refresh view (first level nodes) view.RefreshLibraryBrowser(GetFirstLevelNodes()); diff --git a/MPfm/MPfm.MVP/Presenters/PlayerPresenter.cs b/MPfm/MPfm.MVP/Presenters/PlayerPresenter.cs index e646916b..3e358bcc 100644 --- a/MPfm/MPfm.MVP/Presenters/PlayerPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/PlayerPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Presenters/PlaylistPresenter.cs b/MPfm/MPfm.MVP/Presenters/PlaylistPresenter.cs index b5a78016..3b29b2c1 100644 --- a/MPfm/MPfm.MVP/Presenters/PlaylistPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/PlaylistPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Presenters/PreferencesPresenter.cs b/MPfm/MPfm.MVP/Presenters/PreferencesPresenter.cs index 3f14f85b..cc41dd7f 100644 --- a/MPfm/MPfm.MVP/Presenters/PreferencesPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/PreferencesPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Presenters/SyncDownloadPresenter.cs b/MPfm/MPfm.MVP/Presenters/SyncDownloadPresenter.cs index fca226ec..9acce940 100644 --- a/MPfm/MPfm.MVP/Presenters/SyncDownloadPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/SyncDownloadPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Presenters/UpdateLibraryPresenter.cs b/MPfm/MPfm.MVP/Presenters/UpdateLibraryPresenter.cs index 631585fc..3f01a661 100644 --- a/MPfm/MPfm.MVP/Presenters/UpdateLibraryPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/UpdateLibraryPresenter.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // diff --git a/MPfm/MPfm.MVP/Services/InitializationService.cs b/MPfm/MPfm.MVP/Services/InitializationService.cs index b7bdf481..c38582da 100644 --- a/MPfm/MPfm.MVP/Services/InitializationService.cs +++ b/MPfm/MPfm.MVP/Services/InitializationService.cs @@ -1,4 +1,4 @@ -// Copyright © 2011-2013 Yanick Castonguay +// Copyright © 2011-2013 Yanick Castonguay // // This file is part of MPfm. // @@ -19,8 +19,8 @@ using System.Diagnostics; using System.IO; using System.Reflection; +using System.Threading.Tasks; using MPfm.Core; -using MPfm.Core.WinRT; using MPfm.Library; using MPfm.Library.Database; using MPfm.Library.Objects; @@ -31,6 +31,7 @@ #if WINDOWSSTORE using Windows.Storage; +using MPfm.Core.WinRT; #endif namespace MPfm.MVP.Services @@ -97,36 +98,26 @@ private void CreateTraceListener() private void CreateDirectories() { -#if !WINDOWSSTORE && !WINDOWS_PHONE +#if WINDOWSSTORE + var task = ApplicationData.Current.LocalFolder.CreateFolderAsync("PeakFiles", CreationCollisionOption.OpenIfExists); + var storageFolder = task.GetResults(); +#elif WINDOWS_PHONE + // +#else // Create missing directories if(!Directory.Exists(ConfigurationHelper.HomeDirectory)) Directory.CreateDirectory(ConfigurationHelper.HomeDirectory); if (!Directory.Exists(ConfigurationHelper.PeakFileDirectory)) Directory.CreateDirectory(ConfigurationHelper.PeakFileDirectory); -#else - CreateDirectoriesWinRT(); #endif } - private async void CreateDirectoriesWinRT() - { - var localFolder = ApplicationData.Current.LocalFolder; - var localSettings = ApplicationData.Current.LocalSettings; - var storageFolder = await localFolder.CreateFolderAsync("PeakFiles", CreationCollisionOption.OpenIfExists); - } - private void LoadConfiguration() { - // Check for configuration file Tracing.Log("InitializationService.CreateConfiguration -- Checking for configuration file..."); + AppConfig.Instance.Load(); -#if WINDOWSSTORE || WINDOWS_PHONE - // -#else - if (File.Exists(ConfigurationHelper.ConfigurationFilePath)) - MPfmConfig.Instance.Load(); -#endif - //ConfigurationHelper.Save(ConfigurationHelper.ConfigurationFilePath, MPfmConfig.Instance); + //ConfigurationHelper.Save(ConfigurationHelper.ConfigurationFilePath, AppConfig.Instance); //EQPreset preset = EQPresetHelper.Load("/Users/animal/Documents/test.txt"); //EQPresetHelper.Save("/Users/animal/Documents/test.txt", new EQPreset()); } diff --git a/MPfm/MPfm.MVP/Views/IAudioPreferencesView.cs b/MPfm/MPfm.MVP/Views/IAudioPreferencesView.cs index b17fd440..55304b7c 100644 --- a/MPfm/MPfm.MVP/Views/IAudioPreferencesView.cs +++ b/MPfm/MPfm.MVP/Views/IAudioPreferencesView.cs @@ -1,27 +1,27 @@ -// Copyright © 2011-2013 Yanick Castonguay -// -// This file is part of MPfm. -// -// MPfm is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// MPfm is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MPfm. If not, see . - -namespace MPfm.MVP.Views -{ - /// - /// Audio preferences view interface. - /// - public interface IAudioPreferencesView : IBaseView - { - } -} - +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +namespace MPfm.MVP.Views +{ + /// + /// Audio preferences view interface. + /// + public interface IAudioPreferencesView : IBaseView + { + } +} + diff --git a/MPfm/MPfm.Windows/Classes/Program.cs b/MPfm/MPfm.Windows/Classes/Program.cs index 84c0d872..a05b7d8d 100644 --- a/MPfm/MPfm.Windows/Classes/Program.cs +++ b/MPfm/MPfm.Windows/Classes/Program.cs @@ -20,6 +20,7 @@ using System.Windows.Forms; using MPfm.Library; using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; using MPfm.MVP.Navigation; using MPfm.MVP.Views; using MPfm.Windows.Classes.Forms; @@ -56,6 +57,7 @@ static void Main() // Finish IoC registration Bootstrapper.GetContainer().Register().AsSingleton(); + Bootstrapper.GetContainer().Register().AsSingleton(); Bootstrapper.GetContainer().Register().AsSingleton(); Bootstrapper.GetContainer().Register().AsMultiInstance(); Bootstrapper.GetContainer().Register().AsMultiInstance(); diff --git a/MPfm/MPfm.WindowsPhone/App.xaml.cs b/MPfm/MPfm.WindowsPhone/App.xaml.cs index 57ac1ccc..74198972 100644 --- a/MPfm/MPfm.WindowsPhone/App.xaml.cs +++ b/MPfm/MPfm.WindowsPhone/App.xaml.cs @@ -28,12 +28,14 @@ using MPfm.Library; using MPfm.Library.Database; using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; using MPfm.MVP.Helpers; using MPfm.MVP.Navigation; using MPfm.MVP.Views; using MPfm.WindowsPhone.Classes; using MPfm.WindowsPhone.Classes.Navigation; using MPfm.WindowsPhone.Classes.Pages; +using MPfm.WindowsPhone.Classes.Providers; using MPfm.WindowsPhone.Resources; using TinyIoC; @@ -258,6 +260,7 @@ private void BootstrapApp() { TinyIoCContainer container = Bootstrapper.GetContainer(); container.Register().AsSingleton(); + container.Register().AsSingleton(); container.Register().AsSingleton(); container.Register().AsMultiInstance(); container.Register().AsMultiInstance(); diff --git a/MPfm/MPfm.WindowsPhone/Classes/Navigation/WindowsPhoneNavigationManager.cs b/MPfm/MPfm.WindowsPhone/Classes/Navigation/WindowsPhoneNavigationManager.cs index 83220877..7fc54dd0 100644 --- a/MPfm/MPfm.WindowsPhone/Classes/Navigation/WindowsPhoneNavigationManager.cs +++ b/MPfm/MPfm.WindowsPhone/Classes/Navigation/WindowsPhoneNavigationManager.cs @@ -71,12 +71,12 @@ public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrow Debug.WriteLine("WindowsPhoneNavigationManager - PushTabView"); } - public override void PushDialogView(string viewTitle, IBaseView sourceView, IBaseView view) + public override void PushDialogView(MobileDialogPresentationType presentationType, string viewTitle, IBaseView sourceView, IBaseView view) { Debug.WriteLine("WindowsPhoneNavigationManager - PushDialogView"); } - public override void PushDialogSubview(string parentViewTitle, IBaseView view) + public override void PushDialogSubview(MobileDialogPresentationType presentationType, string parentViewTitle, IBaseView view) { Debug.WriteLine("WindowsPhoneNavigationManager - PushDialogSubview"); } diff --git a/MPfm/MPfm.WindowsPhone/Classes/Providers/WindowsPhoneAppConfigProvider.cs b/MPfm/MPfm.WindowsPhone/Classes/Providers/WindowsPhoneAppConfigProvider.cs new file mode 100644 index 00000000..da970a37 --- /dev/null +++ b/MPfm/MPfm.WindowsPhone/Classes/Providers/WindowsPhoneAppConfigProvider.cs @@ -0,0 +1,34 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Config; +using MPfm.MVP.Config.Providers; + +namespace MPfm.WindowsPhone.Classes.Providers +{ + public class WindowsPhoneAppConfigProvider : IAppConfigProvider + { + public RootAppConfig Load(string filePath) + { + return new RootAppConfig(); + } + + public void Save(string filePath, RootAppConfig config) + { + } + } +} diff --git a/MPfm/MPfm.WindowsPhone/MPfm.WindowsPhone.csproj b/MPfm/MPfm.WindowsPhone/MPfm.WindowsPhone.csproj index 36e5c9c6..e0d63107 100644 --- a/MPfm/MPfm.WindowsPhone/MPfm.WindowsPhone.csproj +++ b/MPfm/MPfm.WindowsPhone/MPfm.WindowsPhone.csproj @@ -157,6 +157,7 @@ SyncPage.xaml + ListSimpleControl.xaml diff --git a/MPfm/MPfm.WindowsStore/App.xaml.cs b/MPfm/MPfm.WindowsStore/App.xaml.cs index d21201b4..78c75e78 100644 --- a/MPfm/MPfm.WindowsStore/App.xaml.cs +++ b/MPfm/MPfm.WindowsStore/App.xaml.cs @@ -18,11 +18,13 @@ using System.Diagnostics; using MPfm.Library; using MPfm.MVP.Bootstrap; +using MPfm.MVP.Config.Providers; using MPfm.MVP.Navigation; using MPfm.MVP.Views; using MPfm.WindowsStore.Classes; using MPfm.WindowsStore.Classes.Navigation; using MPfm.WindowsStore.Classes.Pages; +using MPfm.WindowsStore.Classes.Providers; using MPfm.WindowsStore.Common; using System; @@ -79,7 +81,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args) //// just ensure that the window is active //if (rootFrame == null) //{ - // BootstrapApp(); + // ConfigureIoC(); // // Create a Frame to act as the navigation context and navigate to the first page // rootFrame = new Frame(); @@ -118,7 +120,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args) // Ensure the current window is active //Window.Current.Activate(); - BootstrapApp(); + ConfigureIoC(); _navigationManager = (WindowsStoreNavigationManager)Bootstrapper.GetContainer().Resolve(); _navigationManager.SplashImageLocation = args.SplashScreen.ImageLocation; //_navigationManager.BindOptionsMenuView(this); @@ -140,10 +142,11 @@ private async void OnSuspending(object sender, SuspendingEventArgs e) deferral.Complete(); } - private void BootstrapApp() + private void ConfigureIoC() { TinyIoCContainer container = Bootstrapper.GetContainer(); container.Register().AsSingleton(); + container.Register().AsSingleton(); container.Register().AsSingleton(); container.Register().AsMultiInstance(); container.Register().AsMultiInstance(); diff --git a/MPfm/MPfm.WindowsStore/Classes/Providers/WindowsStoreAppConfigProvider.cs b/MPfm/MPfm.WindowsStore/Classes/Providers/WindowsStoreAppConfigProvider.cs new file mode 100644 index 00000000..c46b9c6b --- /dev/null +++ b/MPfm/MPfm.WindowsStore/Classes/Providers/WindowsStoreAppConfigProvider.cs @@ -0,0 +1,34 @@ +// Copyright © 2011-2013 Yanick Castonguay +// +// This file is part of MPfm. +// +// MPfm is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// MPfm is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MPfm. If not, see . + +using MPfm.MVP.Config; +using MPfm.MVP.Config.Providers; + +namespace MPfm.WindowsStore.Classes.Providers +{ + public class WindowsStoreAppConfigProvider : IAppConfigProvider + { + public RootAppConfig Load(string filePath) + { + return new RootAppConfig(); + } + + public void Save(string filePath, RootAppConfig config) + { + } + } +} diff --git a/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj b/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj index 10653433..4b76e93b 100644 --- a/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj +++ b/MPfm/MPfm.WindowsStore/MPfm.WindowsStore.csproj @@ -140,6 +140,7 @@ MainPage.xaml + ArtistBrowserPage.xaml