private void stkMediaAttach_Tap(object sender, System.Windows.Input.GestureEventArgs e) { var files = MediaAttach.EnumerateFiles("\\MediaAttach"); if (files.Length == 0) { MessageBox.Show(LocalizedResources.NoFilesAvailable, LocalizedResources.AppTitle, MessageBoxButton.OK); } else { if (MessageBox.Show(LocalizedResources.MediaAttachWarning, LocalizedResources.Warning, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { MediaAttach.AttachImagesToArtists(); MessageBox.Show(LocalizedResources.MediaAttachDone, LocalizedResources.Done, MessageBoxButton.OK); } } }
// Constructor public MainPage() { InitializeComponent(); this.DataContext = App.GlobalViewModel; if (InteropSvc.InteropLib.HasRootAccess() == false) { // double check System.Threading.Thread.Sleep(1000); if (InteropSvc.InteropLib.HasRootAccess() == false) { MessageBox.Show(LocalizedResources.NoRootAccess, LocalizedResources.Error, MessageBoxButton.OK); throw new Exception("Quit"); } } viewModel.BusyStateChanged += new EventHandler(BusyStateChanged); viewModel.SelectedArtistChanged += new EventHandler(viewModel_SelectedArtistChanged); viewModel.SelectedAlbumChanged += new EventHandler(viewModel_SelectedAlbumChanged); viewModel.AlbumsLoaded += new EventHandler(viewModel_AlbumsLoaded); viewModel.SongsLoaded += new EventHandler(viewModel_SongsLoaded); var files = MediaAttach.EnumerateFiles("\\MediaAttach"); VisualStateManager.GoToState(this, "MediaAttach_Hidden", false); if (files.Length > 0) { VisualStateManager.GoToState(this, "MediaAttach_Visible", true); } VisualStateManager.GoToState(this, "ShowArtists", true); if (viewModel.StateRestored) { if (viewModel.SelectedArtist != null) { viewModel_SelectedArtistChanged(null, new EventArgs()); } if (viewModel.SelectedAlbum != null) { viewModel_SelectedAlbumChanged(null, new EventArgs()); } } viewModel.StateRestored = false; }