|
namespace RegiRide.ViewModels
{
using System.ComponentModel;
using System.Windows;
using DropNet;
using GalaSoft.MvvmLight;
using RegiRide.Navigation;
using RegiRide.Services.Interface;
using RegiRide.Utils;
public class DropboxViewModel : ViewModelBase, INavigable
{
private readonly DropNetClient dropNetClient;
private readonly ISettingsHelper settingsHelper;
private readonly RegiRideSettingsManager regiRideSettingsManager;
public DropboxViewModel(DropNetClient dropNetClient, ISettingsHelper settingsHelper, RegiRideSettingsManager regiRideSettingsManager)
{
this.dropNetClient = dropNetClient;
this.settingsHelper = settingsHelper;
this.regiRideSettingsManager = regiRideSettingsManager;
}
public new event PropertyChangedEventHandler PropertyChanged;
public INavigationService NavigationService { get; set; }
public DropNetClient DropNetClient
{
get
{
return dropNetClient;
}
}
public void AuthenticatedSuccessfully()
{
regiRideSettingsManager.Authenticated = true;
MessengerInstance.Send(true);
NavigationService.Back();
}
public void StoreToken(string token)
{
settingsHelper.UpdateSetting(Constants.Settings.DropboxUserTokenKey, token);
}
public void StoreSecret(string secret)
{
settingsHelper.UpdateSetting(Constants.Settings.DropboxUserSecretKey, secret);
}
protected void NotifyPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
{
Deployment.Current.Dispatcher.BeginInvoke(() => this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)));
}
}
}
}
|
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.
Patrick Kalkman is a senior Software Architect with more than 20 years professional development experience. He works for
SimpleTechture where he helps teams develop state of the art web applications.
Patrick enjoys writing his
blog. It discusses agile software development. Patrick can be reached at patrick@simpletechture.nl.
Published Windows 8 apps:
Published Windows Phone apps:
Awards:
Best Mobile article of March 2012
Best Mobile article of June 2012