private void OpenVideoFile() { waitScreen.Show(); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Media files (*.mp3;*.mp4;*.mpg;*.mpeg)|*.mp3;*.mp4;*.mpg;*.mpeg;*.webm|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == true) { //Task myTask = Task.Factory.StartNew(() => { }); //myTask.Wait(); DashCamFileTree groups = new DashCamFileTree(openFileDialog.FileName); treeGroups.LoadTree(groups, openFileDialog.FileName); MainMap.SetRouteAndCar(null); //reset PlayFile(openFileDialog.FileName); if (_dashCamFileInfo.HasGpsInfo) { MainMap.Zoom = 16; } } else { waitScreen.Hide(); } }
public VideoFile LoadTree(DashCamFileTree tree, string selectedFileName) { _itemsSource.Clear(); foreach (List <DashCamFileInfo> group in tree.fileGroups) { _itemsSource.Add(new VideoGroup(group)); } treeFiles.ItemsSource = _itemsSource; treeFiles.UpdateLayout(); return(SelectFile(selectedFileName)); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Left = Settings.Default.InitialLocation.X; this.Top = Settings.Default.InitialLocation.Y; this.WindowState = WindowState.Maximized; if (File.Exists(Settings.Default.LastFileName)) { DashCamFileTree groups = new DashCamFileTree(Settings.Default.LastFileName); VideoFile v = treeGroups.LoadTree(groups, Settings.Default.LastFileName); if (v != null && v._dashCamFileInfo.HasGpsInfo) //initial location { MainMap.Position = v._dashCamFileInfo.Position(0); MainMap.Zoom = 16; } } //FIRST time ONLY - fit width after file opened //I need <reset> to remove this action after both controls adjusted VideoStartedPostAction = (player, reset) => { player.FitWidth(false); if (_dashCamFileInfo.HasGpsInfo) { MainMap.Position = _dashCamFileInfo.Position(0); MainMap.Zoom = 16; } //reset this action until next time if (reset) { VideoStartedPostAction = (p, r) => { } } ; }; waitScreen.Hide(); }