当前位置: 首页>>代码示例>>C#>>正文


C# Playlist.showPlaylist方法代码示例

本文整理汇总了C#中Playlist.showPlaylist方法的典型用法代码示例。如果您正苦于以下问题:C# Playlist.showPlaylist方法的具体用法?C# Playlist.showPlaylist怎么用?C# Playlist.showPlaylist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Playlist的用法示例。


在下文中一共展示了Playlist.showPlaylist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: start

 public static void start()
 {
     int intCursorStartPos = Constants.DEFAULT_CURSOR_START_Y_POS;
     int intCursorCurrentPos = intCursorStartPos;
     int intMaxNumberOfItems = Console.WindowHeight - Constants.NUM_OF_ITEMS_OFFSET; // 3 for top, 3 for bottom
     int playlistStateCounter = 0;
     Playlist objPlaylist = new Playlist ();
     Filelist objFilelist = new Filelist ();
     // Get Files
     objFilelist = getFiles ();
     // Build Screen
     buildScreen();
     objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
     Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " 1/" + objFilelist.getPages().ToString(), ConsoleColor.DarkRed, Util.BACKGROUND);
     Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorStartPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
     do {
         while(! Console.KeyAvailable) {
             switch(Console.ReadKey(true).Key) {
                 case ConsoleKey.DownArrow:
                         intCursorCurrentPos++;
                         if(intCursorCurrentPos > (intMaxNumberOfItems + intCursorStartPos - 1)) { intCursorCurrentPos = (intMaxNumberOfItems + intCursorStartPos - 1); }
                         if(objFilelist.getFilelist().Count <= (intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())) {
                             intCursorCurrentPos--;
                         }
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS, intCursorCurrentPos - 1, "   ", ConsoleColor.Blue, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                 break;
                 case ConsoleKey.UpArrow:
                         intCursorCurrentPos--;
                         if(intCursorCurrentPos < intCursorStartPos) { intCursorCurrentPos = intCursorStartPos; }
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS, intCursorCurrentPos + 1, "   ", ConsoleColor.Blue, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.LeftArrow:
                     break;
                 case ConsoleKey.RightArrow:
                     break;
                 case ConsoleKey.Delete:
                     break;
                 case ConsoleKey.W:
                         // TODO: Switch windows: File list to play list and vice versa
                     break;
                 case ConsoleKey.F1:
                         objPlaylist.pageOffsetInc();
                         if(objPlaylist.getPageOffset() > (objPlaylist.getPages() - 1)) { objPlaylist.setPageOffset(objPlaylist.getPages() - 1); }
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                         Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F2:
                         objPlaylist.pageOffsetDec();
                         if(objPlaylist.getPageOffset() < 0) { objPlaylist.setPageOffset(0); }
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                         Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F6:
                         objFilelist.pageOffsetInc();
                         intCursorCurrentPos = intCursorStartPos;
                         if(objFilelist.getPageOffset() > (objFilelist.getPages() - 1)) { objFilelist.setPageOffset(objFilelist.getPages() - 1); }
                         objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
                         Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objFilelist.getPageOffset() + 1).ToString() + "/" + objFilelist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F7:
                         objFilelist.pageOffsetDec();
                         intCursorCurrentPos = intCursorStartPos;
                         if(objFilelist.getPageOffset() < 0) { objFilelist.setPageOffset(0); }
                         objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
                         Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objFilelist.getPageOffset() + 1).ToString() + "/" + objFilelist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.S:
                         if(objPlaylist.getName() == "") {
                             Util.WritePos(Constants.PLAYLIST_NAME_X_OFFSET, Constants.PLAYLIST_NAME_Y_OFFSET, "Enter playlist name: ");
                             objPlaylist.setName(Console.ReadLine());
                         }
                         if(objPlaylist.getName().Substring(objPlaylist.getName().LastIndexOf(".") + 1) == objPlaylist.getName()) {
                             objPlaylist.setName(objPlaylist.getName() + "." + objPlaylist.getFileFormat());
                         } else {
                             objPlaylist.setFileFormat(objPlaylist.getName().Substring(objPlaylist.getName().LastIndexOf(".") + 1));
                         }
                         Writer objWriter = new Writer(objPlaylist);
                         objWriter.writeFile();
                     break;
                 case ConsoleKey.Enter:
                         playlistStateCounter++;
                         if(playlistStateCounter > intMaxNumberOfItems) {
                             playlistStateCounter = 1; objPlaylist.pageOffsetInc();
                             Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         }
                         PlaylistItem objPlaylistItem = new PlaylistItem();
                         objPlaylistItem.setFilename(objFilelist.getFilelist()[(intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())].getFilename());
                         objPlaylistItem.setFullPath(objFilelist.getFilelist()[(intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())].getFullPath());
                         objPlaylist.addItem(objPlaylistItem);
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                     break;
                 case ConsoleKey.Escape:
                         Console.BackgroundColor = ConsoleColor.Black;
                         Console.Clear();
                         Environment.Exit(-1);
                     break;
//.........这里部分代码省略.........
开发者ID:nahooda,项目名称:cmdpls,代码行数:101,代码来源:editor.cs


注:本文中的Playlist.showPlaylist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。