aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Video/Resolution.cs
blob: 994c02edfd8ea831453d7a97734762d9ef75a6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Video.DirectCapture
{
    /// <summary>
    /// Holds a resolution (width and height) for a DeviceCapture object.
    /// </summary>
    public class Resolution : INotifyPropertyChanged
    {
        /// <summary>
        /// Initializes a new instance of Resolution.
        /// </summary>
        public Resolution()
        {

        }

        /// <summary>
        /// Initializes a new instance of Resoultion.
        /// </summary>
        /// <param name="width">desired frame width.</param>
        /// <param name="height">desired frame height.</param>
        public Resolution(int width, int height)
            : this()
        {
            Width = width;
            Height = height;
        }

        private int _width;

        /// <summary>
        /// Gets or sets the current frame width.
        /// </summary>
        public int Width
        {
            get { return _width; }
            set { _width = value; RaisePropertyChanged("Width"); }
        }

        private int _height;

        /// <summary>
        /// Gets or sets the current frame height.
        /// </summary>
        public int Height
        {
            get { return _height; }
            set { _height = value; RaisePropertyChanged("Height"); }
        }


        /// <summary>
        /// Returns a string representation of the current resolution.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return Width + "x" + Height;
        }

        private void RaisePropertyChanged(String propName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}