Source

TrafficLight / src / UI / EditProjectView.cs

using RossCode.TrafficLight.Core.Presenters;
using RossCode.TrafficLight.Core.Presenters.Views;
using RossCode.TrafficLight.Core.Utilities;

namespace RossCode.TrafficLight.UI
{
    public partial class EditProjectView : BaseForm, IEditProjectView
    {
        public EditProjectView()
        {
            InitializeComponent();
            btnSave.Click += (sender, args) => SaveProject();
        }

        public string ProjectName
        {
            get { return txtProjectName.Text; }
            set { txtProjectName.Text = value; }
        }

        public string ProjectUrl
        {
            get { return txtProjectUrl.Text; }
            set { txtProjectUrl.Text = value; }
        }
        
        public string Username
        {
            get { return txtUsername.Text; }
            set { txtUsername.Text = value; }
        }

        public string Password
        {
            get { return txtPassword.Text; }
            set { txtPassword.Text = value; }
        }

        public event VoidHandler SaveProject = delegate { };
        
        public void SetupForProject(bool isNew)
        {
            Text = isNew ? "Add Project" : "Edit Project";
        }
    }
}