Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WPF: Sync window is now completed. Library Browser in Main window wor…
…ks (missing contextual menus though).
- Loading branch information
1 parent
e70d0cb
commit d3934d9
Showing
20 changed files
with
582 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
|
||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace MPfm.WPF.Classes.Controls | ||
{ | ||
/// <summary> | ||
/// http://stackoverflow.com/questions/15640263/how-to-add-a-before-expanding-event-to-the-wpf-treeview-without-using-threads | ||
/// </summary> | ||
public class MPfmTreeViewItem : TreeViewItem | ||
{ | ||
public bool IsDummyNode { get; set; } | ||
|
||
public static readonly RoutedEvent CollapsingEvent = EventManager.RegisterRoutedEvent("Collapsing", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MPfmTreeViewItem)); | ||
public static readonly RoutedEvent ExpandingEvent = EventManager.RegisterRoutedEvent("Expanding", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MPfmTreeViewItem)); | ||
|
||
public event RoutedEventHandler Collapsing | ||
{ | ||
add { AddHandler(CollapsingEvent, value); } | ||
remove { RemoveHandler(CollapsingEvent, value); } | ||
} | ||
|
||
public event RoutedEventHandler Expanding | ||
{ | ||
add { AddHandler(ExpandingEvent, value); } | ||
remove { RemoveHandler(ExpandingEvent, value); } | ||
} | ||
|
||
protected override void OnExpanded(RoutedEventArgs e) | ||
{ | ||
OnExpanding(new RoutedEventArgs(ExpandingEvent, this)); | ||
base.OnExpanded(e); | ||
} | ||
|
||
protected override void OnCollapsed(RoutedEventArgs e) | ||
{ | ||
OnCollapsing(new RoutedEventArgs(CollapsingEvent, this)); | ||
base.OnCollapsed(e); | ||
} | ||
|
||
protected virtual void OnCollapsing(RoutedEventArgs e) | ||
{ | ||
RaiseEvent(e); | ||
} | ||
|
||
protected virtual void OnExpanding(RoutedEventArgs e) | ||
{ | ||
RaiseEvent(e); | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
MPfm/MPfm.WPF/Classes/Converters/LibraryBrowserImagePathConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// 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.Windows.Data; | ||
using MPfm.MVP.Models; | ||
|
||
namespace MPfm.WPF.Classes.Converters | ||
{ | ||
public class LibraryBrowserImagePathConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
var entityType = (LibraryBrowserEntityType) value; | ||
switch (entityType) | ||
{ | ||
case LibraryBrowserEntityType.AllSongs: | ||
return "/Resources/Images/Icons/windows.png"; | ||
break; | ||
case LibraryBrowserEntityType.Artists: | ||
return "/Resources/Images/Icons/user.png"; | ||
break; | ||
case LibraryBrowserEntityType.Albums: | ||
return "/Resources/Images/Icons/vinyl.png"; | ||
break; | ||
case LibraryBrowserEntityType.Artist: | ||
return "/Resources/Images/Icons/user.png"; | ||
break; | ||
case LibraryBrowserEntityType.ArtistAlbum: | ||
return "/Resources/Images/Icons/vinyl.png"; | ||
break; | ||
case LibraryBrowserEntityType.Album: | ||
return "/Resources/Images/Icons/vinyl.png"; | ||
break; | ||
case LibraryBrowserEntityType.Song: | ||
break; | ||
case LibraryBrowserEntityType.Dummy: | ||
break; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return ""; | ||
} | ||
|
||
//private string GetImageName(string text) | ||
//{ | ||
// string name = ""; | ||
// name = text.ToLower() + ".png"; | ||
// return name; | ||
//} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.