Exemplo n.º 1
0
        /// <summary>
        /// (re)Fill the tree
        /// </summary>
        private void AddItemsToTree(bool filterCurrentType)
        {
            MXFObject selObject = this.treeListViewMain.SelectedObject as MXFObject;

            if (filterCurrentType && selObject != null)
            {
                Type selectedType = selObject.GetType();

                // Create a new list with the selected items only)
                if (this.HideFillers)
                {
                    this.m_filterList = this.m_MXFFile.FlatList.Where(a => a.GetType() == selectedType && a.Type != MXFObjectType.Filler).ToList();
                }
                else
                {
                    this.m_filterList = this.m_MXFFile.FlatList.Where(a => a.GetType() == selectedType).ToList();
                }
                this.treeListViewMain.SetObjects(this.m_filterList);
                this.txtOverall.Text = string.Format("Number of filtered objects: {0}", this.m_filterList.Count);
            }
            else
            {
                this.m_filterList = null;
                if (this.m_MXFFile != null)
                {
                    this.treeListViewMain.SetObjects(this.m_MXFFile.Children);
                    this.txtOverall.Text = string.Format("Total objects: {0}", this.m_MXFFile.FlatList.Count);
                }
                else
                {
                    this.txtOverall.Text = "";
                }
            }

            // Set logical tree
            List <MXFLogicalObject> los = new List <MXFLogicalObject>();

            if (this.m_MXFFile != null)
            {
                los.Add(this.m_MXFFile.LogicalBase);
            }
            this.treeListViewLogical.SetObjects(los);


            // (Re)-select the selected item
            if (selObject != null)
            {
                SelectObjectInMainList(selObject);
            }
            else
            {
                // No item selected, just select the first partition
                if (this.m_MXFFile != null && this.m_MXFFile.Partitions != null && this.m_MXFFile.Partitions.Count > 0)
                {
                    SelectObjectInMainList(this.m_MXFFile.Partitions[0]);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Find the previous item in this parent
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SelectPreviousObject()
        {
            MXFObject selectedObject = this.treeListViewMain.SelectedObject as MXFObject;

            if (selectedObject != null)
            {
                MXFObject previousObject = selectedObject;
                if (this.m_filterList != null)
                {
                    // Filtering is currently active!
                    int index = this.m_filterList.IndexOf(selectedObject);
                    if (index >= 1)
                    {
                        previousObject = this.m_filterList[index - 1];
                    }
                }
                else
                {
                    previousObject = selectedObject.FindPreviousibling(selectedObject.GetType(), this.HideFillers);
                }
                SelectObjectInMainList(previousObject);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Find the next item with the same key
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SelectNextObject()
        {
            MXFObject selectedObject = this.treeListViewMain.SelectedObject as MXFObject;

            if (selectedObject != null)
            {
                MXFObject nextObject = selectedObject;
                if (this.m_filterList != null)
                {
                    // Filtering is currently active!
                    int index = this.m_filterList.IndexOf(selectedObject);
                    if (index >= 0 && index < this.m_filterList.Count - 1)
                    {
                        nextObject = this.m_filterList[index + 1];
                    }
                }
                else
                {
                    nextObject = selectedObject.FindNextSibling(selectedObject.GetType(), this.HideFillers);
                }
                SelectObjectInMainList(nextObject);
            }
        }