コード例 #1
0
        private void ReplaceHide_Completed(object sender, object e)
        {
            flipView.Items.Clear();
            dispatcherTimer.Stop();
            Post p = (Post)navListView.SelectedItem;

            detailTitle.Text   = p.Title;
            DetailContent.Text = p.Content;
            if (p.TypePost == 1)
            {
                mediaElement.Source     = new Uri(p.Media);
                mediaElement.Visibility = Visibility.Visible;
                mediaElement.Play();
                flipView.Visibility = Visibility.Collapsed;
            }
            else
            {
                flipView.Visibility     = Visibility.Visible;
                mediaElement.Visibility = Visibility.Collapsed;
                mediaElement.Stop();
                string[] res = p.Media.Split(',');
                for (int i = 0; i < res.Length; i++)
                {
                    if (res[i].Trim() == "")
                    {
                        continue;
                    }
                    Image img = new Image();
                    img.Source  = new BitmapImage(new Uri(res[i]));
                    img.Stretch = Stretch.Uniform;
                    flipView.Items.Add(img);
                }
                dispatcherTimer.Start();
                lasttime = DateTimeOffset.Now;
            }
            ReplaceShow.Begin();
        }
コード例 #2
0
        private void ReplaceHide_Completed(object sender, object e)
        {
            Post p = (Post)navListView.SelectedItem;

            flipView.Items.Clear();
            dispatcherTimer.Stop();
            DetailContent.Text = p.Content;
            flipView.Items.Clear();
            if (p.TypePost == 1)
            {
                MediaElement me = new MediaElement();
                me.Source    = new Uri(p.Media);
                me.Stretch   = Stretch.Uniform;
                me.IsLooping = true;
                me.AutoPlay  = true;
                flipView.Items.Add(me);
            }
            else
            {
                string[] res = p.Media.Split(',');
                for (int i = 0; i < res.Length; i++)
                {
                    if (res[i].Trim() == "")
                    {
                        continue;
                    }
                    Image img = new Image();
                    img.Source  = new BitmapImage(new Uri(res[i]));
                    img.Stretch = Stretch.Uniform;
                    flipView.Items.Add(img);
                }
            }
            dispatcherTimer.Start();
            lasttime = DateTimeOffset.Now;
            ReplaceShow.Begin();
        }