private async void PerformAnalysisButtonClick(object sender, RoutedEventArgs e) { using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) { analysisBasePath = @"C:\Users\JAH\Documents\Git\xgsos"; dialog.SelectedPath = analysisBasePath; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { analysisBasePath = dialog.SelectedPath; var analyzer = new CSharpAnalyzer(Console.WriteLine); var files = Directory.EnumerateFiles(analysisBasePath, "*.cs", SearchOption.AllDirectories); DisableRectangle.Visibility = Visibility.Visible; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; collection = await analyzer.AnalyzeFilesAsync(files); Mouse.OverrideCursor = null; DisableRectangle.Visibility = Visibility.Hidden; CollectionLabel.Content = "Unnamed collection"; CollectionLabel.Foreground = Brushes.Orange; PopulateStartClassComboBox(collection); DiagramControlsGrid.IsEnabled = true; SaveAnalysisButton.IsEnabled = true; } } }
private void LoadAnalysisButtonClick(object sender, RoutedEventArgs e) { var openFileDialog = new OpenFileDialog { FileName = collectionFileName }; if (openFileDialog.ShowDialog() == true) { collectionFileName = openFileDialog.FileName; collection = CSharpObjectCollection.Deserialize(collectionFileName); CollectionLabel.Content = $"Collection \"{collectionFileName}\""; CollectionLabel.Foreground = Brushes.Green; PopulateStartClassComboBox(collection); DiagramControlsGrid.IsEnabled = true; SaveAnalysisButton.IsEnabled = false; } }
private void PopulateStartClassComboBox(CSharpObjectCollection collection) { var oldStartClass = StartClassComboBox.Text; StartClassComboBox.ItemsSource = collection.Classes.OrderBy(c => c.Name).Select(c => c.Name); var index = StartClassComboBox.Items.IndexOf(oldStartClass); if (index != -1) { StartClassComboBox.SelectedIndex = index; } else { index = StartClassComboBox.Items.IndexOf(startClass); if (index != -1) { StartClassComboBox.SelectedIndex = index; } } }