using SurfacePlot3D.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Xml.Serialization;

namespace SurfacePlot3D.MeshGenerators
{
    public partial class BoxMeshGenerator : MeshGeneratorBase
    {
        private const Double Inch = .083333;


        private ICommand _widthToHeightCommandIc; [XmlIgnore] public ICommand WidthToHeightCommandIc => _widthToHeightCommandIc ?? (_widthToHeightCommandIc = new RelayCommand<Object>(WidthToHeightCommandIcExecuted));

        public void WidthToHeightCommandIcExecuted(Object sender) { var temp = Width; Width = Height; Height = temp; } //RebuildMesh();

        private ICommand _depthToHeightCommandIc; [XmlIgnore] public ICommand DepthToHeightCommandIc => _depthToHeightCommandIc ?? (_depthToHeightCommandIc = new RelayCommand<Object>(DepthToHeightCommandIcExecuted));

        public void DepthToHeightCommandIcExecuted(Object sender) { var temp = Depth; Depth = Height; Height = temp; } //RebuildMesh();


        private ICommand _presetSizeCommandIc; [XmlIgnore] public ICommand PresetSizeCommandIc => _presetSizeCommandIc ?? (_presetSizeCommandIc = new RelayCommand<Object>(PresetSizeCommandIcExecuted));

        private void PresetSizeCommandIcExecuted(Object obj)
        {
            if (obj == null) return;
            var point3D = new PresetService().TranslateSize(obj.ToString());
            Width = point3D.X;
            Height = point3D.Y;
            Depth = point3D.Z;
        }

        private ICommand _cycleValuesCommandIc; [XmlIgnore] public ICommand CycleValuesCommandIc => _cycleValuesCommandIc ?? (_cycleValuesCommandIc = new RelayCommand<Object>(CycleValuesCommandIcExecuted));

        public void CycleValuesCommandIcExecuted(Object sender) { var width = Width; Width = Height; Height = Depth; Depth = width; }
    }

}
