public PlayDefinitionWindow()
        {
            InitializeComponent();

            PutPlayToControls(null);

            InitializeCommandsList();
            InitializeComboBoxes();

            PlayGroup      playsList = new PlayGroup();
            AutonomousPlay newPlay   = new AutonomousPlay("new");

            newPlay.L_LL[0] = "L_LL";
            newPlay.L_LR[0] = "L_LR";
            newPlay.L_RR[0] = "L_RR";
            newPlay.L_RL[0] = "L_RL";

            newPlay.C_LL[0] = "C_LL";
            newPlay.C_LR[0] = "C_LR";
            newPlay.C_RR[0] = "C_RR";
            newPlay.C_RL[0] = "C_RL";

            newPlay.R_LL[0] = "R_LL";
            newPlay.R_LR[0] = "R_LR";
            newPlay.R_RR[0] = "R_RR";
            newPlay.R_RL[0] = "R_RL";

            playsList.AutonomousPlays.Add(newPlay);
            AddNewRoute(playsList);
        }
 private void DownBtn_Click(object sender, RoutedEventArgs e)
 {
     if ((PlaysLB.SelectedIndex >= 0) && (PlaysLB.SelectedIndex < PlaysLB.Items.Count - 1))
     {
         int            index = PlaysLB.SelectedIndex;
         AutonomousPlay item  = mPlays.AutonomousPlays[index];
         mPlays.AutonomousPlays.RemoveAt(index);
         mPlays.AutonomousPlays.Insert(index + 1, item);
         PlaysLB.SelectedIndex = index + 1;
     }
 }
        private void PlayEntry_TextChanged(object sender, TextChangedEventArgs e)
        {
            AutonomousPlay mode = SelectedPlay;

            if (mode != null)
            {
                TextBox editBox = sender as TextBox;
                mode.Name = editBox.Text;
                //TODO ProgramPnl.ProgramNameLabel = mode.Name;
            }
        }
 private void UpBtn_Click(object sender, RoutedEventArgs e)
 {
     // if the index is set and greater than the first element
     // move it up
     if (PlaysLB.SelectedIndex > 0)
     {
         int            index = PlaysLB.SelectedIndex;
         AutonomousPlay item  = mPlays.AutonomousPlays[index];
         mPlays.AutonomousPlays.RemoveAt(index);
         mPlays.AutonomousPlays.Insert(index - 1, item);
         PlaysLB.SelectedIndex = index - 1;
     }
 }
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            AutonomousPlay mode = new AutonomousPlay("new");

            if ((PlaysLB.SelectedIndex >= 0) && (PlaysLB.SelectedIndex < PlaysLB.Items.Count))
            {
                mPlays.AutonomousPlays.Insert(PlaysLB.SelectedIndex + 1, mode);
            }
            else
            {
                mPlays.AutonomousPlays.Add(mode);
            }
        }
        private void PutPlayToControls(AutonomousPlay selectedPlay)
        {
            if (selectedPlay != null)
            {
                Play_L_LL_CB.IsEnabled = true;
                Play_L_LL_CB.Text      = selectedPlay.L_LL[0];
                Play_C_LL_CB.IsEnabled = true;
                Play_C_LL_CB.Text      = selectedPlay.C_LL[0];
                Play_R_LL_CB.IsEnabled = true;
                Play_R_LL_CB.Text      = selectedPlay.R_LL[0];

                Play_L_LR_CB.IsEnabled = true;
                Play_L_LR_CB.Text      = selectedPlay.L_LR[0];
                Play_C_LR_CB.IsEnabled = true;
                Play_C_LR_CB.Text      = selectedPlay.C_LR[0];
                Play_R_LR_CB.IsEnabled = true;
                Play_R_LR_CB.Text      = selectedPlay.R_LR[0];

                Play_L_RR_CB.IsEnabled = true;
                Play_L_RR_CB.Text      = selectedPlay.L_RR[0];
                Play_C_RR_CB.IsEnabled = true;
                Play_C_RR_CB.Text      = selectedPlay.C_RR[0];
                Play_R_RR_CB.IsEnabled = true;
                Play_R_RR_CB.Text      = selectedPlay.R_RR[0];

                Play_L_RL_CB.IsEnabled = true;
                Play_L_RL_CB.Text      = selectedPlay.L_RL[0];
                Play_C_RL_CB.IsEnabled = true;
                Play_C_RL_CB.Text      = selectedPlay.C_RL[0];
                Play_R_RL_CB.IsEnabled = true;
                Play_R_RL_CB.Text      = selectedPlay.R_RL[0];
            }
            else
            {
                Play_L_LL_CB.IsEnabled = false;
                Play_C_LL_CB.IsEnabled = false;
                Play_R_LL_CB.IsEnabled = false;

                Play_L_LR_CB.IsEnabled = false;
                Play_C_LR_CB.IsEnabled = false;
                Play_R_LR_CB.IsEnabled = false;

                Play_L_RR_CB.IsEnabled = false;
                Play_C_RR_CB.IsEnabled = false;
                Play_R_RR_CB.IsEnabled = false;

                Play_L_RL_CB.IsEnabled = false;
                Play_C_RL_CB.IsEnabled = false;
                Play_R_RL_CB.IsEnabled = false;
            }
        }
        /// <summary>
        /// Called by the PlaysLB when the selection has been changed
        /// </summary>
        ///
        /// When called this function will unload the previous selection and load the
        /// new one. Primarily this will be loading the new play's selection onto the
        /// dashboard.
        ///
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PlaysLB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AutonomousPlay selectedPlay = SelectedPlay;

            // display the new program mode in the right side panel
            if (selectedPlay != null)
            {
                PutPlayToControls(selectedPlay);
                mCurrentPlaySelected = selectedPlay;
                //PlayGroupingGrid.DataContext = selectedMode;
                //TODO ProgramPnl.ProgramNameLabel = selectedMode.Name;
                //TODO ProgramPnl.Commands = selectedMode.Commands;
            }
        }