private void EditProject_Click(object sender, RoutedEventArgs e)
 {
     if (ProjectListBox.SelectedValue != null)
     {
         var form = new ProjectName(TimeManagement.Projects[ProjectListBox.SelectedIndex].Name);
         form.ShowDialog();
         TimeManagement.Projects[ProjectListBox.SelectedIndex].Name = form.ProjectNameTextBox.Text;
     }
     UpdateUi();
 }
        private void AddNewProject_Click(object sender, RoutedEventArgs e)
        {
            var form = new ProjectName("");
            form.ShowDialog();

            if (String.IsNullOrWhiteSpace(form.ProjectNameTextBox.Text))
                return;

            var proj = new Project();
            proj.Name = form.ProjectNameTextBox.Text;
            proj.TimeIntervals = new List<TimeInterval>();

            TimeManagement.Projects.Add(proj);
            UpdateUi();
        }