- createdb.zip
- sonic.zip
- Sonic
- Sonic.sln
- Sonic
- App.config
- App.xaml
- App.xaml.cs
- Application.ico
- Attributes
- bin
- Debug
- Configuration
- EventArgs
- ExtensionMethods
- Images
- header.png
- Mp3.png
- NoImage.png
- SonicLogo.png
- target.png
- Lib
- GAPI.dll
- UltraID3Lib.dll
- LINQ
- Misc
- MP3TagGenres.txt
- obj
- Debug
- Refactor
- Resources
- TempPE
- UserControls
- AlbumView3D
- AlphabetPie
- Circular Progress Bar
- Fancy Button
- GenrePicker
- MatchedAlbumsViewer
- MatchedFilesViewer
- MatchedMusicViewer
- Views
- Properties
- Resources
- Sonic.csproj
- UserControls
- Circular Progress Bar
- Fancy Button
- Friction Scroll Viewer
- Value Converters
- ViewModels
- Views
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace Sonic
{
public delegate void AlbumClickedEventHandler(object sender,
AlbumClickedEventArgs e);
/// <summary>
/// Interaction logic for AlbumView.xaml
/// </summary>
public partial class AlbumView : UserControl
{
public AlbumView()
{
InitializeComponent();
this.DataContextChanged+=AlbumView_DataContextChanged;
}
#region Events
/// <summary>
/// Raised when Album item clicked
/// </summary>
public static readonly RoutedEvent AlbumClickedEvent =
EventManager.RegisterRoutedEvent(
"AlbumClicked", RoutingStrategy.Bubble,
typeof(AlbumClickedEventHandler),
typeof(AlbumView));
public event AlbumClickedEventHandler AlbumClicked
{
add { AddHandler(AlbumClickedEvent, value); }
remove { RemoveHandler(AlbumClickedEvent, value); }
}
#endregion
#region Private methods
/// <summary>
/// Hook up the associated AlbumOfMP3ViewModel
/// AnimationStartTimerExpiredEvent event
/// </summary>
private void AlbumView_DataContextChanged(object sender,
DependencyPropertyChangedEventArgs e)
{
AlbumOfMP3ViewModel viewModel = e.NewValue as AlbumOfMP3ViewModel;
if (viewModel != null)
{
viewModel.StartDelayedAnimationTimer();
viewModel.AnimationStartTimerExpiredEvent +=
ViewModel_AnimationStartTimerExpiredEvent;
}
}
/// <summary>
/// Start the animation Storyboard after the associated AlbumOfMP3ViewModel
/// timer expires and raises its AnimationStartTimerExpiredEvent event
/// </summary>
private void ViewModel_AnimationStartTimerExpiredEvent(object sender, EventArgs e)
{
//As the call that populated this control was on a different thread,
//we need to do some threading trickery
this.Dispatcher.InvokeIfRequired(() =>
{
Storyboard sb = this.TryFindResource("OnLoaded1") as Storyboard;
if (sb != null)
{
sb.Begin(this.btn);
}
}, DispatcherPriority.Normal);
}
private void btn_Click(object sender, RoutedEventArgs e)
{
//raise our custom AlbumClickedEvent event
AlbumClickedEventArgs args = new
AlbumClickedEventArgs(AlbumClickedEvent,
this.DataContext as AlbumOfMP3ViewModel);
RaiseEvent(args);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
Both of these at Sussex University UK.
Award(s)
I am lucky enough to have won a few awards for Zany Crazy code articles over the years
- Microsoft C# MVP 2016
- Codeproject MVP 2016
- Microsoft C# MVP 2015
- Codeproject MVP 2015
- Microsoft C# MVP 2014
- Codeproject MVP 2014
- Microsoft C# MVP 2013
- Codeproject MVP 2013
- Microsoft C# MVP 2012
- Codeproject MVP 2012
- Microsoft C# MVP 2011
- Codeproject MVP 2011
- Microsoft C# MVP 2010
- Codeproject MVP 2010
- Microsoft C# MVP 2009
- Codeproject MVP 2009
- Microsoft C# MVP 2008
- Codeproject MVP 2008
- And numerous codeproject awards which you can see over at my blog