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

namespace TFSBuildManager
{
    public partial class BuildParametersForm : Form
    {
        public BuildParametersForm(TFSBuildType buildType)
        {
            InitializeComponent();
            Text = String.Format(Text, buildType.Name);
            lblBuildType.Text = buildType.Name;
            txtDescription.Text = buildType.Description.PropertyValue;
            txtBuildMachine.Text = buildType.BuildMachine.PropertyValue;
            txtDropLocation.Text = buildType.DropLocation.PropertyValue;
        }

        private string buildMachine;

        public string BuildMachine
        {
            get { return buildMachine; }
        }

        private string dropLocation;

        public string DropLocation
        {
            get { return dropLocation; }
        }

        private void btnBuild_Click(object sender, EventArgs e)
        {
            if ((txtDropLocation.Text != String.Empty) &&
                (txtBuildMachine.Text != String.Empty))
            {
                buildMachine = txtBuildMachine.Text;
                dropLocation = txtDropLocation.Text;
                DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Please specify build machine and drop location",
                    "TFSBuildManager", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}