ShiftVariables.cs 2.08 KB
Newer Older
Alexander Dietsch's avatar
Alexander Dietsch committed
1 2 3 4 5 6 7 8 9 10 11 12 13
using MainLWSimulator;
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;

namespace LWSimulatorGUI
{
Alexander Dietsch's avatar
Alexander Dietsch committed
14
    public partial class ShiftVariables : Form
Alexander Dietsch's avatar
Alexander Dietsch committed
15 16
    {
        LWCoordinator simul;
Alexander Dietsch's avatar
Alexander Dietsch committed
17
        public ShiftVariables(LWCoordinator coord)
Alexander Dietsch's avatar
Alexander Dietsch committed
18 19 20
        {
            InitializeComponent();
            simul = coord;
Alexander Dietsch's avatar
Alexander Dietsch committed
21 22 23
            nUDVariableAm.Maximum = simul.getVariableAmount() - 1;
            nUDVariable.Maximum = simul.getVariableAmount() - 1;
            nUDVariableShift.Maximum = simul.getVariableAmount() - 1;
Alexander Dietsch's avatar
Alexander Dietsch committed
24 25


Alexander Dietsch's avatar
Alexander Dietsch committed
26 27 28 29 30 31 32
            nUDVariable.Location = new Point(lShift.Location.X + lShift.Width - 2, nUDVariable.Location.Y);
            lFollowing.Location = new Point(nUDVariable.Location.X + nUDVariable.Width + 6, lFollowing.Location.Y);
            nUDVariableAm.Location = new Point(lFollowing.Location.X + lFollowing.Width + 6, nUDVariableAm.Location.Y);
            lVariables.Location = new Point(nUDVariableAm.Location.X + nUDVariableAm.Width + 6, lVariables.Location.Y);
            nUDVariableShift.Location = new Point(lFor.Location.X + lFor.Width + 6, nUDVariableShift.Location.Y);
            lVariables2.Location = new Point(nUDVariableShift.Location.X + nUDVariableShift.Width + 6, lVariables2.Location.Y);
            rBForward.Location = new Point(lVariables2.Location.X + lVariables2.Width + 6, rBForward.Location.Y);
Alexander Dietsch's avatar
Alexander Dietsch committed
33 34 35 36 37 38
            rBBackward.Location = new Point(rBForward.Location.X, rBForward.Location.Y + 23);
        }

        private void bPrefOK_Click(object sender, EventArgs e)
        {
            if (rBForward.Checked)
Alexander Dietsch's avatar
Alexander Dietsch committed
39
                simul.shiftVariables((int)nUDVariable.Value, (int)nUDVariableAm.Value + 1, (int)nUDVariableShift.Value);
Alexander Dietsch's avatar
Alexander Dietsch committed
40
            else
Alexander Dietsch's avatar
Alexander Dietsch committed
41
                simul.shiftVariables((int)nUDVariable.Value, (int)nUDVariableAm.Value + 1, -((int)nUDVariableShift.Value));
Alexander Dietsch's avatar
Alexander Dietsch committed
42 43 44 45 46 47 48 49 50
            this.Close();
        }

        private void bPrefCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}