public void UpdateUI() { // This routine is a huge memory eater. return; #if false richTextBox1.Clear(); if (document == null) { return; } listingView = new ListingViewModel(document.Disassembler); StringBuilder sb = new StringBuilder(); int rowCount = listingView.Rows.Count; int[] rowStart = new int[rowCount + 1]; for (int i = 0; i < rowCount; i++) { ListingRow row = listingView.Rows[i]; rowStart[i] = sb.Length; sb.AppendFormat("{0} {1}\n", row.Location, row.Text); } rowStart[rowCount] = sb.Length; richTextBox1.Text = sb.ToString(); return; #if false #if false //richTextBox1.Test(); #else // Format the text. //richTextBox1.Visible = false; ITextDocument textDocument = richTextBox1.GetTextDocument(); //textDocument.Freeze(); int nUndoLimit = richTextBox1.SetUndoLimit(0); //textDocument.BeginEditCollection(); -- not implemented #if false richTextBox1.SelectAll(); richTextBox1.SelectionColor = Color.Blue; richTextBox1.DeselectAll(); #else //richTextBox1.SelectedRtf System.Diagnostics.Debug.WriteLine("Formatting " + rowCount + " lines..."); for (int i = rowCount - 1; i >= 0; i--) { richTextBox1.Select(rowStart[i], 9); //richTextBox1.SelectionColor = Color.Blue; richTextBox1.SelectedText = "NEW"; } #endif //richTextBox1.Visible = true; //textDocument.Unfreeze(); //textDocument.EndEditCollection(); #endif #endif #endif }
private void UpdateUI() { dataGridView1.DataSource = null; lvListing.SetWindowTheme("explorer"); lvListing.VirtualListSize = 0; viewModel = null; if (document == null) { return; } // Listen to navigation events. document.Navigator.LocationChanged += navigator_LocationChanged; // Create the view model. viewModel = new ListingViewModel(document.Image); //dataGridView1.Columns.Clear(); dataGridView1.AutoGenerateColumns = false; dataGridView1.Font = new System.Drawing.Font(FontFamily.GenericMonospace, this.Font.Size); dataGridView1.DataSource = null; dataGridView1.DataSource = viewModel.Rows; dataGridView1.Refresh(); // Fill the procedure window. cbProcedures.Items.Clear(); cbProcedures.Items.AddRange(viewModel.ProcedureItems.ToArray()); // Fill the segment window. cbSegments.Items.Clear(); cbSegments.Items.AddRange(viewModel.SegmentItems.ToArray()); // Display the listing rows. //scope = ListingScope.Procedure; scope = ListingScope.Executable; // should rename to Image UpdateScope(); }