Beispiel #1
0
 private void FillGameDirectories(IList <GameDirectory> gameDirectories)
 {
     foreach (GameDirectory directory in gameDirectories)
     {
         GameDirectories.Add(new GameDirectoryDto(directory.Directory, directory.GetGames()));
     }
 }
Beispiel #2
0
        public void AddDirectory(object obj)
        {
            using (var dlg = new CommonOpenFileDialog()
            {
                Title = "Choose Directory",
                IsFolderPicker = true,
                AddToMostRecentlyUsedList = false,
                AllowNonFileSystemItems = false,
                EnsureFileExists = true,
                EnsurePathExists = true,
                EnsureReadOnly = false,
                EnsureValidNames = true,
                Multiselect = false,
                ShowPlacesList = true
            })
            {
                if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    controller.AddGameDirectory(dlg.FileName);
                    var gameDirectory    = controller.GetGameDirectory(dlg.FileName);
                    var gameDirectoryDto = new GameDirectoryDto(gameDirectory.Directory, gameDirectory.GetGames());
                    GameDirectories.Add(gameDirectoryDto);

                    SelectedDirectory = GameDirectories.Last(); //for showing the new inserted one
                    controller.SaveDevice();
                }
            }
        }