public void BuildFromDirectory(string Directory) { // Get list of files string[] Files = System.IO.Directory.GetFiles(Directory).OrderBy(x => x).ToArray(); List <TeslaCamFile> CurrentTeslaCams = new List <TeslaCamFile>(); foreach (var File in Files) { try { TeslaCamFile f = new TeslaCamFile(File); CurrentTeslaCams.Add(f); } catch { } } List <string> DistinctEvents = CurrentTeslaCams.Select(e => e.Date.UTCDateString).Distinct().ToList(); foreach (var CurrentEvent in DistinctEvents) { List <TeslaCamFile> MatchedFiles = CurrentTeslaCams.Where(e => e.Date.UTCDateString == CurrentEvent).ToList(); TeslaCamFileSet CurrentFileSet = new TeslaCamFileSet(); CurrentFileSet.SetCollection(MatchedFiles); this.Recordings.Add(CurrentFileSet); } this.Recordings = Recordings.OrderBy(e => e.Date.UTCDateString).ToList(); this.StartDate = Recordings.First().Date; this.EndDate = Recordings.Last().Date; }
private void left_MediaEnded(object sender, RoutedEventArgs e) { try { if (model.EnableAutoPlaylist) { TeslaCamFileSet target = this.model.CurrentPlaybackFile; TeslaCamEventCollection f = model.ListItems.SelectMany(d => d.Events).Where(d => d.Recordings.Contains(target)).First(); if (f != null) { int currentFileIndex = f.Recordings.IndexOf(target); if (f.Recordings.Count - 1 > currentFileIndex) { TeslaCamFileSet nextSet = f.Recordings[currentFileIndex + 1]; paused = false; model.LoadFileSet(nextSet); var tvi = FindTviFromObjectRecursive(treeview, nextSet); if (tvi != null) { tvi.IsSelected = true; } } } } } catch { } }
public void LoadFileSet(TeslaCamFileSet teslaCamFileSet) { MediaElementLeftCamera.Stop(); MediaElementRightCamera.Stop(); MediaElementFrontCamera.Stop(); MediaElementBackCamera.Stop(); var playLeft = false; var playRight = false; var playFront = false; var playBack = false; foreach (var cam in teslaCamFileSet.Cameras) { switch (cam.CameraLocation) { case CameraType.Front: MediaElementFrontCamera.Source = new Uri(cam.FilePath); playFront = true; break; case CameraType.LeftRepeater: MediaElementLeftCamera.Source = new Uri(cam.FilePath); playLeft = true; break; case CameraType.RightRepeater: MediaElementRightCamera.Source = new Uri(cam.FilePath); playRight = true; break; case CameraType.Back: MediaElementBackCamera.Source = new Uri(cam.FilePath); playBack = true; break; } } if (playLeft) { MediaElementLeftCamera.Play(); } if (playRight) { MediaElementRightCamera.Play(); } if (playFront) { MediaElementFrontCamera.Play(); } if (playBack) { MediaElementBackCamera.Play(); } TabControl.SelectedIndex = 1; }
public void LoadFileSet(TeslaCamFileSet set) { left.Stop(); right.Stop(); front.Stop(); back.Stop(); bool playLeft = false; bool playRight = false; bool playFront = false; bool playBack = false; foreach (var cam in set.Cameras) { if (cam.CameraLocation == TeslaCamFile.CameraType.FRONT) { this.front.Source = new Uri(cam.FilePath); playFront = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.LEFT_REPEATER) { this.left.Source = new Uri(cam.FilePath); playLeft = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.RIGHT_REPEATER) { this.right.Source = new Uri(cam.FilePath); playRight = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.BACK) { this.back.Source = new Uri(cam.FilePath); playBack = true; } } if (playLeft) { left.Play(); } if (playRight) { right.Play(); } if (playFront) { front.Play(); } if (playBack) { back.Play(); } this.tabs.SelectedIndex = 1; }
public bool BuildFromDirectory(string Directory) { // Get list of raw files string[] Files = System.IO.Directory.GetFiles(Directory, "*.mp4").OrderBy(x => x).ToArray(); // Make sure there's at least one valid file if (Files.Length < 1) { return(false); } // Create a list of cam files List <TeslaCamFile> CurrentTeslaCams = new List <TeslaCamFile>(Files.Length); // Convert raw file to cam file foreach (var File in Files) { TeslaCamFile f = TeslaCamFile.TryParse(File); if (f != null) { CurrentTeslaCams.Add(f); } } if (CurrentTeslaCams.Count == 0) { return(false); } // Now get list of only distinct events List <string> DistinctEvents = CurrentTeslaCams.Select(e => e.Date.UTCDateString).Distinct().ToList(); // Find the files that match the distinct event foreach (var CurrentEvent in DistinctEvents) { List <TeslaCamFile> MatchedFiles = CurrentTeslaCams.Where(e => e.Date.UTCDateString == CurrentEvent).ToList(); TeslaCamFileSet CurrentFileSet = new TeslaCamFileSet(); CurrentFileSet.SetCollection(MatchedFiles); this.Recordings.Add(CurrentFileSet); } // Set metadata this.Recordings = Recordings.OrderBy(e => e.Date.UTCDateString).ToList(); this.StartDate = Recordings.First().Date; this.EndDate = Recordings.Last().Date; // Success return(true); }
public void LoadFileSet(TeslaCamFileSet set) { left.Stop(); right.Stop(); front.Stop(); bool playLeft = false; bool playRight = false; bool playFront = false; foreach (var cam in set.Cameras) { if (cam.CameraLocation == TeslaCamFile.CameraType.FRONT) { this.front.Source = new Uri(cam.FilePath); playFront = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.LEFT_REPEATER) { this.left.Source = new Uri(cam.FilePath); playLeft = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.RIGHT_REPEATER) { this.right.Source = new Uri(cam.FilePath); playRight = true; } } if (playLeft) { left.Play(); } if (playRight) { right.Play(); } if (playFront) { front.Play(); } //playPause_Button.Content = "4"; // 4 is the pause symbol in webdings font this.tabs.SelectedIndex = 1; }
public bool BuildFromDirectory(string directory) { // Get list of raw files var files = System.IO.Directory.GetFiles(directory, "*.mp4").OrderBy(x => x).ToArray(); // Make sure there's at least one valid file if (files.Length < 1) { return(false); } // Create a list of cam files var currentTeslaCams = new List <TeslaCamFile>(files.Length); // Convert raw file to cam file foreach (var file in files) { var teslaCamFile = new TeslaCamFile(file); currentTeslaCams.Add(teslaCamFile); } // Now get list of only distinct events var distinctEvents = currentTeslaCams.Select(e => e.Date.UTCDateString).Distinct().ToList(); // Find the files that match the distinct event foreach (var currentEvent in distinctEvents) { var matchedFiles = currentTeslaCams.Where(e => e.Date.UTCDateString == currentEvent).ToList(); var currentFileSet = new TeslaCamFileSet(); currentFileSet.SetCollection(matchedFiles); Recordings.Add(currentFileSet); } // Set metadata Recordings = Recordings.OrderBy(e => e.Date.UTCDateString).ToList(); StartDate = Recordings.First().Date; EndDate = Recordings.Last().Date; // Success return(true); }
private void LoadFileSet(TeslaCamFileSet set) { left.Stop(); right.Stop(); front.Stop(); bool playLeft = false; bool playRight = false; bool playFront = false; foreach (var cam in set.Cameras) { if (cam.CameraLocation == TeslaCamFile.CameraType.FRONT) { this.front.Source = new Uri(cam.FilePath); playFront = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.LEFT_REPEATER) { this.left.Source = new Uri(cam.FilePath); playLeft = true; } if (cam.CameraLocation == TeslaCamFile.CameraType.RIGHT_REPEATER) { this.right.Source = new Uri(cam.FilePath); playRight = true; } } if (playLeft) { left.Play(); } if (playRight) { right.Play(); } if (playFront) { front.Play(); } model.CurrentPlaybackFile = set; }
public void LoadFileSet(TeslaCamFileSet set) { this.VideoModel.LoadFileSet(set); this.CurrentPlaybackFile = set; }