using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;

namespace Testovaci_aplikace_diplomka
{
    public partial class TransECdialog : Form
    {
        public TransECdialog()
        {
            InitializeComponent();
            RollNumericUpDown.Value = (decimal)GlobalTrackerClassSet.roll_E_C;
            PitchNumericUpDown.Value = (decimal)GlobalTrackerClassSet.pitch_E_C;
            YawNumericUpDown.Value = (decimal)GlobalTrackerClassSet.yaw_E_C;
            XNumericUpDown.Value = (decimal)GlobalTrackerClassSet.x_E_C;
            YNumericUpDown.Value = (decimal)GlobalTrackerClassSet.y_E_C;
            ZNumericUpDown.Value = (decimal)GlobalTrackerClassSet.z_E_C;

        }

        private void RollNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.roll_E_C = (float)RollNumericUpDown.Value;
        }

        private void PitchNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.pitch_E_C = (float)PitchNumericUpDown.Value;
        }

        private void YawnNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.yaw_E_C = (float)YawNumericUpDown.Value;
        }

        private void XNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.x_E_C = (float)XNumericUpDown.Value;
        }

        private void YNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.y_E_C = (float)YNumericUpDown.Value;
        }

        private void ZNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            GlobalTrackerClassSet.z_E_C = (float)ZNumericUpDown.Value;
        }

        private void DefaultButton_Click(object sender, EventArgs e)
        {
            XNumericUpDown.Value = decimal.Parse(GlobalTrackerClassSet.settings["colorcam_position_X"], CultureInfo.InvariantCulture);
            YNumericUpDown.Value = decimal.Parse(GlobalTrackerClassSet.settings["colorcam_position_Y"], CultureInfo.InvariantCulture);
            ZNumericUpDown.Value = decimal.Parse(GlobalTrackerClassSet.settings["colorcam_position_Z"], CultureInfo.InvariantCulture);
            RollNumericUpDown.Value = (decimal)(double.Parse(GlobalTrackerClassSet.settings["colorcam_position_U"], CultureInfo.InvariantCulture)); //* Math.PI / 180);
            PitchNumericUpDown.Value = (decimal)(double.Parse(GlobalTrackerClassSet.settings["colorcam_position_V"], CultureInfo.InvariantCulture)); //* Math.PI / 180);
            YawNumericUpDown.Value = (decimal)(double.Parse(GlobalTrackerClassSet.settings["colorcam_position_W"], CultureInfo.InvariantCulture)); //* Math.PI / 180);
        }
    }
}
