using MECF.Framework.Common.DBCore;
using System;
using System.Collections.Generic;
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;

namespace CyberX8_Themes.UserControls
{
    /// <summary>
    /// ExhaustPipe.xaml 的交互逻辑
    /// </summary>
    public partial class ExhaustPipe : UserControl
    {
        public ExhaustPipe()
        {
            InitializeComponent();
        }

        public static readonly DependencyProperty FCornerRadiusProperty = DependencyProperty.Register(
           "FCornerRadius", typeof(CornerRadius), typeof(ExhaustPipe),
           new FrameworkPropertyMetadata(new CornerRadius(2), FrameworkPropertyMetadataOptions.AffectsRender));


        public static readonly DependencyProperty IsFlowingProperty = DependencyProperty.Register(
            "IsFlowing", typeof(bool), typeof(ExhaustPipe),
            new FrameworkPropertyMetadata(false, new PropertyChangedCallback(ItemSourceChanged)));

        public static readonly DependencyProperty FlowColorProperty = DependencyProperty.Register(
           "FlowColor", typeof(string), typeof(ExhaustPipe),
           new FrameworkPropertyMetadata("Gray", FrameworkPropertyMetadataOptions.AffectsRender));

        public static readonly DependencyProperty RotateTransformValueProperty = DependencyProperty.Register(
         "RotateTransformValue", typeof(int), typeof(ExhaustPipe));

        public static readonly DependencyProperty IsReverseProperty = DependencyProperty.Register(
           "IsReverse", typeof(bool), typeof(ExhaustPipe),
           new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));

        public int RotateTransformValue
        {
            get { return (int)this.GetValue(RotateTransformValueProperty); }
            set { this.SetValue(RotateTransformValueProperty, value); }
        }

        public bool IsFlowing
        {
            get { return (bool)this.GetValue(IsFlowingProperty); }
            set { this.SetValue(IsFlowingProperty, value); }
        }

        public string FlowColor
        {
            get { return (string)this.GetValue(FlowColorProperty); }
            set { this.SetValue(FlowColorProperty, value); }
        }
        public bool IsReverse
        {
            get { return (bool)this.GetValue(IsReverseProperty); }
            set { this.SetValue(IsReverseProperty, value); }
        }
        public CornerRadius FCornerRadius
        {
            get { return (CornerRadius)this.GetValue(FCornerRadiusProperty); }
            set { this.SetValue(FCornerRadiusProperty, value); }
        }

        public bool IsVertical { get; set; }

        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
        }

        private static void ItemSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != null && (bool)e.NewValue == true)
            {
                d.SetValue(FlowColorProperty, "Pink");
            }
            else
            {
                d.SetValue(FlowColorProperty, "Gray");
            }

        }
    }
}