/// <summary> /// Highlights and scrolls to the given pcl /// </summary> /// <param name="pcl"></param> private void HighlightSourceLine(int pcl) { try { SourceFile.HighlightLine(pcl); SourceDataGrid.ScrollIntoView(SourceDataGrid.Items[6]); SourceDataGrid.ScrollIntoView(SourceDataGrid.Items[SourceFile.GetSourceLineIndexFromPC(pcl)]); } catch (Exception) { } }
/// <summary> /// Logic for File -> Open /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuOpen_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog() { Title = "Open Source File", Filter = "LST files (*.LST)|*.LST", RestoreDirectory = true, }; if (dialog.ShowDialog() == true) { Reset(); SourceFile = new SourceFile(dialog.FileName); SourceDataGrid.ItemsSource = SourceFile.GetSourceLines(); //Set new data to LST View SourceDataGrid.Columns[4].Width = 0; //Reset comment column width SourceDataGrid.UpdateLayout(); SourceDataGrid.Columns[4].Width = DataGridLength.Auto; //Set new column width automatically according to content UpdateUI(); } }