Ejemplo n.º 1
0
 internal ReloggerEventArgs(AccountClass account = null, Scheduler scheduler = null,
                            ERelogEventArgsType type = ERelogEventArgsType.OnUnknown)
 {
     Account = account;
     Scheduler = scheduler;
     Type = type;
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 internal Scheduler(AccountClass account = null)
 {
     Account = account;
     ManuallyScheduled = false;
     StartTime = DateTime.Now;
     EndTime = DateTime.Now.AddYears(1);
     BotPath = AppDomain.CurrentDomain.BaseDirectory;
     BreakObject = new BottingBreak();
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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;
     }
 }
Ejemplo n.º 6
0
 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));
 }
Ejemplo n.º 7
0
 internal void AddAccount(AccountClass account)
 {
     AccountSettings.Add(account);
     SchedulerSettings.Add(new Scheduler(account));
     account.SetIndex(AccountSettings.Count - 1);
 }
Ejemplo n.º 8
0
 internal bool AccountExists(AccountClass account)
 {
     return AccountSettings.Contains(account) || AccountSettings.Any(ac => ac.LoginName == account.LoginName);
 }
Ejemplo n.º 9
0
 private void SetControlText(AccountClass account)
 {
     lblLogin.Text = account.LoginName;
     lblPassword.Text = account.Password;
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 11
0
 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.");
     }
 }
Ejemplo n.º 12
0
        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();
            }
        }
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
 internal void SetAccount(AccountClass newAccount)
 {
     Account = newAccount;
 }