void spellQueueListBox_ItemDoubleClick(object sender, MouseButtonEventArgs e) { var listBoxItem = sender as ListBoxItem; if (listBoxItem == null) return; var queueItem = listBoxItem.Content as SpellQueueItem; if (queueItem == null) return; if (selectedMacro == null) return; var player = selectedMacro.Client; var spell = player.Spellbook.GetSpell(queueItem.Name); if (spell == null) return; var dialog = new SpellTargetWindow(spell, queueItem); dialog.Owner = this; var result = dialog.ShowDialog(); if (!result.HasValue || !result.Value) return; dialog.SpellQueueItem.CopyTo(queueItem); }
void spellListBox_ItemDoubleClick(object sender, MouseButtonEventArgs e) { var item = sender as ListBoxItem; if (item == null) return; var spell = item.Content as Spell; if (spell == null) return; var player = clientListBox.SelectedItem as Player; if (player == null) return; if (spell.IsEmpty || string.IsNullOrWhiteSpace(spell.Name)) return; if (spell.TargetMode == SpellTargetMode.TextInput) { this.ShowMessageBox("Not Supported", "This spell requires a user text input and cannot be macroed.", "Only spells with no target or a single target can be macroed.", MessageBoxButton.OK, 500, 240); return; } if (selectedMacro == null) return; var spellTargetWindow = new SpellTargetWindow(spell); spellTargetWindow.Owner = this; var result = spellTargetWindow.ShowDialog(); if (!result.HasValue || !result.Value) return; var queueItem = spellTargetWindow.SpellQueueItem; var isAlreadyQueued = selectedMacro.IsSpellInQueue(queueItem.Name); if (isAlreadyQueued && UserSettingsManager.Instance.Settings.WarnOnDuplicateSpells) { var okToAddAgain = this.ShowMessageBox("Already Queued", string.Format("The spell '{0}' is already queued.\nDo you want to queue it again anyways?", spell.Name), "This warning message can be disabled in the Spell Macro settings.", MessageBoxButton.YesNo, 460, 240); if (!okToAddAgain.HasValue || !okToAddAgain.Value) return; } selectedMacro.AddToSpellQueue(queueItem); }