/// <summary>Initializes a new videofeed and calls for a confirmation from the server. Creates a waiting thread to wait for the server to send a confirmation.</summary> public void EstablishConnectionVF() { waitHandles[3] = new AutoResetEvent(false); videoThread = new Thread(() => { videoFeed = new VideoFeed(); bool result = videoFeed.ConfirmConnection(logic.selectedUnit.vfIpAddress); // Calls for a confirmation from the server based on the selected unit collected from logic if (result == true) { waitHandles[3].Set(); } }); videoThread.IsBackground = true; videoThread.Start(); Thread waitThread = new Thread(() => { if (OnConnectionVF != null) { OnConnectionVF(waitHandles[3].WaitOne(timeout, false)); // Event is thrown when the AutoResetEvent is set or when timeout has run out. } }); waitThread.IsBackground = true; waitThread.Start(); }
private void VideoFeeder_VideoDataUpdated(VideoFeed sender, byte[] bytes) { if (null != videoParser) { videoParser.PushVideoData(0, 0, bytes, bytes.Length); } }
public static VideoFeed[] GetAll(VideoAnimationBinding videoAnimationBinding) { VideoFeed[] result = new VideoFeed[4]; result[0] = Get(videoAnimationBinding.Camera1); result[1] = Get(videoAnimationBinding.Camera2); result[2] = Get(videoAnimationBinding.Camera3); result[3] = Get(videoAnimationBinding.Camera4); return(result); }
VideoFeed[] GetVideoFeeds(string sceneName, string itemName, double videoAnchorHorizontal, double videoAnchorVertical, double videoWidth, double videoHeight) { VideoFeed[] result = new VideoFeed[4]; result[0] = new VideoFeed() { sceneName = sceneName, sourceName = itemName, videoAnchorHorizontal = videoAnchorHorizontal, videoAnchorVertical = videoAnchorVertical, videoWidth = videoWidth, videoHeight = videoHeight }; return(result); }
public IHttpActionResult CreateFeed(string Text, string imageurl, string videourl) { FeedRepository db = new FeedRepository(); UserRepository userRep = new UserRepository(); User user = userRep.GetUserByEmail(User.Identity.Name); if (Text == null || Text == "") { throw new Exception("Text was empty"); } if (imageurl == null && videourl == null) { TextFeed textfeed = new TextFeed(); textfeed.Id = Guid.NewGuid(); textfeed.Text = Text; textfeed.CreatedAt = DateTime.Now; textfeed.CreatorId = user.Id; db.CreateTextFeed(textfeed); return(Ok()); } if (imageurl != null) { ImageFeed imageFeed = new ImageFeed(); imageFeed.Id = Guid.NewGuid(); imageFeed.Text = Text; imageFeed.CreatedAt = DateTime.Now; imageFeed.CreatorId = user.Id; imageFeed.ImageUrl = imageurl; db.CreateImageFeed(imageFeed); return(Ok()); } if (videourl != null) { VideoFeed videoFeed = new VideoFeed(); videoFeed.Id = Guid.NewGuid(); videoFeed.DescriptionText = Text; videoFeed.CreatedAt = DateTime.Now; videoFeed.CreatorId = user.Id; videoFeed.VideoUrl = videourl; db.CreateVideoFeed(videoFeed); return(Ok()); } throw new Exception("No feed was created."); }
public IHttpActionResult UpdateRespect(Guid FeedId, bool Upvote) { FeedRepository db = new FeedRepository(); TextFeed textFeed = db.GetTextFeed(FeedId); ImageFeed ImageFeed = db.GetImageFeed(FeedId); VideoFeed VideoFeed = db.GetVideoFeed(FeedId); Feed feed = null; if (textFeed != null) { feed = textFeed; } if (ImageFeed != null) { feed = ImageFeed; } if (VideoFeed != null) { feed = VideoFeed; } if (Upvote) { feed.Respect++; } else { feed.Respect--; } if (textFeed != null) { db.UpdateTextFeed((TextFeed)feed); } if (ImageFeed != null) { db.UpdateImageFeed((ImageFeed)feed); } if (VideoFeed != null) { db.UpdateVideoFeed((VideoFeed)feed); } return(Ok()); }
public void CreateVideoFeed(VideoFeed feed) { db.VideoFeeds.Add(feed); db.SaveChanges(); }
public void UpdateVideoFeed(VideoFeed feed) { db.VideoFeeds.Attach(feed); db.Entry(feed).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
private void FPV_VideoDataUpdated(VideoFeed sender, byte[] bytes) { videoParser.PushVideoData(0, 0, bytes, bytes.Length); }
public void Run() { VideoFeed.Run(); }
public void Stop() { VideoFeed.Stop(); }
private void VideoForm_FormClosed(object sender, FormClosedEventArgs e) { VideoFeed.Stop(); }
public async Task LoadDataAsync() { var data = await _entertainmentService.GetVideoFeed(); VideoFeed = data; }
private void DownloadAndSaveVideoData(VideoFeed videoFeed, string eventName) { var hasMoreItems = true; int pageIndex = 1; string lastItemTitle = string.Empty; do { SyndicationFeed feed = null; try { using (XmlReader reader = XmlReader.Create(videoFeed.GetBuildVideoFeedUrlByPage(pageIndex, eventName))) { feed = SyndicationFeed.Load(reader); } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } if (feed != null && feed.Items != null && feed.Items.Count() > 0) { //check last item title for match if (lastItemTitle == feed.Items.Last().Title.Text) { break; } foreach (var item in feed.Items) { var title = CleanVideoTitle(item.Title.Text); var video = _videoRepository.FindByTitle(title); if (video == null) { video = SaveVideoData(item, videoFeed.MediaType, eventName, videoFeed.FeedYear); } else { UpdateVideoData(item, videoFeed.MediaType); } //Speakers var creators = GetExtensionElementValue(item, "creator"); if (!string.IsNullOrEmpty(creators)) { var comma = ",".ToCharArray(); var presenterList = creators.Split(comma, StringSplitOptions.RemoveEmptyEntries); if (presenterList.Count() > 0) { foreach (var presenter in presenterList) { var speaker = _speakerRepository.FindByNameAndEventYear(eventName, presenter.Trim(), videoFeed.FeedYear); if (speaker == null) { speaker = _speakerRepository.Add(new Speaker() { Name = presenter.Trim(), EventYear = videoFeed.FeedYear, EventName = eventName }); } var speakerVideo = _speakerVideoRepository.FindBySpeakerIdAndVideoId(speaker.Id, video.Id); if (speakerVideo == null) { _speakerVideoRepository.Add(new SpeakerVideo() { SpeakerId = speaker.Id, VideoId = video.Id }); } } } } } lastItemTitle = feed.Items.Last().Title.Text; pageIndex++; } else { hasMoreItems = false; } }while (hasMoreItems == true); }
//raw data void OnVideoPush(VideoFeed sender, byte[] bytes) { videoParser.PushVideoData(0, 0, bytes, bytes.Length); }
void OnVideoPush(VideoFeed sender, [ReadOnlyArray] ref byte[] bytes) { this.videoParser.PushVideoData(0, 0, bytes, bytes.Length); }
private void VideoForm_Load(object sender, EventArgs e) { VideoFeed.Run(); }