Exemple #1
0
        private void ArticleCard_OpenArticleMouseClick(object sender, RoutedEventArgs e)
        {
            var currentArticle = (Article)((Button)sender).Tag;

            OneArticle.articleId = currentArticle.ArticleId;
            var currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;

            if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AnonimPage"))
            {
                OneArticle one = new OneArticle();
                one.Title.Text = currentArticle.Title;
                one.Text.Text  = currentArticle.Text;

                if (currentArticle.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentArticle.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                (currentPage as AnonimPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "UserPage"))
            {
                OneArticle one = new OneArticle();
                one.Title.Text = currentArticle.Title;
                one.Text.Text  = currentArticle.Text;
                if (currentArticle.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentArticle.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                (currentPage as UserPages.UserPage).CurrentPage.Navigate(one);
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AdminPage"))
            {
                OneArticle one = new OneArticle();
                one.Title.Text = currentArticle.Title;
                one.Text.Text  = currentArticle.Text;
                if (currentArticle.Image != null)
                {
                    one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentArticle.Image);
                }
                else
                {
                    one.Source.Visibility = Visibility.Collapsed;
                }
                (currentPage as AdminPage).CurrentPage.Navigate(one);
            }
        }
Exemple #2
0
        private void Add_UpdateArticleMouseClick(object sender, RoutedEventArgs e)
        {
            var currentArticle = (Article)((Button)sender).Tag;
            var currentPage    = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;

            OneArticle.articleId = currentArticle.ArticleId;
            OneArticle one = new OneArticle();

            one.Title.Text = currentArticle.Title;
            one.Text.Text  = currentArticle.Text;
            if (currentArticle.Image != null)
            {
                one.Source.Source = Pima.ViewModel.Converter.ConvertByteArrayToImage(currentArticle.Image);
            }
            else
            {
                one.Source.Visibility = Visibility.Collapsed;
            }
            (currentPage as AdminPage).CurrentPage.Navigate(one);

            one.Title.Visibility        = Visibility.Collapsed;
            one.TitleTextBox.Visibility = Visibility.Visible;
            if (currentArticle.Title == null && currentArticle.Text == null)
            {
                one.TitleTextBox.Text = "Title";
                one.TextEditor.Text   = "Text";
            }

            one.Text.Visibility       = Visibility.Collapsed;
            one.TextEditor.Visibility = Visibility.Visible;

            one.SaveStackPanel.Visibility = Visibility.Visible;

            one.NewImage.Visibility = Visibility.Visible;

            //one.ID.Content = currentArticle.ArticleId.ToString();
        }