Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string           accessToken = Wx.accessToken;
                List <NewsModel> News        = new List <NewsModel>();
                int count;
                int.TryParse(Request.Form["lineCount"], out count);
                string Author   = "计算机应用技术2班20150301241梁阔雄";
                string AuthorID = Request.Form["AuthorID"];
                for (int i = 0; i < count; ++i)
                {
                    var file = Request.Files["Img" + i.ToString()];
                    if (file != null && !string.IsNullOrEmpty(file.FileName))
                    {
                        var r = Media2.UploadForeverMedia(Wx.accessToken, file);
                        News.Add(new NewsModel
                        {
                            title              = Request.Form["Title" + i.ToString()],
                            content            = Request.Form["Content" + i.ToString()],
                            content_source_url = Request.Form["Url" + i.ToString()],
                            author             = Author,
                            thumb_media_id     = r.media_id
                        });
                    }
                }

                if (News.Count > 0)
                {
                    var r1 = MediaApi.UploadNews(Wx.accessToken, News.ToArray());
                    var r2 = GroupMessageApi.SendGroupMessagePreview(Wx.accessToken, GroupMessageType.mpnews, r1.media_id, AuthorID);
                    ClientScript.RegisterStartupScript(GetType(), "1", "alert('成功发送消息');", true);
                }
            }
        }
Esempio n. 2
0
 public void media_play2()
 {
     Media2.Source = new Uri(m_uri2);
     if (Media2.IsOpen)
     {
         Media2.Open(Media2.Source);
     }
 }
 private void PlayButton_Click_1(object sender, RoutedEventArgs e)
 {
     if (playButton2.Content.ToString() == "Play")
     {
         Media2.Play(); playButton2.Content = "Pause";
     }
     else
     {
         Media2.Pause(); playButton2.Content = "Play";
     }
 }
Esempio n. 4
0
 private void Media2_Loaded(object sender, RoutedEventArgs e)
 {
     Media2.Position = TimeSpan.Zero;
     Media2.Play();
 }
Esempio n. 5
0
 private void MediaElement2_MediaEnded(object sender, RoutedEventArgs e)
 {
     Media2.Stop();
     Media2.Position = TimeSpan.Zero;
     Media2.Play();
 }
 private void RestartButton_Click_1(object sender, RoutedEventArgs e)
 {
     Media2.Stop();
     Media2.Play();
 }
 private void StopButton_Click_1(object sender, RoutedEventArgs e)
 {
     playButton2.Content = "Play";
     Media2.Stop();
 }