/// <summary> /// Launcher main window. Creates main window and displays for user interaction. /// </summary> public MainWindow() { InitializeComponent(); var xmlDataProvider = Resources["DataProvider"] as XmlDataProvider; if (xmlDataProvider != null) { xmlDataProvider.Source = new Uri(Path.GetFullPath("UserOptions.xml")); } Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(@"assets\textures\Launcher_MainBackground.png", UriKind.Relative)) }; MusicVolumeMedia.Source = new Uri(@"assets\sounds\launcher\Music.mp3", UriKind.Relative); MusicVolumeMedia.Play(); RefreshGameList(); }
private void LaunchButton_OnClick(object sender, RoutedEventArgs e) { var dataProvider = (Resources["DataProvider"] as XmlDataProvider); if (dataProvider == null) { return; } string source = dataProvider.Source.LocalPath; dataProvider.Document.Save(source); try { MusicVolumeMedia.Stop(); Process.Start(ClientExec); } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Failed to start game"); } }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); MusicVolumeMedia.Play(); }