Skip to content

Commit

Permalink
Windows: Library Browser in Main window is now partially working. Upd…
Browse files Browse the repository at this point in the history
…ateLibrary window can now be opened. More cleanup in frmMain.cs.

Related to issue #422.
  • Loading branch information
ycastonguay committed Aug 18, 2013
1 parent 71eb998 commit bbafa06
Show file tree
Hide file tree
Showing 11 changed files with 595 additions and 1,469 deletions.
36 changes: 36 additions & 0 deletions MPfm/MPfm.MVP/Services/InitializationService.cs
Expand Up @@ -52,6 +52,11 @@ public InitializationService(IAudioFileCacheService audioFileCacheService, ISync
/// </summary>
public void Initialize()
{
//// 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";

// Check if the .MPfm directory exists
string directoryPath = ConfigurationHelper.HomeDirectory;
if(!Directory.Exists(directoryPath))
Expand Down Expand Up @@ -104,6 +109,37 @@ void LoadConfiguration()
//ConfigurationHelper.Save(ConfigurationHelper.ConfigurationFilePath, MPfmConfig.Instance);
//EQPreset preset = EQPresetHelper.Load("/Users/animal/Documents/test.txt");
//EQPresetHelper.Save("/Users/animal/Documents/test.txt", new EQPreset());


// Also create peak file directory if it doesn't exist

//// Check if the configuration file exists
//if (File.Exists(configurationFilePath))
//{
// // Load configuration values
// config.Load();

// // Load peak file options
// bool? peakFileUseCustomDirectory = Config.GetKeyValueGeneric<bool>("PeakFile_UseCustomDirectory");
// string peakFileCustomDirectory = Config.GetKeyValue("PeakFile_CustomDirectory");

// // Set peak file directory
// if (peakFileUseCustomDirectory.HasValue && peakFileUseCustomDirectory.Value)
// {
// // Set custom peak file directory
// PeakFileFolderPath = peakFileCustomDirectory;
// }
// else
// {
// // Set default peak file directory
// PeakFileFolderPath = applicationDataFolderPath + "\\Peak Files\\";
// }
//}
//else
//{
// // Set default peak file directory
// PeakFileFolderPath = applicationDataFolderPath + "\\Peak Files\\";
//}
}

void LoadLibrary()
Expand Down
Expand Up @@ -32,10 +32,10 @@ namespace MPfm
/// </summary>
public class ControlsSongGridViewQueryConfigurationSection
{
/// <summary>
/// Tree library node type.
/// </summary>
public TreeLibraryNodeType NodeType { get; set; }
///// <summary>
///// Tree library node type.
///// </summary>
//public TreeLibraryNodeType NodeType { get; set; }
/// <summary>
/// Audio file identifier.
/// </summary>
Expand All @@ -59,7 +59,7 @@ public class ControlsSongGridViewQueryConfigurationSection
public ControlsSongGridViewQueryConfigurationSection()
{
// Set default values
NodeType = TreeLibraryNodeType.AllSongs;
//NodeType = TreeLibraryNodeType.AllSongs;
AudioFileId = Guid.Empty;
PlaylistId = Guid.Empty;
ArtistName = string.Empty;
Expand Down
10 changes: 5 additions & 5 deletions MPfm/MPfm.Windows/Classes/Configuration/MPfmConfiguration.cs
Expand Up @@ -243,10 +243,10 @@ public void Load()
// Check if this XML element was found
if (elementSongGridViewQuery != null)
{
// Get node type
TreeLibraryNodeType nodeType;
Enum.TryParse<TreeLibraryNodeType>(XMLHelper.GetAttributeValue(elementSongGridViewQuery, "type"), out nodeType);
controlsSection.SongGridView.Query.NodeType = nodeType;
//// Get node type
//TreeLibraryNodeType nodeType;
//Enum.TryParse<TreeLibraryNodeType>(XMLHelper.GetAttributeValue(elementSongGridViewQuery, "type"), out nodeType);
//controlsSection.SongGridView.Query.NodeType = nodeType;

// Set other query properties
controlsSection.SongGridView.Query.AudioFileId = XMLHelper.GetAttributeValueGeneric<Guid>(elementSongGridViewQuery, "audioFileId");
Expand Down Expand Up @@ -468,7 +468,7 @@ public void RefreshXML()
XElement elementControlsPlaylistGridViewColumns = new XElement("columns");

// Song browser query
elementControlsSongGridViewQuery.Add(XMLHelper.NewAttribute("type", controlsSection.SongGridView.Query.NodeType.ToString()));
//elementControlsSongGridViewQuery.Add(XMLHelper.NewAttribute("type", controlsSection.SongGridView.Query..ToString()));
elementControlsSongGridViewQuery.Add(XMLHelper.NewAttribute("audioFileId", controlsSection.SongGridView.Query.AudioFileId.ToString()));
elementControlsSongGridViewQuery.Add(XMLHelper.NewAttribute("playlistId", controlsSection.SongGridView.Query.PlaylistId.ToString()));
elementControlsSongGridViewQuery.Add(XMLHelper.NewAttribute("artistName", controlsSection.SongGridView.Query.ArtistName));
Expand Down
20 changes: 10 additions & 10 deletions MPfm/MPfm.Windows/Classes/Forms/frmFirstRun.cs
Expand Up @@ -156,19 +156,19 @@ private void btnCancelWizard_Click(object sender, EventArgs e)
/// <param name="e">Event arguments</param>
private void btnNext_Click(object sender, EventArgs e)
{
// Get selected driver
DriverComboBoxItem driver = (DriverComboBoxItem)cboDrivers.SelectedItem;
//// Get selected driver
//DriverComboBoxItem driver = (DriverComboBoxItem)cboDrivers.SelectedItem;

// Get selected device
Device device = (Device)cboOutputDevices.SelectedItem;
//// Get selected device
//Device device = (Device)cboOutputDevices.SelectedItem;

// Save configuration
Main.Config.Audio.Device = device;
Main.Config.Audio.DriverType = driver.DriverType;
//// Save configuration
//Main.Config.Audio.Device = device;
//Main.Config.Audio.DriverType = driver.DriverType;

int frequency = 44100;
int.TryParse(cboSampleRate.Text, out frequency);
Main.Config.Audio.Mixer.Frequency = frequency;
//int frequency = 44100;
//int.TryParse(cboSampleRate.Text, out frequency);
//Main.Config.Audio.Mixer.Frequency = frequency;

// Close wizard
DialogResult = System.Windows.Forms.DialogResult.OK;
Expand Down

0 comments on commit bbafa06

Please sign in to comment.