Skip to content

Commit

Permalink
Windows: Added WindowsNavigationManager. The app startup now uses the…
Browse files Browse the repository at this point in the history
… navigation manager to create views. This is the beginning of the Windows UI refactoring!

Related to issue #422.
  • Loading branch information
ycastonguay committed Jul 11, 2013
1 parent cc140c2 commit e7bd8f4
Show file tree
Hide file tree
Showing 9 changed files with 771 additions and 537 deletions.
55 changes: 55 additions & 0 deletions MPfm/MPfm.Windows/Classes/Forms/BaseForm.cs
@@ -0,0 +1,55 @@
// 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 <http://www.gnu.org/licenses/>.

using System;
using MPfm.MVP.Views;

namespace MPfm.Windows.Classes.Forms
{
public class BaseForm : MPfm.WindowsControls.Form, IBaseView
{
protected Action<IBaseView> OnViewReady { get; set; }

public BaseForm(Action<IBaseView> onViewReady)
{
OnViewReady = onViewReady;
}

protected override void OnLoad(EventArgs e)
{
Console.WriteLine("BaseForm - OnLoad");
base.OnLoad(e);
}

protected void ViewIsReady()
{
Console.WriteLine("BaseForm - ViewIsReady");

// Bind presenter to view
OnViewReady(this);

// Display window
Show();
}

public Action<IBaseView> OnViewDestroy { get; set; }
public void ShowView(bool shown)
{
// Never called on Windows...
}
}
}
@@ -1,129 +1,129 @@
// 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 <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Text;

namespace MPfm
{
/// <summary>
/// Defines the type of query for the song browser.
/// </summary>
public enum SongQueryType
{
/// <summary>
/// No query.
/// </summary>
None = 0,
/// <summary>
/// Artist query.
/// </summary>
Artist = 1,
/// <summary>
/// Album query.
/// </summary>
Album = 2,
/// <summary>
/// Playlist query.
/// </summary>
Playlist = 3,
/// <summary>
/// All query.
/// </summary>
All = 4
}

/// <summary>
/// Query definition for the song browser, including metadata.
/// </summary>
public class SongQuery
{
/// <summary>
/// Defines the type of query.
/// </summary>
public SongQueryType Type { get; set; }

/// <summary>
/// Defines the artist name for the query.
/// </summary>
public string ArtistName { get; set; }

/// <summary>
/// Defines the album title for the query.
/// </summary>
public string AlbumTitle { get; set; }

/// <summary>
/// Defines the Playlist identifier for the query.
/// </summary>
public Guid PlaylistId { get; set; }

/// <summary>
/// Default constructor for SongQuery.
/// Returns all songs from the database.
/// </summary>
public SongQuery()
{
Type = SongQueryType.All;
}

/// <summary>
/// Constructor for SongQuery that requires the song query type.
/// </summary>
/// <param name="type">Song Query Type</param>
public SongQuery(SongQueryType type)
{
Type = type;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Artist
/// using the artist name passed in parameter.
/// </summary>
/// <param name="artistName">Artist Name</param>
public SongQuery(string artistName)
{
Type = SongQueryType.Artist;
ArtistName = artistName;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Artist/Album
/// using the artist name and album title passed in parameter.
/// </summary>
/// <param name="artistName">Artist Name</param>
/// <param name="albumTitle">Album Title</param>
public SongQuery(string artistName, string albumTitle)
{
Type = SongQueryType.Album;
ArtistName = artistName;
AlbumTitle = albumTitle;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Playlist using
/// the playlist identifier passed in parameter.
/// </summary>
/// <param name="playlistId">Playlist Identifier</param>
public SongQuery(Guid playlistId)
{
Type = SongQueryType.Playlist;
PlaylistId = playlistId;
}
}
}
// 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 <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Text;

namespace MPfm
{
/// <summary>
/// Defines the type of query for the song browser.
/// </summary>
public enum SongQueryType
{
/// <summary>
/// No query.
/// </summary>
None = 0,
/// <summary>
/// Artist query.
/// </summary>
Artist = 1,
/// <summary>
/// Album query.
/// </summary>
Album = 2,
/// <summary>
/// Playlist query.
/// </summary>
Playlist = 3,
/// <summary>
/// All query.
/// </summary>
All = 4
}

/// <summary>
/// Query definition for the song browser, including metadata.
/// </summary>
public class SongQuery
{
/// <summary>
/// Defines the type of query.
/// </summary>
public SongQueryType Type { get; set; }

/// <summary>
/// Defines the artist name for the query.
/// </summary>
public string ArtistName { get; set; }

/// <summary>
/// Defines the album title for the query.
/// </summary>
public string AlbumTitle { get; set; }

/// <summary>
/// Defines the Playlist identifier for the query.
/// </summary>
public Guid PlaylistId { get; set; }

/// <summary>
/// Default constructor for SongQuery.
/// Returns all songs from the database.
/// </summary>
public SongQuery()
{
Type = SongQueryType.All;
}

/// <summary>
/// Constructor for SongQuery that requires the song query type.
/// </summary>
/// <param name="type">Song Query Type</param>
public SongQuery(SongQueryType type)
{
Type = type;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Artist
/// using the artist name passed in parameter.
/// </summary>
/// <param name="artistName">Artist Name</param>
public SongQuery(string artistName)
{
Type = SongQueryType.Artist;
ArtistName = artistName;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Artist/Album
/// using the artist name and album title passed in parameter.
/// </summary>
/// <param name="artistName">Artist Name</param>
/// <param name="albumTitle">Album Title</param>
public SongQuery(string artistName, string albumTitle)
{
Type = SongQueryType.Album;
ArtistName = artistName;
AlbumTitle = albumTitle;
}

/// <summary>
/// Constructor for SongQuery that defines the query as Playlist using
/// the playlist identifier passed in parameter.
/// </summary>
/// <param name="playlistId">Playlist Identifier</param>
public SongQuery(Guid playlistId)
{
Type = SongQueryType.Playlist;
PlaylistId = playlistId;
}
}
}
26 changes: 26 additions & 0 deletions MPfm/MPfm.Windows/Classes/Navigation/WindowsNavigationManager.cs
@@ -0,0 +1,26 @@
// 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 <http://www.gnu.org/licenses/>.

using MPfm.MVP.Navigation;

namespace MPfm.Windows.Classes.Navigation
{
public class WindowsNavigationManager : NavigationManager
{

}
}
@@ -0,0 +1,44 @@
// 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 <http://www.gnu.org/licenses/>.

using MPfm.Library;
using MPfm.Library.Objects;

namespace MPfm.Windows.Classes.Specifications
{
/// <summary>
/// Device specifications for Windows. Used for identifying sync devices.
/// </summary>
public class WindowsSyncDeviceSpecifications : ISyncDeviceSpecifications
{
public SyncDeviceType GetDeviceType()
{
return SyncDeviceType.Windows;
}

string _deviceName = string.Empty;
public string GetDeviceName()
{
return _deviceName;
}

public long GetFreeSpace()
{
return 0;
}
}
}

0 comments on commit e7bd8f4

Please sign in to comment.