src/FingersDance.Data/Annotation.cs
author cavaliet
Fri, 16 Oct 2009 15:56:09 +0200
changeset 160 e940ca798fe3
parent 150 569925b65604
child 182 25b49d4f1635
permissions -rw-r--r--
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     1
using System;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     2
using System.Collections.Generic;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     3
using System.Linq;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     4
using System.Text;
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
     5
using System.Windows.Media;
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     6
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     7
namespace FingersDance.Data
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
     8
{
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
     9
    public class AnnotationAddedEventArg : EventArgs
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    10
    {
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    11
        private float _tcBegin;
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    12
        private float _dur;
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    13
        private String _gestureType;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    14
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    15
        public float TcBegin
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    16
        {
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    17
            get { return this._tcBegin; }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    18
        }
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    19
        public float Dur
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    20
        {
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    21
            get { return this._dur; }
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    22
        }
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    23
        public String GestureType
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    24
        {
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    25
            get { return this._gestureType; }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    26
        }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    27
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    28
        public AnnotationAddedEventArg(float tcBegin, float dur, String gestureType)
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    29
        {
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    30
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    31
            this._tcBegin = tcBegin;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    32
            this._dur = dur;
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    33
            this._gestureType = gestureType;
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    34
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    35
        }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    36
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    37
    }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    38
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    39
    public class Annotation
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    40
    {
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    41
        private float _tcBegin;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    42
        private float _dur;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    43
        private string _gestureType;
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
    44
        private Color _color;
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    45
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    46
        //public event EventHandler<AnnotationAddedEventArg> AnnotationAdded;
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    47
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
    48
        public Annotation(float tcBeginPar, float durPar, string gesturePar, Color colorPar)
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    49
        {
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    50
            this._tcBegin = tcBeginPar;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    51
            this._dur = durPar;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    52
            this._gestureType = gesturePar;
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    53
            this._color = colorPar;
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    54
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    55
            //AnnotationAdded(this, new AnnotationAddedEventArg(_tcBegin, _dur, _gestureType));
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    56
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    57
        }
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    58
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    59
        public float TcBegin
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    60
        {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    61
            get { return _tcBegin; }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    62
            set
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    63
            {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    64
                if (value == _tcBegin || float.IsNaN(value))
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    65
                    return;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    66
                _tcBegin = value;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    67
            }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    68
        }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    69
        public float Dur
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    70
        {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    71
            get { return _dur; }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    72
            set
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    73
            {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    74
                if (value == _dur || float.IsNaN(value))
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    75
                    return;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    76
                _dur = value;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    77
            }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    78
        }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    79
        public String GestureType
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    80
        {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    81
            get { return _gestureType; }
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    82
            set
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    83
            {
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    84
                if (value == _gestureType || String.IsNullOrEmpty(value))
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    85
                    return;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    86
                _gestureType = value;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 55
diff changeset
    87
            }
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
    88
        }
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
    89
        public Color Color
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    90
        {
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    91
            get { return _color; }
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    92
            set
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    93
            {
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    94
                if (value == _color)
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    95
                    return;
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    96
                _color = value;
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    97
            }
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    98
        }
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 69
diff changeset
    99
55
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
   100
    }
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
   101
1ec0ef228158 data, viewmodel and view added
cavaliet
parents:
diff changeset
   102
}