// Action that is run when start stop button or hotkey is pressed private void Start_Stop_Action(string index) { MessageBoxCustom.Close_current(); if (spammers.ContainsKey(index)) { Spammer spammer = spammers[index]; if (spammer.isSpamming) { DeactivateSpammer(spammer, index); } else { try { spammer.f_key = GetFKeyFromInput(index); } catch (NoFKeyException) { new MessageBoxCustom("Please select a F-Key."); return; } spammer.SetFBar(GetSkillBarFromInput(index)); spammer.delay_ms = GetDelayFromInput(index); ActivateSpammer(spammer, index); } } else { new MessageBoxCustom("Please select a Process."); } }
// attaches the spammer to the correct index public void AttachSpammer(string index, Spammer spammer, string spammerName) { Label label = GetLabelFromIndex(index); label.Content += spammerName; label.Opacity = 1.0; spammers[index] = spammer; }
// activates the spammer private void ActivateSpammer(Spammer spammer, string index) { try { spammer.startSpam(); } catch (InvalidDelayException) { new MessageBoxCustom("Make sure to set a Delay ≥ " + Spammer.Min_delay + " ms."); return; } ToggleStartIcon(index); }
private void Select_Process_Click(object sender, RoutedEventArgs e) { if (ProcessList.SelectedItem != null) { Process neuz = ProcessList.SelectedItem as Process; Spammer spam = new Spammer(neuz, mainWindow); mainWindow.AttachSpammer(index, spam, neuz.MainWindowTitle); Close(); mainWindow.closeProcessSelector(); } else { //Nothing happens } }
// deactivates the spammer private void DeactivateSpammer(Spammer spammer, string index) { spammer.stopSpam(); ToggleStartIcon(index); }