Example #1
0
        /// <summary>
        /// Начинает отрисовку записи
        /// </summary>
        /// <param name="repUser">Пользователь, у которого сделали репост (null, если нет)</param>
        private void BeginLayoutDesign(User repUser, bool rep)
        {
            if (Copied_Post != null)
            {
                repost.Children.Add(new ctrPost(Copied_Post, repUser, true));
            }

            if (!rep)
            {
                BitmapImage bilikes = new BitmapImage();
                bilikes.BeginInit();
                var streamlike = File.OpenRead(Environment.CurrentDirectory + @"\like.png");
                bilikes.StreamSource = streamlike;
                bilikes.EndInit();
                likesImage.Source = bilikes;

                BitmapImage bireps = new BitmapImage();
                bireps.BeginInit();
                var streamrep = File.OpenRead(Environment.CurrentDirectory + @"\rep.png");
                bireps.StreamSource = streamrep;
                bireps.EndInit();
                repImage.Source = bireps;
            }
            else
            {
                foot.Height             = 0;
                user_ico.Width          = 40;
                user_ico.Height         = 40;
                user_ico_circle.RadiusX = 20;
                user_ico_circle.RadiusY = 20;
                user_ico_circle.Rect    = new Rect(0, 0, 40, 40);
            }
            if (Videos != null)
            {
                videos.Margin = new Thickness(5, 0, 5, 5);
                //-------------adding-videos-------------\\
                foreach (Video vid in Videos)
                {
                    VideoPanel.Add(new ctrVideo(vid));
                }
            }
            if (Photos != null)
            {
                photos.Margin = new Thickness(5, 0, 5, 5);
                //------------adding-photos--------------\\
                foreach (Photo phot in Photos)
                {
                    PhotoPanel.Add(new ctrPhoto(phot));
                }
            }
            if (Poll != null)
            {
                polls.Margin = new Thickness(5, 0, 5, 5);
                //----------------add-poll---------------\\
                PollPanel.Add(new ctrPoll(Poll));
            }
            if (Audios != null)
            {
                foreach (Media.Audio aud in Audios)
                {
                    AudioPanel.Add(new Audio(aud));
                }
            }
            if (Links != null)
            {
                links.Margin = new Thickness(5, 0, 5, 5);
                //----------------add-link---------------\\
                links.Children.Add(new ctrLink(Links[0]));
            }
        }