aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs
blob: 736bff5a2b109ea06b3e5bed9419d4c861f7c8c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace RealTimeGraphX.WPF.Components
{
    /// <summary>
    /// Represents a graph axis data point tick value wrapper.
    /// </summary>
    /// <seealso cref="RealTimeGraphX.GraphObject" />
    public class GraphAxisTickData : DependencyObject, INotifyPropertyChanged
    {
        /// <summary>
        /// Gets or sets a value indicating whether this tick is the first tick.
        /// </summary>
        public bool IsFirst
        {
            get { return (bool)GetValue(IsFirstProperty); }
            set { SetValue(IsFirstProperty, value); }
        }
        public static readonly DependencyProperty IsFirstProperty =
            DependencyProperty.Register("IsFirst", typeof(bool), typeof(GraphAxisTickData), new PropertyMetadata(false));

        /// <summary>
        /// Gets or sets a value indicating whether this tick is the last tick.
        /// </summary>
        public bool IsLast
        {
            get { return (bool)GetValue(IsLastProperty); }
            set { SetValue(IsLastProperty, value); }
        }
        public static readonly DependencyProperty IsLastProperty =
            DependencyProperty.Register("IsLast", typeof(bool), typeof(GraphAxisTickData), new PropertyMetadata(false));

        /// <summary>
        /// Gets or sets a value indicating whether this tick is not the first or last.
        /// </summary>
        public bool IsCenter
        {
            get { return !IsFirst && !IsLast; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether this tick index is even.
        /// </summary>
        public bool IsEven
        {
            get { return (bool)GetValue(IsEvenProperty); }
            set { SetValue(IsEvenProperty, value); }
        }
        public static readonly DependencyProperty IsEvenProperty =
            DependencyProperty.Register("IsEven", typeof(bool), typeof(GraphAxisTickData), new PropertyMetadata(false));

        /// <summary>
        /// Gets a value indicating whether this tick index is odd.
        /// </summary>
        public bool IsOdd
        {
            get { return !IsEven; }
        }

        ///// <summary>
        ///// Gets or sets the data point.
        ///// </summary>
        //public IGraphDataPoint Data
        //{
        //    get { return (IGraphDataPoint)GetValue(DataProperty); }
        //    set { SetValue(DataProperty, value); }
        //}
        //public static readonly DependencyProperty DataProperty =
        //    DependencyProperty.Register("Data", typeof(IGraphDataPoint), typeof(GraphAxisTickData), new PropertyMetadata(null));

        private IGraphDataPoint _data;

        public IGraphDataPoint Data
        {
            get { return _data; }
            set { _data = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Data")); }
        }


        /// <summary>
        /// Gets the <see cref="Data">Data Point</see> value.
        /// </summary>
        public object Value
        {
            get
            {
                return Data != null ? Data.GetValue() : null;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}