/// <summary> /// Handler for clicking Merge Bag on the context menu /// </summary> /// <param name="sender">sender object</param> /// <param name="e">EventArgs data</param> private void MergeBagClicked(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; if (item != null) { int destinationIndex = VaultPanel.GetDestinationSackIndex(item.Name); if (destinationIndex < 0 || destinationIndex > this.Player.NumberOfSacks || this.CurrentBag == destinationIndex) { return; } SackPanel dstSackPanel = this.BagSackPanel; if (dstSackPanel.MergeSack(destinationIndex)) { // turn off the current bag and turn on the new bag this.BagButtons[this.CurrentBag].IsOn = false; this.BagButtons[destinationIndex].IsOn = true; this.CurrentBag = destinationIndex; this.BagSackPanel.Sack = this.Player.GetSack(this.CurrentBag + this.BagPanelOffset); this.BagSackPanel.CurrentSack = this.CurrentBag; } } }
/// <summary> /// Handler for clicking on Copy Bag from the context menu /// </summary> /// <param name="sender">sender object</param> /// <param name="e">EventArgs data</param> private void CopyBagClicked(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; if (item != null) { int destinationIndex = VaultPanel.GetDestinationSackIndex(item.Name); if (destinationIndex > this.Player.NumberOfSacks) { return; } if (!this.Player.GetSack(destinationIndex + this.BagPanelOffset).IsEmpty) { if (Config.Settings.Default.SuppressWarnings || MessageBox.Show( Resources.PlayerOverwriteSackMsg, Resources.PlayerOverwriteSack, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, VaultPanel.RightToLeftOptions) != DialogResult.Yes) { return; } } if (this.Player.CopySack(this.CurrentBag, destinationIndex)) { if (this.CurrentBag != destinationIndex) { // turn off the current bag and turn on the new bag this.BagButtons[this.CurrentBag].IsOn = false; this.BagButtons[destinationIndex].IsOn = true; this.CurrentBag = destinationIndex; this.BagSackPanel.Sack = this.Player.GetSack(this.CurrentBag + this.BagPanelOffset); this.BagSackPanel.CurrentSack = this.CurrentBag; } } } }
/// <summary> /// Handler for clicking move bag from the context menu /// </summary> /// <param name="sender">sender object</param> /// <param name="e">EventArgs data</param> private void MoveBagClicked(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; if (item != null) { int destinationIndex = VaultPanel.GetDestinationSackIndex(item.Name); if (this.Player.MoveSack(this.CurrentBag, destinationIndex)) { if (this.CurrentBag != destinationIndex) { // turn off the current bag and turn on the new bag this.BagButtons[this.CurrentBag].IsOn = false; this.BagButtons[destinationIndex].IsOn = true; this.CurrentBag = destinationIndex; this.BagSackPanel.Sack = this.Player.GetSack(this.CurrentBag + this.BagPanelOffset); this.BagSackPanel.CurrentSack = this.CurrentBag; } } } }