2014-07-28 17:18:18 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2014-08-12 13:33:13 +00:00
|
|
|
|
using RainmeterStudio.Core.Model;
|
2014-07-28 17:18:18 +00:00
|
|
|
|
|
|
|
|
|
namespace RainmeterStudio.UI.ViewModel
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the view model of a reference
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ReferenceViewModel : INotifyPropertyChanged
|
|
|
|
|
{
|
|
|
|
|
#region Properties
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the linked reference
|
|
|
|
|
/// </summary>
|
2014-08-16 12:40:08 +00:00
|
|
|
|
public Tree<Reference> Reference { get; private set; }
|
2014-07-28 17:18:18 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the name
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-08-16 12:40:08 +00:00
|
|
|
|
return Reference.Data.Name;
|
2014-07-28 17:18:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the path
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Path
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-08-30 07:24:01 +00:00
|
|
|
|
return Reference.Data.StoragePath;
|
2014-07-28 17:18:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool _isExpanded = true;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a property indicating if the tree view item is expanded
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsExpanded
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _isExpanded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_isExpanded = value;
|
|
|
|
|
|
|
|
|
|
if (PropertyChanged != null)
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs("IsExpanded"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _isSelected;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a property indicating if the tree view item is selected
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsSelected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _isSelected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_isSelected = value;
|
|
|
|
|
|
|
|
|
|
if (PropertyChanged != null)
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs("IsSelected"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Events
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event triggered when a property is changed
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates a new instance of reference view model
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reference">Reference</param>
|
2014-08-16 12:40:08 +00:00
|
|
|
|
public ReferenceViewModel(Tree<Reference> reference)
|
2014-07-28 17:18:18 +00:00
|
|
|
|
{
|
|
|
|
|
Reference = reference;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|