using SurfacePlot3D.Common;
using SurfacePlot3D.Statics;
using System;
using System.Windows.Input;
using System.Xml.Serialization;

namespace SurfacePlot3D.Members
{
    public class ResolvedGeometryMod : CustomBindableBase
    {
        #region Private Variables

        private int _slice = 0;
        private int _sequence = 0;

        private Double _x = 0.0D;
        private Double _y = 0.0D;
        private Double _z = 0.0D;


        #endregion

        #region Public Clr Properties

        public int Sequence { get { return _sequence; } set { SetProperty(ref _sequence, value); } }
        public int Slice { get { return _slice; } set { SetProperty(ref _slice, value); } }

        public Double X { get { return _x; } set { SetProperty(ref _x, value); } }
        public Double Y { get { return _y; } set { SetProperty(ref _y, value); } }
        public Double Z { get { return _z; } set { SetProperty(ref _z, value); } }

        #endregion

        private ICommand _decreaseXCommandIc = null;
        private ICommand _decreaseYCommandIc = null;
        private ICommand _decreaseZCommandIc = null;

        [XmlIgnore] public ICommand DecreaseXCommandIc => _decreaseXCommandIc ?? (_decreaseXCommandIc = new RelayCommand<Object>(DecreaseXCommandIcExecuted));
        [XmlIgnore] public ICommand DecreaseYCommandIc => _decreaseYCommandIc ?? (_decreaseYCommandIc = new RelayCommand<Object>(DecreaseYCommandIcExecuted));
        [XmlIgnore] public ICommand DecreaseZCommandIc => _decreaseZCommandIc ?? (_decreaseZCommandIc = new RelayCommand<Object>(DecreaseZCommandIcExecuted));

        public void DecreaseXCommandIcExecuted(Object obj) { UIServices.Busy(); X -= (Double)obj; }
        public void DecreaseYCommandIcExecuted(Object obj) { UIServices.Busy(); Y -= (Double)obj; }
        public void DecreaseZCommandIcExecuted(Object obj) { UIServices.Busy(); Z -= (Double)obj; }



        private ICommand _increaseXCommandIc = null;
        private ICommand _increaseYCommandIc = null;
        private ICommand _increaseZCommandIc = null;

        [XmlIgnore] public ICommand IncreaseXCommandIc => _increaseXCommandIc ?? (_increaseXCommandIc = new RelayCommand<Object>(IncreaseXCommandIcExecuted));
        [XmlIgnore] public ICommand IncreaseYCommandIc => _increaseYCommandIc ?? (_increaseYCommandIc = new RelayCommand<Object>(IncreaseYCommandIcExecuted));
        [XmlIgnore] public ICommand IncreaseZCommandIc => _increaseZCommandIc ?? (_increaseZCommandIc = new RelayCommand<Object>(IncreaseZCommandIcExecuted));

        public void IncreaseXCommandIcExecuted(Object obj) { UIServices.Busy(); X += (Double)obj; }
        public void IncreaseYCommandIcExecuted(Object obj) { UIServices.Busy(); Y += (Double)obj; }
        public void IncreaseZCommandIcExecuted(Object obj) { UIServices.Busy(); Z += (Double)obj; }

    }
}