private void WindowLoaded(object sender, RoutedEventArgs e) { VisualStudioVersion = VisualStudioHelper.DetectVersion(VisualStudioOptions); if (Environment.GetCommandLineArgs().Count() == 2) { Load(Environment.GetCommandLineArgs()[1]); } else { Load(); } }
private void OpenDocument(object sender, MouseButtonEventArgs e) { var fe = sender as FrameworkElement; var dc = fe.DataContext as LineOfCode; try { var vsObjectName = VisualStudioHelper.GetVisualStudioObjectName(VisualStudioVersion); VisualStudioHelper.OpenInVisualStudio(vsObjectName, dc.SourceFile.FullPath, dc.LineNumber); } catch { foreach (var version in VisualStudioOptions) { try { var vsObjectName = VisualStudioHelper.GetVisualStudioObjectName(version); VisualStudioHelper.OpenInVisualStudio(vsObjectName, dc.SourceFile.FullPath, dc.LineNumber); break; } catch { } } try { var vsObjectName = VisualStudioHelper.GetVisualStudioObjectName(); VisualStudioHelper.OpenInVisualStudio(vsObjectName, dc.SourceFile.FullPath, dc.LineNumber); } catch (Exception ex) { MessageBox.Show("Cannot open line of code in Visual Studio!\r\n" + ex.ToString()); } } e.Handled = true; }