Example #1
0
        // sort by
        // edits
        // name

        public string GetChangedFiles(EditSort sort)
        {
            List <string> pathsList;


            int colW = Collection.Max(fci => fci.Name.Length);

            colW++;
            // time (usually last time edited)
            string header;

            switch (sort)
            {
            case EditSort.NAME:
            default:
                header    = "File\u2193".PadRight((colW)) + " Edits" + "   Time";
                pathsList = Collection
                            .OrderByDescending(fci => fci.DateTime)
                            .OrderBy(fci => fci.Name)
                            .GroupBy(fci => fci.Path)
                            .Select(g => _format(g, colW))
                            .ToList();
                break;

            case EditSort.EDIT_COUNT:
                header    = "File".PadRight((colW)) + " Edits\u2191" + "  Time";
                pathsList = Collection
                            .OrderByDescending(fci => fci.DateTime)
                            .GroupBy(fci => fci.Path)
                            .OrderByDescending(grp => grp.Count())
                            .Select(g => _format(g, colW))
                            .ToList();
                break;

            case EditSort.FIRST_EDIT:
                header    = "File".PadRight((colW)) + " Edits" + "   Time" + "\u2193";
                pathsList = Collection
                            .OrderBy(fci => fci.DateTime)
                            .GroupBy(fci => fci.Path)
                            .Select(g => _format(g, colW))
                            .ToList();
                break;

            case EditSort.LAST_EDIT:
                header    = "File".PadRight((colW)) + " Edits" + "   Time" + "\u2191";
                pathsList = Collection
                            .OrderByDescending(fci => fci.DateTime)
                            .GroupBy(fci => fci.Path)
                            .Select(g => _format(g, colW))
                            .ToList();
                break;
            }

            pathsList.Insert(0, header);
            return(string.Join(Environment.NewLine, pathsList));
        }
Example #2
0
 private void _setEditSort(EditSort editSort)
 {
     foreach (ToolStripItem dropDownItem in dayInfoSortToolStripMenuItem.DropDownItems)
     {
         ToolStripRadioButtonMenuItem rb = dropDownItem as ToolStripRadioButtonMenuItem;
         if (rb != null && ((EditSort)rb.Tag) == editSort)
         {
             rb.Checked = true;
         }
     }
 }