private void CancelAction(object sender, RoutedEventArgs e) { Button button = sender as Button; MainPageData dataContext = button.DataContext as MainPageData; this.ToggleWriteState(); }
private void ChangeCategory(object sender, SelectionChangedEventArgs e) { ListView listView = sender as ListView; int selectedIndexCategory = listView.SelectedIndex; MainPageData dataContext = listView.DataContext as MainPageData; dataContext.SetActivePrograms(selectedIndexCategory); }
private void SetChannelProgram(object sender, SelectionChangedEventArgs e) { ListView listview = sender as ListView; int selectedIndexProgram = listview.SelectedIndex; if (selectedIndexProgram != -1) { MainPageData dataContext = listview.DataContext as MainPageData; int program = dataContext.ActiveCategory.StartIndex + selectedIndexProgram; Debug.WriteLine("index: {0} - Program: {1}", program, dataContext.Programs.ElementAt(program)); } Debug.WriteLine(selectedIndexProgram); Debug.WriteLine("Set Program"); }
private void DeletePlaylist(object sender, RoutedEventArgs e) { Button button = sender as Button; MainPageData dataContext = button.DataContext as MainPageData; var selectedItem = PlaylistListView.SelectedItem; if (selectedItem != null) { PlaylistModel playlist = dataContext.GetPlaylist(selectedItem.ToString()); if (playlist != null) { dataContext.RemovePlayList(playlist); } } }
private void SetActivePlaylist(object sender, SelectionChangedEventArgs e) { ListView listView = sender as ListView; MainPageData dataContext = listView.DataContext as MainPageData; PlaylistModel selectedItem = listView.SelectedItem as PlaylistModel; if (selectedItem != null) { PlaylistModel playlist = dataContext.GetPlaylist(selectedItem.Name.ToString()); if (playlist != null) { dataContext.ChangePlaylist(playlist); } } }
private void AddPlaylist(object sender, RoutedEventArgs e) { Button button = sender as Button; MainPageData dataContext = button.DataContext as MainPageData; string playlistName = InputText.Text; if (!Utility.IsStringEmpty(playlistName)) { Debug.WriteLine("Adding playlist"); PlaylistModel playlist = new PlaylistModel(playlistName, new List <MidiFile>()); dataContext.SetPlaylist(playlist); Debug.WriteLine("Actualizando dataContext"); this.DataContext = dataContext; } this.ToggleWriteState(); InputText.Text = string.Empty; }
private void EditPlaylist(object sender, RoutedEventArgs e) { Button button = sender as Button; MainPageData dataContext = button.DataContext as MainPageData; }