private void Bind(AutoCommitTask item)
        {
            if (string.IsNullOrEmpty(item.Handler.Folder))
                Text = "add task";

            if (string.IsNullOrEmpty(item.CommitMessage)) item.CommitMessage = "";

            //normalises the line endings
            var commitMessage = item.CommitMessage
                .Replace("\r\n", "\n")
                .Replace("\r", "\n")
                .Replace("\n", "\r\n");

            nameTextBox.Text = item.Name;
            folderTextBox.Text = item.Folder;
            commitMessageTextBox.Text = commitMessage;

            if (nameTextBox.Text == "" && folderTextBox.Text != "")
                nameTextBox.Text = Path.GetFileName(folderTextBox.Text);

            if (commitMessageTextBox.Text == "")
                commitMessageTextBox.Text = "Automatic commit";

            intervalComboBox.SelectedItem = _intervals.FirstOrDefault(x => x.Seconds == item.Interval);
        }
        public DialogResult EditTask(AutoCommitTask item, IWin32Window owner)
        {
            Bind(item);

            var result = ShowDialog(owner);

            if (result == DialogResult.OK)
            {
                UnBind(item);
            }

            return result;
        }
 private void UnBind(AutoCommitTask item)
 {
     var interval = intervalComboBox.SelectedItem as Interval;
     item.SetProperties(nameTextBox.Text, folderTextBox.Text, commitMessageTextBox.Text, interval == null ? 30 : interval.Seconds);
 }