internal ReloggerEventArgs(AccountClass account = null, Scheduler scheduler = null, ERelogEventArgsType type = ERelogEventArgsType.OnUnknown) { Account = account; Scheduler = scheduler; Type = type; }
internal LauncherCustomControl(MetroTabControl tabControl, int totalCount, int activeCount, int newSet, MetroThemeStyle theme, AccountClass account) { _account = account; FixControls(newSet, theme, account); AddControlsToForm(tabControl, activeCount, newSet); ID = totalCount; BindEvents(); }
internal Scheduler(AccountClass account = null) { Account = account; ManuallyScheduled = false; StartTime = DateTime.Now; EndTime = DateTime.Now.AddYears(1); BotPath = AppDomain.CurrentDomain.BaseDirectory; BreakObject = new BottingBreak(); }
internal SchedulerForm(MainForm mainForm, AccountClass account, MetroStyleManager styleManager) { InitializeComponent(styleManager.Theme, styleManager.Style); _account = account; _form = mainForm; StyleManager = styleManager; SetControlText(account); SetTimeFields(); numericUpDown1.Value = 0; BindEvents(); numericUpDown1.ReadOnly = true; SetTotalValue(); UpdateFormAppearance(styleManager); }
internal ManageBreaks(AccountClass account, MetroStyleManager styleManager) { InitializeComponent(); _account = account; StyleManager = styleManager; UpdateFormAppearance(styleManager); Scheduler wanted = Config.Singleton.SchedulerSettings.FirstOrDefault(s => s.Account.LoginName == _account.LoginName); if (wanted != null) { numericUpDown1.Value = (decimal) wanted.BreakObject.TimeSpanInterval.TotalMinutes; numericUpDown2.Value = (decimal) wanted.BreakObject.TimeSpanToAddToLastBreak.TotalMinutes; numericUpDown3.Value = (decimal) wanted.BreakObject.TimeSpanToPause.TotalMinutes; numericUpDown4.Value = (decimal) wanted.BreakObject.TimeSpanToWaitLonger.TotalMinutes; chkBoxEnableBreak.Checked = wanted.BreakObject.BreakEnabled; } }
internal void DeleteAccount(AccountClass account) { if (SchedulerSettings.Any( s => s.Account.LoginName == account.LoginName && s.Account.Password == account.Password)) { SchedulerSettings.Remove( SchedulerSettings.FirstOrDefault( s => s.Account.LoginName == account.LoginName && s.Account.Password == account.Password)); } AccountSettings.Remove( AccountSettings.FirstOrDefault( a => a.LoginName == account.LoginName && a.Password == account.Password)); }
internal void AddAccount(AccountClass account) { AccountSettings.Add(account); SchedulerSettings.Add(new Scheduler(account)); account.SetIndex(AccountSettings.Count - 1); }
internal bool AccountExists(AccountClass account) { return AccountSettings.Contains(account) || AccountSettings.Any(ac => ac.LoginName == account.LoginName); }
private void SetControlText(AccountClass account) { lblLogin.Text = account.LoginName; lblPassword.Text = account.Password; }
private void CreateCustomControlForLauncher(AccountClass account) { _newSet++; var newControl = new LauncherCustomControl(metroTabControl2, LauncherCustomControls.Count, _totalAccounts, _newSet, CurrentThemeStyle, account); newControl.StartClick += NewControlOnStartClick; newControl.KillClick += NewControlOnKillClick; newControl.ScheduleClick += NewControlOnScheduleClick; LauncherCustomControls.Add(newControl); _totalAccounts++; if (_newSet == 10) { _newSet = 0; } metroStyleManager.UpdateOwnerForm(); }
private void AddNewAccount() { var ac = new AccountClass(txtBoxLoginName.Text, txtBoxPassword.Text, chkBoxSound.Checked); if (!string.IsNullOrEmpty(txtBoxLoginName.Text) && !string.IsNullOrEmpty(txtBoxPassword.Text)) { if (!Config.Singleton.AccountExists(ac)) { Config.Singleton.AddScheduler( new Scheduler(ac)); AddAccountToLauncher(Config.Singleton.AccountSettings.Last()); txtBoxLoginName.Text = ""; txtBoxPassword.Text = ""; chkBoxSound.Checked = false; } else { Logger.LoggingObject.Log(Level.Warning, "You have already added an account with the same login information."); } } else { Logger.LoggingObject.Log(Level.Warning, "You have left a necessary field empty. Please try again."); } }
private void AddAccountToLauncher(AccountClass account) { Logger.LoggingObject.Log(Level.Info, "Adding new account to the launcher: {0}.", account.LoginName); metroStyleManager.UpdateOwnerForm(); if (_totalAccounts < 100) { CreateCustomControlForLauncher(account); foreach (Scheduler schedule in Config.Singleton.SchedulerSettings.ToArray()) { double differenceHistory = (DateTime.Now - schedule.EndTime).TotalSeconds; if (schedule.Account.Running) { SetIsRunning(schedule); if (differenceHistory > 0) { DisableSessionDueToScheduleExpiration(schedule); } if (!schedule.ShouldBeRunning) { StopSessionOfExpiredSchedule(schedule); } } else if (!schedule.Account.Running && !schedule.ShouldBeRunning && LauncherCustomControls[schedule.Account.Index].BtnStart.Enabled) { if (differenceHistory > 0) { DisableButtonsOfAccount(schedule); } else { EnableButtonsOfAccount(schedule); } } else { if (!schedule.ShouldBeRunning) { SetIsNotRunning(schedule); } if ((schedule.EndTime - DateTime.Now).TotalSeconds > 0 && (DateTime.Now - schedule.StartTime).TotalSeconds > 0) { EnableButtonsOfAccount(schedule); } else { DisableButtonsOfAccount(schedule); } } } } else { HandleMaxNumberOfPossibleSchedules(); } }
private void FixControls(int newSet, MetroThemeStyle theme, AccountClass account) { LblAccountName.Theme = theme; LblAccountName.Style = MetroColorStyle.Blue; LblAccountName.Text = account.LoginName; LblAccountName.Width = 280; BtnStart.Theme = theme; BtnStart.Style = MetroColorStyle.Blue; BtnStart.Text = "Start"; BtnKill.Theme = theme; BtnKill.Style = MetroColorStyle.Blue; BtnKill.Text = "Stop"; BtnSchedule.Theme = theme; BtnSchedule.Style = MetroColorStyle.Blue; BtnSchedule.Text = "Schedule"; LblStatus.Theme = theme; LblStatus.Style = MetroColorStyle.Blue; LblStatus.Text = "Not Running"; LblStatus.UseStyleColors = true; int heightPosition = (newSet)*30; LblAccountName.Location = new Point(3, heightPosition + 3); BtnStart.Width = 53; BtnStart.Height = 23; BtnKill.Width = 46; BtnKill.Height = 23; BtnSchedule.Width = 75; BtnSchedule.Height = 23; BtnStart.Location = new Point(290, heightPosition); BtnKill.Location = new Point(349, heightPosition); BtnSchedule.Location = new Point(402, heightPosition); LblStatus.Location = new Point(484, heightPosition); }
internal void SetAccount(AccountClass newAccount) { Account = newAccount; }