public static void Create(AlignToHandler alignToHandler) { var menu = new Menu(); var currentAlignObject = alignToHandler.GetAlignTo(); foreach (AlignTo alignObject in Enum.GetValues(typeof(AlignTo))) { menu.Add(new Command(GetDisplayedTextForAlign(alignObject), new ChangeAlignTo(alignObject, alignToHandler).Execute) { Checked = currentAlignObject == alignObject }); } menu.Popup(); }
public static void Create(AlignToHandler alignToHandler) { var alignTo = alignToHandler.GetAlignTo(); new Menu { new Command( GetDisplayedTextForAlign(AlignTo.Parent), new ChangeAlignTo(AlignTo.Parent, alignToHandler).Execute ) { Checked = alignTo == AlignTo.Parent }, new Command( GetDisplayedTextForAlign(AlignTo.Root), new ChangeAlignTo(AlignTo.Root, alignToHandler).Execute ) { Checked = alignTo == AlignTo.Root } }.Popup(); }
public ChangeAlignTo(AlignTo alignTo, AlignToHandler alignToHandler) { this.alignTo = alignTo; this.alignToHandler = alignToHandler; }