public FormBugListView(IBugService svc, ISingleBugViewPresenter sbPres, [Named("ViewSettings")]ISettingsOriginator viewSettings) { InitializeComponent(); _presenter = new BugListViewPresenter(this, svc); _singleBugPresenter = sbPres; _viewSettings = viewSettings; SelectedBugs = new ObservableCollection<IBug>(); Projects = new List<IProject>(); CommandToApply = new YouTrackCommand() { DisableNotifications = false }; comboBoxProject.DataSource = bindingSourceProjects; //Set up grid dataGridViewBugs.Columns.Add(new DataGridViewCheckBoxColumn() { ReadOnly = false, AutoSizeMode = DataGridViewAutoSizeColumnMode.None, Resizable = DataGridViewTriState.False, Width = 20 }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "ID", ReadOnly = true, Resizable = DataGridViewTriState.True }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Summary", ReadOnly = true, Resizable = DataGridViewTriState.True }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Description", ReadOnly = true, Resizable = DataGridViewTriState.True, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill }); _linkCol = new DataGridViewLinkColumn() { LinkBehavior = LinkBehavior.NeverUnderline, UseColumnTextForLinkValue = true, Text = "view", ReadOnly = true, Resizable = DataGridViewTriState.False, Width = 50, DefaultCellStyle = new DataGridViewCellStyle(dataGridViewBugs.DefaultCellStyle) { Alignment = DataGridViewContentAlignment.MiddleCenter } }; dataGridViewBugs.Columns.Add(_linkCol); dataGridViewBugs.CellContentClick += new DataGridViewCellEventHandler(dataGridViewBugs_CellContentClick); bindingSourceProjects.CurrentChanged += (s, ea) => { if (!bindingSourceProjects.IsBindingSuspended) SelectedProject = bindingSourceProjects.Current as IProject; }; comboBoxPage.SelectedIndexChanged += (s, ea) => UpdatePage(); comboBoxPage.KeyUp += (s, ea) => { if (ea.KeyCode == Keys.Enter) UpdatePage(); }; bindingSourceBugs.DataSourceChanged += new EventHandler(bindingSourceBugs_DataSourceChanged); SelectedBugs.CollectionChanged += (s, ea) => labelSelected.Text = String.Format("Selected: {0}", SelectedBugs.Count); checkBoxApplyCommand.CheckStateChanged += (s, ea) => { _applyCommand = checkBoxApplyCommand.Checked; }; textBoxCommand.TextChanged += (s, ea) => { _commandToApply.Command = textBoxCommand.Text; }; }
public FormBugListView(IBugService svc, ISingleBugViewPresenter sbPres, [Named("ViewSettings")] ISettingsOriginator viewSettings) { InitializeComponent(); _presenter = new BugListViewPresenter(this, svc); _singleBugPresenter = sbPres; _viewSettings = viewSettings; SelectedBugs = new ObservableCollection <IBug>(); Projects = new List <IProject>(); CommandToApply = new YouTrackCommand() { DisableNotifications = false }; comboBoxProject.DataSource = bindingSourceProjects; //Set up grid dataGridViewBugs.Columns.Add(new DataGridViewCheckBoxColumn() { ReadOnly = false, AutoSizeMode = DataGridViewAutoSizeColumnMode.None, Resizable = DataGridViewTriState.False, Width = 20 }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "ID", ReadOnly = true, Resizable = DataGridViewTriState.True }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Summary", ReadOnly = true, Resizable = DataGridViewTriState.True }); dataGridViewBugs.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Description", ReadOnly = true, Resizable = DataGridViewTriState.True, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill }); _linkCol = new DataGridViewLinkColumn() { LinkBehavior = LinkBehavior.NeverUnderline, UseColumnTextForLinkValue = true, Text = "view", ReadOnly = true, Resizable = DataGridViewTriState.False, Width = 50, DefaultCellStyle = new DataGridViewCellStyle(dataGridViewBugs.DefaultCellStyle) { Alignment = DataGridViewContentAlignment.MiddleCenter } }; dataGridViewBugs.Columns.Add(_linkCol); dataGridViewBugs.CellContentClick += new DataGridViewCellEventHandler(dataGridViewBugs_CellContentClick); bindingSourceProjects.CurrentChanged += (s, ea) => { if (!bindingSourceProjects.IsBindingSuspended) { SelectedProject = bindingSourceProjects.Current as IProject; } }; comboBoxPage.SelectedIndexChanged += (s, ea) => UpdatePage(); comboBoxPage.KeyUp += (s, ea) => { if (ea.KeyCode == Keys.Enter) { UpdatePage(); } }; bindingSourceBugs.DataSourceChanged += new EventHandler(bindingSourceBugs_DataSourceChanged); SelectedBugs.CollectionChanged += (s, ea) => labelSelected.Text = String.Format("Selected: {0}", SelectedBugs.Count); checkBoxApplyCommand.CheckStateChanged += (s, ea) => { _applyCommand = checkBoxApplyCommand.Checked; }; textBoxCommand.TextChanged += (s, ea) => { _commandToApply.Command = textBoxCommand.Text; }; }