Example #1
0
        private void Song_OpenSongMouseClick(object sender, RoutedEventArgs e)
        {
            var currentSong = (Songs)((Button)sender).Tag;

            musicID        = currentSong.SongsId;
            OneSong.songID = currentSong.SongsId;
            var currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;

            if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AnonimPage"))
            {
                OneSong one = new OneSong();
                one.Name.Text   = currentSong.Name;
                one.Author.Text = currentSong.Author;
                one.Text.Text   = currentSong.Text;
                one.ChordsComboBox.Visibility = Visibility.Collapsed;
                one.Source.Visibility         = Visibility.Collapsed;
                if (currentSong.Music != null)
                {
                    one.Music.Visibility = Visibility.Visible;
                }
                else
                {
                    one.Music.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentSong.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Description != null)
                {
                    one.Description.Text = currentSong.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as AnonimPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "UserPage"))
            {
                OneSong one = new OneSong();
                one.Name.Text   = currentSong.Name;
                one.Author.Text = currentSong.Author;
                one.Text.Text   = currentSong.Text;
                one.ChordsComboBox.Visibility = Visibility.Collapsed;
                one.Source.Visibility         = Visibility.Collapsed;
                if (currentSong.Music != null)
                {
                    one.Music.Visibility = Visibility.Visible;
                }
                else
                {
                    one.Music.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentSong.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Description != null)
                {
                    one.Description.Text = currentSong.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as UserPages.UserPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AdminPage"))
            {
                OneSong one = new OneSong();
                one.Name.Text   = currentSong.Name;
                one.Author.Text = currentSong.Author;
                one.Text.Text   = currentSong.Text;
                one.ChordsComboBox.Visibility = Visibility.Collapsed;
                one.Source.Visibility         = Visibility.Collapsed;
                if (currentSong.Music != null)
                {
                    one.Music.Visibility = Visibility.Visible;
                }
                else
                {
                    one.Music.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentSong.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentSong.Description != null)
                {
                    one.Description.Text = currentSong.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as AdminPage).CurrentPage.Navigate(one);
            }
        }
Example #2
0
        private void Song_UpdateSongMouseClick(object sender, RoutedEventArgs e)
        {
            OracleDbContext db          = new OracleDbContext();
            var             currentSong = (Songs)((Button)sender).Tag;

            musicID        = currentSong.SongsId;
            OneSong.songID = currentSong.SongsId;
            var     currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;
            OneSong one         = new OneSong();

            one.Name.Text   = currentSong.Name;
            one.Author.Text = currentSong.Author;
            one.Text.Text   = currentSong.Text;
            one.ChordsComboBox.Visibility = Visibility.Visible;
            one.Source.Visibility         = Visibility.Visible;
            if (currentSong.Music != null)
            {
                //CreateFileMP3();
                //one.MediaElem.Source = new Uri("music.mp3", UriKind.Relative);
                one.Music.Visibility = Visibility.Visible;
            }
            else
            {
                one.Music.Visibility = Visibility.Collapsed;
            }
            if (currentSong.Image != null)
            {
                one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentSong.Image);
            }
            else
            {
                one.Source.Visibility = Visibility.Collapsed;
            }
            if (currentSong.Description != null)
            {
                one.Description.Text = currentSong.Description;
            }
            else
            {
                one.Description.Visibility = Visibility.Collapsed;
            }
            (currentPage as AdminPage).CurrentPage.Navigate(one);

            one.Name.Visibility        = Visibility.Collapsed;
            one.NameTextBox.Visibility = Visibility.Visible;
            if (currentSong.Name == null && currentSong.Author == null && currentSong.Description == null && currentSong.Text == null)
            {
                one.NameTextBox.Text       = "Name";
                one.AuthorTextBox.Text     = "Author";
                one.DescriptionEditor.Text = "Description";
                one.TextEditor.Text        = "Text";
            }
            one.Author.Visibility            = Visibility.Collapsed;
            one.AuthorTextBox.Visibility     = Visibility.Visible;
            one.Text.Visibility              = Visibility.Collapsed;
            one.TextEditor.Visibility        = Visibility.Visible;
            one.Description.Visibility       = Visibility.Collapsed;
            one.DescriptionEditor.Visibility = Visibility.Visible;
            one.MusicAdd.Visibility          = Visibility.Visible;
            one.AddImageButton.Visibility    = Visibility.Visible;
            one.ChordSongCard.Visibility     = Visibility.Visible;

            one.SaveStackPanel.Visibility = Visibility.Visible;

            one.NewImage.Visibility = Visibility.Visible;

            OneSong.songID = currentSong.SongsId;
        }