src/FingersDance.ViewModel/CuttingViewModel.cs
changeset 182 25b49d4f1635
parent 167 206f07a8d887
child 190 619ca3ae13c7
equal deleted inserted replaced
179:97ef988c92c2 182:25b49d4f1635
     7 
     7 
     8 namespace FingersDance.ViewModels
     8 namespace FingersDance.ViewModels
     9 {
     9 {
    10     public class CuttingViewModel : ViewModelBase
    10     public class CuttingViewModel : ViewModelBase
    11     {
    11     {
    12         private string _title;
    12         private Cutting cut;
       
    13 
    13         private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
    14         private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
    14 
    15 
    15         public CuttingViewModel(Cutting c, float annotWidth) {
    16         public CuttingViewModel(Cutting c, float annotWidth) {
    16 
    17 
    17             this._title = c.Title;
    18             cut = c;
    18             this._annotList = new List<AnnotationViewModel>();
    19             this._annotList = new List<AnnotationViewModel>();
    19             int i = 0;
    20             int i = 0;
    20             foreach (Annotation annot in c.AnnotList)
    21             foreach (Annotation annot in c.AnnotList)
    21             {
    22             {
    22                 this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
    23                 this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
    23                 i++;
    24                 i++;
    24             }
    25             }
    25 
    26 
    26         }
    27         }
    27 
    28 
       
    29         public Cutting Cutting
       
    30         {
       
    31             get { return cut; }
       
    32             set
       
    33             {
       
    34                 cut = value;
       
    35                 base.OnPropertyChanged("Cutting");
       
    36             }
       
    37         }
       
    38 
    28         public String Title  
    39         public String Title  
    29         {
    40         {
    30             get { return _title; }
    41             get { return cut.Title; }
    31             set
    42             set
    32             {
    43             {
    33                 if (value == _title || String.IsNullOrEmpty(value))
    44                 if (value == cut.Title || String.IsNullOrEmpty(value))
    34                     return;
    45                     return;
    35                 _title = value;
    46                 cut.Title = value;
    36                 base.OnPropertyChanged("Title");
    47                 base.OnPropertyChanged("Title");
    37             }
    48             }
    38         }
    49         }
    39         public List<AnnotationViewModel> AnnotList
    50         public List<AnnotationViewModel> AnnotList
    40         {
    51         {