using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TFSBuildManager
{
    public partial class NewBuildTypeForm : Form
    {
        public NewBuildTypeForm()
        {
            InitializeComponent();
            /*tcNewBuildType.Top = tcNewBuildType.Top - tcNewBuildType.ItemSize.Height;
            tcNewBuildType.Height = tcNewBuildType.Height + tcNewBuildType.ItemSize.Height;*/
            tcNewBuildType.Region = new Region(new RectangleF(tp1.Left, tp1.Top, tp1.Width, tp1.Height + tcNewBuildType.ItemSize.Height));
            CurrentTabIndex = 0;
        }

        private int currentTabIndex;

        public int CurrentTabIndex
        {
            get 
            { 
                return currentTabIndex; 
            }
            set 
            { 
                currentTabIndex = value;
                SetCurrentTab();
            }
        }

        private void SetCurrentTab()
        {
            btnNext.Enabled = ((CurrentTabIndex >= 0) && (currentTabIndex < tcNewBuildType.TabCount - 1));
            btnPrevious.Enabled = CurrentTabIndex > 0;
            btnFinish.Enabled = CurrentTabIndex == tcNewBuildType.TabCount - 1;
            tcNewBuildType.SelectedIndex = CurrentTabIndex;
        }

        private void btnNext_Click(object sender, EventArgs e)
        {
            CurrentTabIndex = CurrentTabIndex + 1;
        }

        private void btnPrevious_Click(object sender, EventArgs e)
        {
            CurrentTabIndex = CurrentTabIndex - 1;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure that you want to exit the wizard?", "New Build Type",
                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DialogResult = DialogResult.Cancel;
            }
        }
    }
}