Ejemplo n.º 1
0
        private void Notes_OpenNoteMouseClick(object sender, RoutedEventArgs e)
        {
            var currentNote = (Notes)((Button)sender).Tag;

            OneNote.articleId = currentNote.NotesId;
            var currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;

            if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AnonimPage"))
            {
                OneNote one = new OneNote();
                one.Name.Text   = currentNote.Name;
                one.Author.Text = currentNote.Author;
                if (currentNote.Note != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentNote.Note);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentNote.Description != null)
                {
                    one.Description.Text = currentNote.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as AnonimPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "UserPage"))
            {
                OneNote one = new OneNote();
                one.Name.Text   = currentNote.Name;
                one.Author.Text = currentNote.Author;
                if (currentNote.Note != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentNote.Note);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentNote.Description != null)
                {
                    one.Description.Text = currentNote.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as UserPages.UserPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AdminPage"))
            {
                OneNote one = new OneNote();
                one.Name.Text   = currentNote.Name;
                one.Author.Text = currentNote.Author;
                if (currentNote.Note != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentNote.Note);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                if (currentNote.Description != null)
                {
                    one.Description.Text = currentNote.Description;
                }
                else
                {
                    one.Description.Visibility = Visibility.Collapsed;
                }
                (currentPage as AdminPage).CurrentPage.Navigate(one);
            }
        }