public IEnumerable <CreatedMenuItem> Create(IMenuItemContext context) { var ctx = CreateContext(context); Debug.Assert(ctx != null); if (ctx == null) { yield break; } var hexView = ctx.HexView; foreach (var info in SettingsConstants.ValueFormatList) { var attr = new ExportMenuItemAttribute { Header = info.Value }; bool isChecked = info.Key == hexView.BufferLines.ValuesFormat; var item = new MyMenuItem(ctx2 => hexView.Options.SetOptionValue(DefaultHexViewOptions.HexValuesDisplayFormatId, info.Key), isChecked); yield return(new CreatedMenuItem(attr, item)); } }
public IEnumerable <CreatedMenuItem> Create(IMenuItemContext context) { var ctx = CreateContext(context); Debug.Assert(ctx != null); if (ctx == null) { yield break; } var hexView = ctx.HexView; for (int i = 0; i < subMenus.Length; i++) { var info = subMenus[i]; var attr = new ExportMenuItemAttribute { Header = info.Item2 }; bool isChecked = info.Item1 == hexView.Options.GetOptionValue(DefaultHexViewOptions.BytesPerLineId); var item = new MyMenuItem(ctx2 => hexView.Options.SetOptionValue(DefaultHexViewOptions.BytesPerLineId, info.Item1), isChecked); yield return(new CreatedMenuItem(attr, item)); } }