2013-06-14 17:44:55 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
2013-06-15 16:17:37 +01:00
|
|
|
|
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
|
2013-06-15 16:26:30 +01:00
|
|
|
|
using IF.Lastfm.Demo.Apollo.ViewModels.TrackApi;
|
2013-06-14 17:44:55 +01:00
|
|
|
|
using Microsoft.Phone.Controls;
|
|
|
|
|
using Microsoft.Phone.Shell;
|
|
|
|
|
|
2013-06-15 16:26:30 +01:00
|
|
|
|
namespace IF.Lastfm.Demo.Apollo.Pages.TrackApi
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
|
|
|
|
public partial class Scrobbling : PhoneApplicationPage
|
|
|
|
|
{
|
|
|
|
|
private ScrobblingTestViewModel _viewModel;
|
|
|
|
|
|
|
|
|
|
public Scrobbling()
|
|
|
|
|
{
|
|
|
|
|
_viewModel = new ScrobblingTestViewModel();
|
|
|
|
|
|
|
|
|
|
DataContext = _viewModel;
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
MultiApplicationBar.SelectedIndex = 0;
|
|
|
|
|
|
2013-06-15 16:17:37 +01:00
|
|
|
|
_viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
2013-06-14 17:44:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-15 16:17:37 +01:00
|
|
|
|
private void OnViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
if (e.PropertyName == "InProgress")
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
if (_viewModel.InProgress)
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
SystemTray.ProgressIndicator = new ProgressIndicator
|
|
|
|
|
{
|
|
|
|
|
IsVisible = _viewModel.InProgress,
|
|
|
|
|
IsIndeterminate = _viewModel.InProgress
|
|
|
|
|
};
|
2013-06-14 17:44:55 +01:00
|
|
|
|
}
|
2013-06-15 16:17:37 +01:00
|
|
|
|
else
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
SystemTray.ProgressIndicator = null;
|
2013-06-14 17:44:55 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-15 16:17:37 +01:00
|
|
|
|
private void OnDoneClick(object sender, EventArgs e)
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
if (!_viewModel.InProgress)
|
2013-06-14 17:44:55 +01:00
|
|
|
|
{
|
2013-06-15 16:17:37 +01:00
|
|
|
|
_viewModel.Scrobble().AsAsyncAction();
|
2013-06-14 17:44:55 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|