1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
4
using System.Windows.Controls;
5
using System.Windows.Input;
7
using ICSharpCode.Core;
9
namespace ICSharpCode.SharpDevelop.Gui.Pads
11
public sealed class JumpToAddressCommand : AbstractComboBoxCommand
16
protected override void OnOwnerChanged(EventArgs e)
18
this.pad = this.Owner as MemoryPad;
22
comboBox = this.ComboBox as ComboBox;
24
if (this.comboBox == null)
27
comboBox.KeyUp += (s, ea) => { if (ea.Key == Key.Enter) Run(); };
28
comboBox.IsEditable = true;
31
base.OnOwnerChanged(e);
34
public override void Run()
36
if (this.pad != null && this.comboBox != null) {
37
pad.JumpToAddress(comboBox.Text);
43
public abstract class ItemMemoryCommand : AbstractCommand
45
protected MemoryPad pad;
47
protected override void OnOwnerChanged(EventArgs e)
49
this.pad = this.Owner as MemoryPad;
53
base.OnOwnerChanged(e);
57
public sealed class RefreshAddressCommand : ItemMemoryCommand
59
public override void Run()
68
public sealed class NextAddressCommand : ItemMemoryCommand
70
public override void Run()
75
this.pad.MoveToNextAddress();
79
public sealed class PreviousAddressCommand : ItemMemoryCommand
81
public override void Run()
86
this.pad.MoveToPreviousAddress();
90
public sealed class DisplayByteSizeCommand : AbstractComboBoxCommand
95
protected override void OnOwnerChanged(EventArgs e)
97
this.pad = this.Owner as MemoryPad;
101
comboBox = this.ComboBox as ComboBox;
103
if (this.comboBox == null)
106
comboBox.SelectionChanged += (s, ea) => { Run(); };
108
comboBox.Items.Add(1);
109
comboBox.Items.Add(2);
110
comboBox.Items.Add(4);
113
comboBox.IsEditable = false;
115
base.OnOwnerChanged(e);
118
public override void Run()
120
if (this.pad != null && this.comboBox != null) {
121
pad.DisplayByteSize = Convert.ToByte(this.comboBox.SelectedValue);