Пример #1
0
        /// <summary>
        /// Loads all account from file
        /// </summary>
        private void loadAccounts()
        {
            /*Reset current values*/
            accountCurrent = null;
            accountList.Clear();
            accountListBox.Items.Clear();

            /*Get accounts from save list and load them up*/
            var unloadedList = new List <string>();
            var accList      = FileHandler.GetAllAccounts();

            if (accList.Count > 0)
            {
                lock (accList)
                {
                    foreach (var accHolder in accList)
                    {
                        if (!accHolder.loaded)
                        {
                            /*This account wasn't loaded successfully*/
                            /*We'll add it in a seperate list to display*/
                            unloadedList.Add(accHolder.filename);
                            continue;
                        }
                        else
                        {
                            /*This was loaded*/
                            accountList.Add(accHolder.account);
                        }

                        /*Add the account*/
                        accountListBox.Items.Add(accHolder.account.AccountName);
                        if (!notifyMenu.Items.ContainsKey(accHolder.account.AccountName))
                        {
                            /*Add account to notifyMenu (contextMenuStrip attatched to notifyIcon) so user can access things quickly*/
                            ToolStripMenuItem tsm = new ToolStripMenuItem();
                            tsm.Text = accHolder.account.AccountName;
                            tsm.DropDownItems.Add("Copy Steam Guard code", null, new EventHandler(menuGetCode_Click));
                            tsm.DropDownItems.Add("Accept all trades", null, new EventHandler(menuAcceptTrades_Click));
                            notifyMenu.Items.Add(tsm);
                        }
                    }
                }
                accountListBox.SelectedIndex = 0;
            }

            /*If we haven't already displayed the list of unloaded accounts, do it here*/
            if (!applicationShownUnloadedAccounts && unloadedList.Count > 0)
            {
                notloadedForm                    = new NotloadedForm(unloadedList);
                notloadedBtn.Text                = string.Format("{0} accounts not loaded", unloadedList.Count);
                notloadedBtn.Visible             = true;
                applicationShownUnloadedAccounts = true;
            }
        }
Пример #2
0
        /// <summary>
        /// Loads all account from file
        /// </summary>
        private void loadAccounts()
        {
            /*Reset current values*/
            accountCurrent = null;
            accountList.Clear();
            accountListBox.Items.Clear();

            /*Get accounts from save list and load them up*/
            var unloadedList = new List<string>();
            var accList = FileHandler.GetAllAccounts();
            if (accList.Count > 0)
            {
                lock (accList)
                {
                    foreach (var accHolder in accList)
                    {
                        if (!accHolder.loaded)
                        {
                            /*This account wasn't loaded successfully*/
                            /*We'll add it in a seperate list to display*/
                            unloadedList.Add(accHolder.filename);
                            continue;
                        }
                        else
                        {
                            /*This was loaded*/
                            accountList.Add(accHolder.account);
                        }

                        /*Add the account*/
                        accountListBox.Items.Add(accHolder.account.AccountName);
                        if (!notifyMenu.Items.ContainsKey(accHolder.account.AccountName))
                        {
                            /*Add account to notifyMenu (contextMenuStrip attatched to notifyIcon) so user can access things quickly*/
                            ToolStripMenuItem tsm = new ToolStripMenuItem();
                            tsm.Text = accHolder.account.AccountName;
                            tsm.DropDownItems.Add("Copy Steam Guard code", null, new EventHandler(menuGetCode_Click));
                            tsm.DropDownItems.Add("Accept all trades", null, new EventHandler(menuAcceptTrades_Click));
                            notifyMenu.Items.Add(tsm);
                        }
                    }
                }
                accountListBox.SelectedIndex = 0;
            }

            /*If we haven't already displayed the list of unloaded accounts, do it here*/
            if (!applicationShownUnloadedAccounts && unloadedList.Count > 0)
            {
                notloadedForm = new NotloadedForm(unloadedList);
                notloadedBtn.Text = string.Format("{0} accounts not loaded", unloadedList.Count);
                notloadedBtn.Visible = true;
                applicationShownUnloadedAccounts = true;
            }
        }