Example #1
0
 internal string FindPrevFile(string fileName)
 {
     foreach (VideoGroup group in treeFiles.Items)
     {
         var tvi = treeFiles.ItemContainerGenerator.ContainerFromItem(group) as TreeViewItem;
         for (int i = 0; i < group.Members.Count; i++)
         {
             VideoFile v = group.Members[i];
             if (string.Compare(fileName, v.FileName, true) == 0)
             {
                 if (i - 1 >= 0) //has prev
                 {
                     return(group.Members[i - 1].FileName);
                 }
             }
         }
     }
     return(null);
 }
Example #2
0
 internal TreeViewItem FindFile(string fileName)
 {
     foreach (VideoGroup group in treeFiles.Items)
     {
         var tvi = treeFiles.ItemContainerGenerator.ContainerFromItem(group) as TreeViewItem;
         foreach (var subItem in tvi.Items)
         {
             TreeViewItem childItem = tvi.ItemContainerGenerator.ContainerFromItem(subItem) as TreeViewItem;
             if (childItem != null)
             {
                 VideoFile v = childItem.DataContext as VideoFile;
                 if (string.Compare(fileName, v.FileName, true) == 0)
                 {
                     return(childItem);
                 }
             }
         }
     }
     return(null);
 }
Example #3
0
 internal void DeleteVideoFile(VideoFile file)
 {
     foreach (VideoGroup g in _itemsSource)
     {
         foreach (VideoFile v in g.Members)
         {
             if (v.FileName == file.FileName)
             {
                 v._dashCamFileInfo.DeleteRecording();
                 g.Members.Remove(v);
                 break;
             }
         }
         //remove group if all files were removed
         if (g.Members.Count == 0)
         {
             _itemsSource.Remove(g);
             break;
         }
     }
 }
Example #4
0
        internal VideoFile SelectFile(string fileName)
        {
            VideoFile v = null;

            foreach (VideoGroup group in treeFiles.Items)
            {
                var tvi = treeFiles.ItemContainerGenerator.ContainerFromItem(group) as TreeViewItem;
                foreach (VideoFile videoFile in tvi.Items)
                {
                    TreeViewItem childItem = tvi.ItemContainerGenerator.ContainerFromItem(videoFile) as TreeViewItem;
                    if (childItem != null)
                    {
                        childItem.IsSelected = (string.Compare(fileName, videoFile.FileName, true) == 0);
                        if (childItem.IsSelected)
                        {
                            v = videoFile;
                            childItem.BringIntoView();
                        }
                    }
                }
            }
            return(v);
        }