public void ApplyChange(object Exit) { Level.ScreenExit newExit; if (Exit == null) { newExit = new Level.ScreenExit(); if (this.checkBox1.Checked) { newExit.enabled = true; if (this.tabControl1.SelectedIndex == 0) { if (this.hexTextBox1.Text == "") { this.hexTextBox1.Text = "00"; } newExit.dest = byte.Parse(this.hexTextBox1.Text, NumberStyles.AllowHexSpecifier); if (this.hexTextBox2.Text == "") { this.hexTextBox2.Text = "00"; } newExit.x = byte.Parse(this.hexTextBox2.Text, NumberStyles.AllowHexSpecifier); if (this.hexTextBox3.Text == "") { this.hexTextBox3.Text = "00"; } newExit.y = byte.Parse(this.hexTextBox3.Text, NumberStyles.AllowHexSpecifier); newExit.type = (byte)this.comboBox2.SelectedIndex; } else { newExit.dest = (byte)(this.comboBox3.SelectedIndex + 222); if (this.hexTextBox5.Text == "") { this.hexTextBox5.Text = "00"; } newExit.x = byte.Parse(this.hexTextBox5.Text, NumberStyles.AllowHexSpecifier); if (this.hexTextBox6.Text == "") { this.hexTextBox6.Text = "00"; } newExit.y = byte.Parse(this.hexTextBox6.Text, NumberStyles.AllowHexSpecifier); if (this.hexTextBox4.Text == "") { this.hexTextBox4.Text = "00"; } newExit.type = byte.Parse(this.hexTextBox4.Text, NumberStyles.AllowHexSpecifier); } } this.levelTab.undoBuffer.Push((LevelTab.ICommand) new ScreenExitEditor.EditCommand(this, this.comboBox1.SelectedIndex, this.levelTab.ScreenExits[this.comboBox1.SelectedIndex], newExit)); this.levelTab.redoBuffer.Clear(); this.levelEditor.EnableUndoRedo(); } else { newExit = (Level.ScreenExit)Exit; } Win32.InvalidateRect(this.levelTab.Handle, (IntPtr)null, false); this.levelTab.ScreenExits[this.comboBox1.SelectedIndex] = newExit; this.button1.Enabled = this.button2.Enabled = false; }
public EditCommand(ScreenExitEditor target, int screenId, Level.ScreenExit oldExit, Level.ScreenExit newExit) { this.target = target; this.screenId = screenId; this.oldExit = oldExit; this.newExit = newExit; }
private void UndoRedo(int id, ref Level.ScreenExit exit) { this.internalChange = true; this.comboBox1.SelectedIndex = id; this.ApplyChange(exit); this.UpdateInformation(); }