private void OpenFileList() { if (fileListViewController == null) { fileListViewController = BeatSaberUI.CreateViewController <FileListViewController>(); } if (panel == null) { panel = MediaPanel.Create(); } if (mainModNavigationController.GetField <List <VRUIViewController> >("_viewControllers").IndexOf(fileListViewController) < 0) { SetViewControllersToNavigationConctroller(mainModNavigationController, new VRUIViewController[] { fileListViewController }); fileListViewController.SetFiles(LoadMediaFiles()); fileListViewController.FileSelected += (file) => { panel.SetMediaSource(file.Path); panel.StartVideo(); }; } }
public override T GetPanel <T>(params object[] parameters) { try { var mediaPanel = new MediaPanel(); var context = mediaPanel.DataContext as MediaPanelContext; var settingsWindow = VA.Components.Get <SettingsWindow>(); if (context != null) { Settings.ApplyToProperties(context, "Music-Directory", "Video-Directory"); context.MusicLabel = string.Format(StringResource.MediaPlugin_MusicDirectoryLabelContentFormat, MusicControl.Player.Indexer.SongList.Count); context.VideoLabel = string.Format(StringResource.MediaPlugin_VideoDirectoryLabelContentFormat, VideoWindow.Player.Indexer.VideoList.Count); context.MusicBrowseAction = () => { try { var dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var selectedPath = dialog.SelectedPath; Settings["Music-Directory"].Value = context.MusicDirectory = selectedPath; settingsWindow.DisplayMessage(Name, StringResource.MediaPlugin_IndexingMessage); MusicControl.Player.Indexer.ClearCache(); MusicControl.Player.Indexer.StartIndexing(selectedPath); VA.SettingsManager.Save(Settings); } } catch (Exception exception) { VA.Logger.Error(exception); } }; context.VideoBrowseAction = () => { try { var dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var selectedPath = dialog.SelectedPath; Settings["Video-Directory"].Value = context.VideoDirectory = selectedPath; settingsWindow.DisplayMessage(Name, Settings["Indexing-Message"].Value); VideoWindow.Player.Indexer.ClearCache(); VideoWindow.Player.Indexer.StartIndexing(selectedPath); VA.SettingsManager.Save(Settings); } } catch (Exception exception) { VA.Logger.Error(exception); } }; } return(mediaPanel as T); } catch (Exception exception) { VA.Logger.Error(exception); } return(null); }
public static void Initalize(MediaPanel media) { _Media = media; }