Win.CodeNavi.frmMain.AddAndSaveCodePath C# (CSharp) Method

AddAndSaveCodePath() private method

Saves the code path
private AddAndSaveCodePath ( ) : void
return void
        private void AddAndSaveCodePath()
        {
            // So we first the new path and search term to the history
            // we then prune the oldist
            if (txtCodePath.Items.Count > 0 && txtCodePath.Text.Equals(txtCodePath.Items[0]) == false)
            {
                txtCodePath.Items.Insert(0, txtCodePath.Text);
                if (txtCodePath.Items.Count > 20)
                {
                    while (txtCodePath.Items.Count > 20)
                    {
                        txtCodePath.Items.RemoveAt(20);
                    }
                }
            }
            else
            {
                txtCodePath.Items.Insert(0, txtCodePath.Text);
            }

            // This saves the paths so they are persistent over runs
            StringCollection strCodePathCollection = new StringCollection();
            foreach (String strPath in txtCodePath.Items)
            {
                strCodePathCollection.Add(strPath);
            }
            Properties.Settings.Default.CodeFolders = strCodePathCollection;
            Properties.Settings.Default.Save();
        }