using GalaSoft.MvvmLight;
using Editor.Model;
namespace Editor.ViewModel
{
///
/// This class contains properties that the main View can data bind to.
///
/// Use the mvvminpc snippet to add bindable properties to this ViewModel.
///
///
/// See http://www.galasoft.ch/mvvm/getstarted
///
///
public class MainViewModel : ViewModelBase
{
private readonly IDataService dataService;
///
/// The property's name.
///
public const string WelcomeTitlePropertyName = "WelcomeTitle";
private string welcomeTitle = string.Empty;
///
/// Gets the WelcomeTitle property.
/// Changes to that property's value raise the PropertyChanged event.
///
public string WelcomeTitle
{
get
{
return welcomeTitle;
}
set
{
if (welcomeTitle == value)
{
return;
}
welcomeTitle = value;
RaisePropertyChanged(WelcomeTitlePropertyName);
}
}
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel(IDataService dataService)
{
this.dataService = dataService;
this.dataService.GetData(
(item, error) =>
{
if (error != null)
{
// Report error here
return;
}
WelcomeTitle = item.Title;
});
}
////public override void Cleanup()
////{
//// // Clean up if needed
//// base.Cleanup();
////}
}
}