/// <summary> /// Entfernt das aktuelle Zugriffsmodul. /// </summary> /// <param name="startup">Für den ersten Aufruf gesetzt.</param> private void DestroyConnector(bool startup) { // Stop all if (!startup) { try { // Attach to accessor var accessor = Accessor; if (accessor != null) { // Stop sending data accessor.Stop(); // Stop graph accessor.StopGraph(); } // Restart videotext caching from scratch VideoText.Deactivate(true); } catch { // Ignore any error - maybe we are disposing the instance } } // Forget using (m_CurrentConnector) m_CurrentConnector = null; }
/// <summary> /// Der Graph muß neu aufgebaut werden - allerdings auf dem Hauptthread /// der Anwendung. /// </summary> /// <param name="restartGraph">Gesetzt, wenn der Direct Show Graph neu /// aufgebaut werden soll.</param> private void StreamChanged(bool restartGraph) { // With cleanup try { // Load audio map LoadAudio(); // Restart videotext collector VideoText.Deactivate(true); // Disable all OSD HideOSD(); // Restart graph Accessor.SetDecoder(); // Select audio if (m_AudioMap.Count > 0) { if (m_DelayAudio != null) { ShowMessage(SetAudio(m_DelayAudio), Properties.Resources.NameTitle, true); } } } finally { // Discard m_DelayAudio = null; } }
/// <summary> /// Restart the stream completly. /// </summary> public override void StartRecording() { // Stop sending data Accessor.Stop(); // Stop displaying data Accessor.StopGraph(); // Restart videotext caching from scratch VideoText.Deactivate(true); // Start again RestartAudio(true); }
private void LoadTextAnimations() { var text = new VideoText() { MainText = "Testing animation", SubText = "Is it working?", Duration = new TimeSpan(0, 0, 3) }; var animation = new Spinner() { DataContext = text }; Animate(animation, text.Duration); }
/// <summary> /// Beendet die Datenübertragung in den DirectShow Graphen und zusätzlich /// eine eventuell laufende Aufzeichnung. /// </summary> /// <param name="pictureOnly">Gesetzt, wenn die Aufzeichnung selbst weiter laufen soll.</param> private void StopReceivers(bool pictureOnly) { // Stop all consumers we registered Device.RemoveProgramGuideConsumer(ReceiveEPG); Device.SetConsumerState(VideoId, null); Device.SetConsumerState(AudioId, null); Device.SetConsumerState(TextId, null); // Restart videotext caching from scratch VideoText.Deactivate(true); // Partial mode if (pictureOnly) { return; } // Stop reader using (var reader = m_InfoReader) { // Forget m_InfoReader = null; // Enforce proper shutdown if (reader != null) { reader.Cancel(); } } // Reset flag m_HasPendingGroupInformation = false; // Stop portal parser if (null != ServiceParser) { // Stop it ServiceParser.Disable(); // Forget it ServiceParser = null; } // Stop recording, too using (SourceStreamsManager recording = RecordingStream) RecordingStream = null; }
public void AddTextAnimation(VideoText videoText) { FrameworkElement animation = null; switch (videoText.Animation) { case IndoorWorx.Infrastructure.Enums.VideoTextAnimations.FadeCenter: animation = new Fade() { DataContext = videoText }; break; case IndoorWorx.Infrastructure.Enums.VideoTextAnimations.ZoomCenter: animation = new Zoom() { DataContext = videoText }; break; case IndoorWorx.Infrastructure.Enums.VideoTextAnimations.ScrollingCenter: animation = new Scrolling() { DataContext = videoText }; break; case IndoorWorx.Infrastructure.Enums.VideoTextAnimations.Spinner: animation = new Spinner() { DataContext = videoText }; break; default: break; } if (animation != null) { LoadTextAnimation(animation, videoText.Duration); } }
/// <summary> /// Wählt einen anderen Sender. /// </summary> /// <param name="context">Senderbeschreibung abhängig vom Zugriffsmodul.</param> /// <returns>Sendername mit ausgewählter Tonspur oder <i>null</i>.</returns> public override string SetStation(object context) { // Forward if (m_CurrentConnector.SetStation(context) == null) { return(null); } // Reset EPG display ShowCurrentEntry(); // Restart videotext caching from scratch VideoText.Deactivate(true); // Forget EPG data collected so far CurrentEntry = null; NextEntry = null; // Reset audio selection return(RestartAudio(false)); }
private void LoadVideoText(VideoText videoText) { videoText.IsShown = true; View.AddTextAnimation(videoText); }
protected virtual void RefreshTemplate() { Template.Intervals.Clear(); var toRemove = Template.VideoText.Where(x => !string.IsNullOrWhiteSpace(x.Tag)).ToList(); foreach (var tr in toRemove) { Template.VideoText.Remove(tr); } TimeSpan totalDuration = TimeSpan.Zero; int sequence = 0; foreach (var interval in intervals) { CreateIntervals(interval, x => { x.Sequence = sequence++; Template.Intervals.Add(x); totalDuration = totalDuration.Add(x.Duration); }); } Template.SetupIntervalTimes(); Template.Duration = totalDuration; TimeSpan start = TimeSpan.Zero; foreach (var interval in Template.Intervals) { if (interval.ToStart.IsActive) { var countDownFrom = interval.ToStart.Duration.AsTimeSpan(); if (countDownFrom <= start) { var tick = interval.ToStart.Tick.AsTimeSpan(); int numberOfCounts = (int)(countDownFrom.TotalSeconds / tick.TotalSeconds); for (int i = numberOfCounts; i > 0; i--) { var textEntry = new VideoText(); textEntry.Tag = interval.SectionGroup; textEntry.Animation = Infrastructure.Enums.VideoTextAnimations.ZoomCenter; textEntry.Duration = TimeSpan.FromSeconds(Math.Min(1, tick.TotalSeconds)); textEntry.StartTime = start.Subtract(TimeSpan.FromSeconds(tick.TotalSeconds * i)); textEntry.MainText = TimeSpan.FromSeconds(tick.TotalSeconds * i).ToString(); textEntry.SubText = MyLibraryResources.CountdownToStartText; Template.VideoText.Add(textEntry); } } if (!string.IsNullOrWhiteSpace(interval.ToStart.Message)) { var textEntry = new VideoText(); textEntry.Tag = interval.SectionGroup; textEntry.Animation = Infrastructure.Enums.VideoTextAnimations.ZoomCenter; textEntry.Duration = TimeSpan.FromSeconds(1); textEntry.StartTime = start; textEntry.MainText = interval.ToStart.Message; Template.VideoText.Add(textEntry); } } if (interval.ToEnd.IsActive) { var countDownFrom = interval.ToEnd.Duration.AsTimeSpan(); if (countDownFrom < interval.Duration) { var tick = interval.ToEnd.Tick.AsTimeSpan(); int numberOfCounts = (int)(countDownFrom.TotalSeconds / tick.TotalSeconds); for (int i = numberOfCounts; i > 0; i--) { var textEntry = new VideoText(); textEntry.Tag = interval.SectionGroup; textEntry.Animation = Infrastructure.Enums.VideoTextAnimations.ZoomCenter; textEntry.Duration = TimeSpan.FromSeconds(Math.Min(1, tick.TotalSeconds)); textEntry.StartTime = start.Add(interval.Duration).Subtract(TimeSpan.FromSeconds(tick.TotalSeconds * i)); textEntry.MainText = TimeSpan.FromSeconds(tick.TotalSeconds * i).ToString(); textEntry.SubText = MyLibraryResources.CountdownToEndText; Template.VideoText.Add(textEntry); } } if (!string.IsNullOrWhiteSpace(interval.ToEnd.Message)) { var textEntry = new VideoText(); textEntry.Tag = interval.SectionGroup; textEntry.Animation = Infrastructure.Enums.VideoTextAnimations.ZoomCenter; textEntry.Duration = TimeSpan.FromSeconds(1); textEntry.StartTime = start.Add(interval.Duration); textEntry.MainText = interval.ToEnd.Message; Template.VideoText.Add(textEntry); } } start += interval.Duration; } Template.VideoText = new ObservableCollection <VideoText>(Template.VideoText.OrderBy(x => x.StartTime)); }