/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); } if (e.PreviousExecutionState != ApplicationExecutionState.Running) { if (!await FileManager.UsesDavDataModelAsync()) { bool loadState = e.PreviousExecutionState == ApplicationExecutionState.Terminated; UpgradeDataSplashScreen upgradeDataSplashScreen = new UpgradeDataSplashScreen(e.SplashScreen, loadState); Window.Current.Content = upgradeDataSplashScreen; } } // Check if app was launched from a secondary tile if (!string.IsNullOrEmpty(e.Arguments)) { Guid?soundUuid = FileManager.ConvertStringToGuid(e.Arguments); if (soundUuid.HasValue) { await SoundPage.PlaySoundAsync(await FileManager.GetSoundAsync(soundUuid.Value)); } } Window.Current.Activate(); }
private async Task RemovePlayingSoundAsync() { if (PlayingSound.MediaPlayer != null) { PlayingSound.MediaPlayer.Pause(); MediaPlayerElement.MediaPlayer.MediaEnded -= Player_MediaEnded; ((MediaPlaybackList)PlayingSound.MediaPlayer.Source).CurrentItemChanged -= PlayingSoundTemplate_CurrentItemChanged; MediaPlayerElement.SetMediaPlayer(null); PlayingSoundName.Text = ""; PlayingSound.MediaPlayer.SystemMediaTransportControls.IsEnabled = false; PlayingSound.MediaPlayer = null; } await SoundPage.RemovePlayingSoundAsync(PlayingSound); }
/// <summary> /// /// </summary> private void FileSystemLoaded(string path) { CloseFileSystem(false); openedPath = path; var banner = Core.MEX.ImageResource.GetBanner(); if (banner != null) { labelGameName.Text = banner.MetaData.LongName; pictureBoxBanner.Image = ImageTools.RGBAToBitmap(banner.GetBannerImageRGBA8(), 96, 32); } _fighterPage = new FighterPage(); _fighterPage.Dock = DockStyle.Fill; _musicPage = new MusicPage(); _musicPage.Dock = DockStyle.Fill; _menuPage = new MenuPage(); _menuPage.Dock = DockStyle.Fill; _stagePage = new StagePage(); _stagePage.Dock = DockStyle.Fill; _soundPage = new SoundPage(); _soundPage.Dock = DockStyle.Fill; _fighterPage.Visible = false; _musicPage.Visible = false; _menuPage.Visible = false; _stagePage.Visible = false; _soundPage.Visible = false; Controls.Add(_fighterPage); Controls.Add(_stagePage); Controls.Add(_menuPage); Controls.Add(_musicPage); Controls.Add(_soundPage); _fighterPage.BringToFront(); _stagePage.BringToFront(); _menuPage.BringToFront(); _musicPage.BringToFront(); _soundPage.BringToFront(); CheckCodeUpdate(); }
private static void SoundPage_ctor(On.DevInterface.SoundPage.orig_ctor orig, SoundPage self, DevUI owner, string IDstring, DevUINode parentNode, string name) { DirectoryInfo directoryInfo = new DirectoryInfo("./SoundEffects/Ambient/"); if (!directoryInfo.Exists) { Directory.CreateDirectory(directoryInfo.FullName); CustomWorldMod.Log($"Creating directory at [{directoryInfo.FullName}] to avoid a crash.", true); } try { orig(self, owner, IDstring, parentNode, name); } catch (Exception e) { CustomWorldMod.Log($"SoundPage crashed: \n{e}", true); } List <FileInfo> list = new List <FileInfo>(); foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks) { string customPath = CRExtras.BuildPath(keyValues.Value, CRExtras.CustomFolder.Ambient); directoryInfo = new DirectoryInfo(customPath); if (directoryInfo.Exists) { FileInfo[] array = directoryInfo.GetFiles(); for (int i = 0; i < array.Length; i++) { if (!list.Contains(array[i]) && !array[i].Name.Contains("meta")) { CustomWorldMod.Log($"[DevLoadedSoundEffects] Adding ambient sounds {array[i]} from [{keyValues.Key}]", false, CustomWorldMod.DebugLevel.FULL); list.Add(array[i]); } } } else { CustomWorldMod.Log($"[DevLoadedSoundEffects] {keyValues.Key} does not have loaded ambient sounds at {directoryInfo.FullName}", false, CustomWorldMod.DebugLevel.FULL); } directoryInfo = new DirectoryInfo(customPath + "SoundEffects/Ambient/"); if (directoryInfo.Exists) { FileInfo[] array = directoryInfo.GetFiles(); for (int j = 0; j < array.Length; j++) { bool flag = true; for (int k = 0; k < list.Count; k++) { if (list[k].Name == array[k].Name) { flag = false; break; } } if (flag) { CustomWorldMod.Log($"[DevLoadedSoundEffects/Ambient] Adding ambient sounds {array[j]} from [{keyValues.Key}]", false, CustomWorldMod.DebugLevel.FULL); list.Add(array[j]); } } } else { CustomWorldMod.Log($"{keyValues.Key} does not have ambient sounds at {directoryInfo.FullName}", false, CustomWorldMod.DebugLevel.FULL); } } List <FileInfo> currentFiles = new List <FileInfo>(self.files); for (int a = list.Count - 1; a >= 0; a--) { currentFiles.Insert(0, list[a]); } self.files = currentFiles.ToArray(); CustomWorldMod.Log($"[DevLoadedSoundEffects] Loaded ambient sounds: [{string.Join(", ", self.files.Select(l => l.Name).ToArray())}]", false, CustomWorldMod.DebugLevel.FULL); self.totalFilePages = 1 + (int)((float)self.files.Length / (float)self.maxFilesPerPage + 0.5f); self.RefreshFilesPage(); }