private void TodoBindingSource_CurrentChanged(object sender, EventArgs e) { CurrentStateField.SetDataBinding(todoBindingSource.Current, "CurrentState"); DescriptionField.SetDataBinding(todoBindingSource.Current, "Description"); ResultField.SetDataBinding(todoBindingSource.Current, "Result"); PublicTextField.SetDataBinding(todoBindingSource.Current, "PublicText"); if (todoBindingSource.Current is Todo) { Todo todo = (Todo)todoBindingSource.Current; toolStripLabel1.Text = todo.ShortDescription.Truncate(50); toolStripButtonIst.ForeColor = Color.FromArgb(62, 62, 66); toolStripButtonSoll.ForeColor = Color.FromArgb(62, 62, 66); toolStripButtonRecherche.ForeColor = Color.FromArgb(62, 62, 66); toolStripButtonResult.ForeColor = Color.FromArgb(62, 62, 66); if (!string.IsNullOrEmpty(todo.CurrentState)) { toolStripButtonIst.ForeColor = Color.White; } if (!string.IsNullOrEmpty(todo.Description)) { toolStripButtonSoll.ForeColor = Color.White; } if (!string.IsNullOrEmpty(todo.Result)) { toolStripButtonRecherche.ForeColor = Color.White; } if (!string.IsNullOrEmpty(todo.PublicText)) { toolStripButtonResult.ForeColor = Color.White; } } }
internal void SetBindingSources(object projectDataSource, object sprintDataSource, object taskDataSource) { this.todoBindingSource.DataSource = taskDataSource; this.sprintBindingSource.DataSource = sprintDataSource; this.projectBindingSource.DataSource = projectDataSource; CurrentStateField.CustomEditor.HeaderText = "Ist Zustand"; CurrentStateField.SetDataBinding(todoBindingSource.Current, "CurrentState"); CurrentStateField.HeaderClicked += CurrentStateField_HeaderClicked; DescriptionField.CustomEditor.HeaderText = "Soll Zustand"; DescriptionField.SetDataBinding(todoBindingSource.Current, "Description"); DescriptionField.HeaderClicked += DescriptionField_HeaderClicked; ResultField.CustomEditor.HeaderText = "Recherche"; ResultField.SetDataBinding(todoBindingSource.Current, "Result"); ResultField.HeaderClicked += ResultField_HeaderClicked; PublicTextField.CustomEditor.HeaderText = "Resultat"; PublicTextField.SetDataBinding(todoBindingSource.Current, "PublicText"); PublicTextField.HeaderClicked += PublicTextField_HeaderClicked; List <CompletionItem> comletionList = new List <CompletionItem>(); foreach (object obj in todoBindingSource.List) { Todo task = (Todo)obj; CompletionItem completionItem2 = new CompletionItem() { DisplayText = task.ShortDescription, PopUpText = task.Description, ReplacementText = task.Id }; comletionList.Add(completionItem2); CompletionItem completionItem = new CompletionItem() { DisplayText = task.Id, PopUpText = task.ShortDescription }; comletionList.Add(completionItem); } foreach (object obj in projectBindingSource.List) { Project project = (Project)obj; CompletionItem completionItem2 = new CompletionItem() { DisplayText = project.ShortDescription, PopUpText = project.Description, ReplacementText = project.Id }; comletionList.Add(completionItem2); } foreach (object obj in sprintBindingSource.List) { Sprint sprint = (Sprint)obj; CompletionItem completionItem2 = new CompletionItem() { DisplayText = sprint.ShortDescription, PopUpText = sprint.Description, ReplacementText = sprint.Id }; comletionList.Add(completionItem2); } todoBindingSource.CurrentChanged += TodoBindingSource_CurrentChanged; CurrentStateField.FillComletionList(comletionList); }