src/FingersDance.ViewModel/CuttingViewModel.cs
changeset 143 9f157d9c725b
parent 69 a4c44555f205
child 146 dd8ed4d3beb6
equal deleted inserted replaced
142:3d66ca73df55 143:9f157d9c725b
    10     public class CuttingViewModel : ViewModelBase
    10     public class CuttingViewModel : ViewModelBase
    11     {
    11     {
    12         private string _title;
    12         private string _title;
    13         private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
    13         private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
    14 
    14 
    15         public CuttingViewModel(Cutting c) {
    15         public CuttingViewModel(Cutting c, float annotWidth) {
    16 
    16 
    17             this._title = c.Title;
    17             this._title = c.Title;
    18             this._annotList = new List<AnnotationViewModel>();
    18             this._annotList = new List<AnnotationViewModel>();
       
    19             int i = 0;
    19             foreach (Annotation annot in c.AnnotList)
    20             foreach (Annotation annot in c.AnnotList)
    20                 this._annotList.Add(new AnnotationViewModel(annot));
    21             {
       
    22                 this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
       
    23                 i++;
       
    24             }
    21 
    25 
    22         }
    26         }
    23 
    27 
    24         public String Title
    28         public String Title  
    25         {
    29         {
    26             get { return _title; }
    30             get { return _title; }
    27             set
    31             set
    28             {
    32             {
    29                 if (value == _title || String.IsNullOrEmpty(value))
    33                 if (value == _title || String.IsNullOrEmpty(value))
    39             {
    43             {
    40                 _annotList = value;
    44                 _annotList = value;
    41                 base.OnPropertyChanged("AnnotList");
    45                 base.OnPropertyChanged("AnnotList");
    42             }
    46             }
    43         }
    47         }
       
    48 
       
    49         public void setListFromAnnotations(List<Annotation> annotList, float annotWidth)
       
    50         {
       
    51 
       
    52             this._annotList = new List<AnnotationViewModel>();
       
    53             int i = 0;
       
    54             foreach (Annotation annot in annotList)
       
    55             {
       
    56                 this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
       
    57                 i++;
       
    58             }
       
    59 
       
    60         }
    44     }
    61     }
    45 }
    62 }