예제 #1
0
 private void InitializeAllVideos(out List <FolderInfo> folderList)
 {
     folderList = new List <FolderInfo>();
     //루트 폴더 목록을 로드
     folderDAO.LoadRootFolderList(folderList, null, null, false);
     //모든 비디오 초기화
     fileDAO.DeleteAllVideos();
     //모든 자막 초기화
     fileDAO.DeleteSubtitles();
 }
예제 #2
0
        private async void LoadRootFolders()
        {
            try
            {
                //폴더 추가 버튼
                await DispatcherHelper.RunAsync(async() =>
                {
                    if (ExplorerFolderSource.Count > 0)
                    {
                        ExplorerFolderSource.Clear();
                    }

                    if (ExplorerFileSource.Count > 0)
                    {
                        ExplorerFileSource.Clear();
                    }

                    //탐색기 루트를 로드
                    folderDAO.LoadRootFolderList(ExplorerFolderSource, LockFolderCommand, RemoveFolderCommand, true);

                    ExplorerFolderSource.Add(new FolderInfo()
                    {
                        Name        = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView().GetString("AddFolder"),
                        Glyph1      = "\xE109", //&#xE109;
                        Type        = FolderType.Picker,
                        IsHighlight = ExplorerFolderSource.Count == 0,
                        Level       = 1
                    });

                    ///////////////////////////// 윈10 10549 버그 Workaround//////////////////////////////////
                    if (VersionHelper.WindowsVersion == 10 && !ExplorerFolderSource.Any(x => x.Type != FolderType.Picker))
                    {
                        List <StorageFolder> folders = new List <StorageFolder>();
                        folders.Add(KnownFolders.VideosLibrary);

                        var external = await KnownFolders.RemovableDevices.GetFoldersAsync();
                        if (external != null && external.Any())
                        {
                            folders.AddRange(external);
                        }

                        foreach (var folder in folders)
                        {
                            bool found = false;
                            //중복된 폴더는 추가하지 않음
                            foreach (var added in ExplorerFolderSource)
                            {
                                var sf = await added.GetStorageFolder(true);
                                if (sf != null && sf.FolderRelativeId == folder.FolderRelativeId)
                                {
                                    found = true;
                                    break;
                                }
                            }

                            if (!found)
                            {
                                //전체 비디오에 반영
                                var folderInfo = new FolderInfo(folder)
                                {
                                    Level = 1,
                                    Type  = FolderType.Root,
                                    ButtonTappedCommand1 = LockFolderCommand,
                                    ButtonTappedCommand2 = RemoveFolderCommand,
                                    Passcode             = string.Empty
                                };

                                //선택한 폴더 DB등록
                                folderDAO.Insert(folderInfo);

                                var addFolder         = ExplorerFolderSource.FirstOrDefault(x => x.Type == FolderType.Picker);
                                addFolder.IsHighlight = false;
                                var index             = ExplorerFolderSource.IndexOf(addFolder);
                                ExplorerFolderSource.Insert(index, folderInfo);

                                //전체 비디오에 반영
                                MessengerInstance.Send <Message>(new Message("FolderAdded", folderInfo), AllVideoViewModel.NAME);
                            }
                        }
                    }
                    //////////////////////////////////////////////////////////////////////////////////////////
                });
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }