using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SciChart.Charting.Visuals.Axes;
using SciChart.Charting.Visuals.RenderableSeries;
using SciChart.Core.Framework;
using SciChart.Data.Model;
namespace MECF.Framework.UI.Client.ClientBase.UserControls
{
    /// 
    /// DataViewChart.xaml 的交互逻辑
    /// 
    public partial class DataViewChart : UserControl
    {
        public DataViewChart()
        {
            InitializeComponent();
        }
        #region Dependency Properties
        public static readonly DependencyProperty RenderableSeriesProperty = DependencyProperty.Register(
            "RenderableSeries", typeof(ObservableCollection), typeof(DataViewChart), new PropertyMetadata(default(ObservableCollection)));
        public ObservableCollection RenderableSeries
        {
            get => (ObservableCollection)GetValue(RenderableSeriesProperty);
            set => SetValue(RenderableSeriesProperty, value);
        }
        public static readonly DependencyProperty AutoRangeProperty = DependencyProperty.Register(
            "AutoRange", typeof(AutoRange), typeof(DataViewChart), new PropertyMetadata(default(AutoRange)));
        public AutoRange AutoRange
        {
            get => (AutoRange)GetValue(AutoRangeProperty);
            set => SetValue(AutoRangeProperty, value);
        }
        public static readonly DependencyProperty VisibleRangeTimeProperty = DependencyProperty.Register(
            "VisibleRangeTime", typeof(IRange), typeof(DataViewChart), new PropertyMetadata(default(IRange)));
        public IRange VisibleRangeTime
        {
            get => (IRange)GetValue(VisibleRangeTimeProperty);
            set => SetValue(VisibleRangeTimeProperty, value);
        }
        public static readonly DependencyProperty VisibleRangeValueProperty = DependencyProperty.Register(
            "VisibleRangeValue", typeof(IRange), typeof(DataViewChart), new PropertyMetadata(default(IRange)));
        public IRange VisibleRangeValue
        {
            get => (IRange)GetValue(VisibleRangeValueProperty);
            set => SetValue(VisibleRangeValueProperty, value);
        }
        #endregion
        #region Methods
        public void ZoomExtents()
        {
            sciChart.ZoomExtents();
        }
        public IUpdateSuspender SuspendSuspendUpdates()
        {
            return sciChart.SuspendUpdates();
        }
        #endregion
        #region Events
        private void BtnFixCurveToScreen_OnPreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            sciChart.ZoomExtents();
        }
        #endregion
    }
}