public void Handle(IHexDataContext hexDataContext) { if (hexDataContext == null) { return; } var device = hexDataContext.GetInstance <IFile>(Contracts.FileExplorer.Constants.HexDataContextTag_File) as IDevice; if (device == null) { return; } if (device.PartitionEntries == null) { return; } int i = 0; foreach (var ti in device.PartitionEntries.OrderBy(p => p.StartLBA)) { hexDataContext.CustomBackgroundBlocks?.Add( BrushBlockFactory.CreateNewBackgroundBlock( ti.StartLBA, ti.Size, i++ % 2 == 0 ? BrushBlockFactory.FirstBrush : BrushBlockFactory.SecondBrush ) ); } hexDataContext.UpdateCustomBackgroundBlocks(); }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) { _dataContext.CustomBackgroundBlocks.Add(BrushBlockFactory.CreateNewBackgroundBlock(1, 1024, Brushes.AliceBlue)); _dataContext.UpdateCustomBackgroundBlocks(); }