private void NavigateToDoItem(object sender, ToDoItemClickEventArgs e) { var projects = VBE.VBProjects.Cast <VBProject>() .Where(p => p.Protection != vbext_ProjectProtection.vbext_pp_locked && p.Name == e.SelectedItem.ProjectName && p.VBComponents.Cast <VBComponent>() .Any(c => c.Name == e.SelectedItem.ModuleName) ); if (projects == null) { return; } var component = projects.FirstOrDefault().VBComponents.Cast <VBComponent>() .First(c => c.Name == e.SelectedItem.ModuleName); if (component == null) { return; } var codePane = component.CodeModule.CodePane; codePane.SetSelection(e.SelectedItem.GetSelection().Selection); }
private void ToDoGridViewCellDoubleClicked(object sender, DataGridViewCellEventArgs e) { var handler = NavigateToDoItem; if (handler == null) { return; } var item = (ToDoItem)todoItemsGridView[e.ColumnIndex, e.RowIndex].OwningRow.DataBoundItem; var args = new ToDoItemClickEventArgs(item); handler(this, args); }
private void ToDoGridViewCellDoubleClicked(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } var handler = NavigateToDoItem; if (handler != null) { var item = (ToDoItem)todoItemsGridView[e.ColumnIndex, e.RowIndex].OwningRow.DataBoundItem; var args = new ToDoItemClickEventArgs(item); handler(this, args); } }
private void NavigateToDoItem(object sender, ToDoItemClickEventArgs e) { var project = VBE.VBProjects.Cast <VBProject>() .FirstOrDefault(p => p.Name == e.Selection.ProjectName); if (project == null) { return; } var component = project.VBComponents.Cast <VBComponent>() .FirstOrDefault(c => c.Name == e.Selection.ModuleName); if (component == null) { return; } var codePane = component.CodeModule.CodePane; codePane.SetSelection(e.Selection.LineNumber); codePane.ForceFocus(); }
private void NavigateToDoItem(object sender, ToDoItemClickEventArgs e) { var projects = VBE.VBProjects.Cast<VBProject>() .Where(p => p.Protection != vbext_ProjectProtection.vbext_pp_locked && p.Name == e.SelectedItem.ProjectName && p.VBComponents.Cast<VBComponent>() .Any(c => c.Name == e.SelectedItem.ModuleName) ); if (projects == null) { return; } var firstOrDefault = projects.FirstOrDefault(); if (firstOrDefault == null) { return; } var component = firstOrDefault.VBComponents.Cast<VBComponent>() .First(c => c.Name == e.SelectedItem.ModuleName); if (component == null) { return; } var codePane = component.CodeModule.CodePane; codePane.SetSelection(e.SelectedItem.GetSelection().Selection); }