コード例 #1
0
        void listDir(string p, CheckableItem parent)
        {
            string[] Files   = Directory.GetFiles(p);
            string[] Folders = Directory.GetDirectories(p);

            foreach (string dir in Folders)
            {
                var item = new CheckableItem();
                item.Path      = dir;
                item.Parent    = parent;
                item.IsFolder  = true;
                item.TextColor = folderColor;
                //item.ico = getIcoForFile(dir);
                item.Value = System.IO.Path.GetFileName(dir);
                parent.Children.Add(item);
                listDir(System.IO.Path.Combine(p, dir), item);
            }

            Files.ToList().ForEach(i => {
                var it = new CheckableItem();
                //it.ico = getIcoForFile(i);
                it.Path      = i;
                it.TextColor = fileColor;
                it.Parent    = parent;
                it.Value     = System.IO.Path.GetFileName(i);
                parent.Children.Add(it);
            });
        }
コード例 #2
0
        void listDir(string p)
        {
            string[] Files;
            string[] Folders;
            try
            {
                Files   = Directory.GetFiles(p);
                Folders = Directory.GetDirectories(p);
            } catch
            {
                return;
            }

            foreach (string dir in Folders)
            {
                var item = new CheckableItem();
                //item.ico = getIcoForFile(dir);
                item.Path      = dir;
                item.IsFolder  = true;
                item.TextColor = folderColor;
                item.Value     = System.IO.Path.GetFileName(dir);
                items.Add(item);
                listDir(System.IO.Path.Combine(p, dir), item);
            }
            Files.ToList().ForEach(i => {
                var it       = new CheckableItem();
                it.Path      = i;
                it.TextColor = fileColor;
                //it.ico = getIcoForFile(i);
                it.Value = System.IO.Path.GetFileName(i);
                items.Add(it);
            });
        }
コード例 #3
0
        public void SetCheckedPotentialBbie(CheckableItem checkableItem)
        {
            CandidateAbie abie = FindSelectedAbie(rootElement.CandidateAbies);

            foreach (PotentialBbie potentialBbie in abie.PotentialBbies)
            {
                if (potentialBbie.Name.Equals(checkableItem.Text))
                {
                    potentialBbie.Checked = checkableItem.Checked;
                }
            }
        }
コード例 #4
0
        private bool SearchFilter(object obj)
        {
            CheckableItem <OrderItemDto> orderItem = obj as CheckableItem <OrderItemDto>;

            if (orderItem == null)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(SearchString))
            {
                return(true);
            }

            return(orderItem.Item.Product.Name.ToLower().Contains(SearchString.ToLower()));
        }
コード例 #5
0
        public IList <CheckableItem> LoadHierarchy(string url, long revision, CheckableItem parent)
        {
            IList <CheckableItem> result = new List <CheckableItem>();

            if (subversionSearcher != null)
            {
                IList <bool> hasChildList;
                var          children = subversionSearcher.GetChildrenInHierarchy(url, revision, out hasChildList, true);
                if (children != null)
                {
                    for (int i = 0; i < children.Count; i++)
                    {
                        result.Add(new CheckableItem(parent, children[i].Item1, revision, children[i].Item2, this, hasChildList[i]));
                    }
                }
            }

            return(result);
        }
コード例 #6
0
        private void filesTreeView_Selected(object sender, RoutedEventArgs e)
        {
            CheckableItem item = filesTreeView.SelectedItem as CheckableItem;

            Console.WriteLine(System.IO.Path.GetExtension(item.Path).ToLower());
            if (!videoExtensions.Contains(System.IO.Path.GetExtension(item.Path).ToLower()))
            {
                return;
            }
            var video = new MediaFile {
                Filename = item.Path
            };

            using (Engine engine = new Engine())
            {
                engine.GetMetadata(video);
            }

            FilenametextBlock.Text  = item.Value;
            FrameSizetextBlock.Text = video.Metadata.VideoData.FrameSize;
            FPStextBlock.Text       = video.Metadata.VideoData.Fps.ToString();
            CodectextBlock.Text     = video.Metadata.VideoData.Format;
            DurationtextBlock.Text  = video.Metadata.Duration.ToString();
        }
コード例 #7
0
        /// <summary>
        /// Builds the Repository overview at a certain revision
        /// </summary>
        /// <param name="subversionSearcher">SubversionSearcher object to use</param>
        /// <param name="path">Path relative to RepositoryUrl of subversionSearcher</param>
        /// <param name="revision">Revision at which to build</param>
        public void BuildRepositoryOverview(SubversionSearcher subversionSearcher, string path, long revision)
        {
            if (!SubversionSearcher.IsReady(subversionSearcher))
            {
                Progress.DebugLog("Tried to build repository overview without an initialized SubversionSearcher");
                return;
            }

            if (revision == currentTreeRevision && path == currentTreeHeadPath &&
                object.ReferenceEquals(currentSubversionSearcherUsedForTree, subversionSearcher) &&
                this.Items != null && this.Items.Count != 0)
            {
                return;
            }

            if (path == null || subversionSearcher.PathExistsAtRevision(path, revision) == false)
            {
                Progress.Log("{0} does not exist at revision {1}", path, revision);
                this.Items = new List <CheckableItem> {
                };
                return;
            }


            IList <string> expandedNodes = new List <string>();
            IList <string> checkedNodes  = new List <string>();

            if (path == currentTreeHeadPath)
            {
                // keeping the nodes that were expanded expanded
                if (this.Items != null && this.Items.Count > 0)
                {
                    Queue <CheckableItem> togo = new Queue <CheckableItem>();

                    foreach (var item in this.Items)
                    {
                        togo.Enqueue(item);
                    }

                    while (togo.Count > 0)
                    {
                        var item = togo.Dequeue();

                        if (item.IsExpanded)
                        {
                            expandedNodes.Add(item.Path.Length > path.Length ? item.Path.Substring(path.Length).TrimStart('/') : "");

                            foreach (var c in item.Children)
                            {
                                togo.Enqueue(c);
                            }
                        }
                    }
                }
                else
                {
                    expandedNodes.Add("");
                }

                // keeping the nodes that were checked
                if (this.Items != null && this.Items.Count > 0)
                {
                    Queue <CheckableItem> togo = new Queue <CheckableItem>();

                    foreach (var item in this.Items)
                    {
                        togo.Enqueue(item);
                    }

                    while (togo.Count > 0)
                    {
                        var item = togo.Dequeue();

                        if (item.IsChecked == true)
                        {
                            checkedNodes.Add(item.Path.Length > path.Length ? item.Path.Substring(path.Length).TrimStart('/') : "");
                        }
                        else if (item.IsChecked == null)
                        {
                            foreach (var c in item.Children)
                            {
                                togo.Enqueue(c);
                            }
                        }
                    }
                }
            }
            else
            {
                expandedNodes.Add("");
            }

            CheckableItem rootFolder = new CheckableItem(null, path, revision, SharpSvn.SvnNodeKind.Directory, mainViewModel);

            rootFolder.Children = mainViewModel.LoadHierarchy(path, revision, rootFolder);

            foreach (var item in expandedNodes)
            {
                var ci = rootFolder.GetItemByRelativePath(item);
                if (ci != null)
                {
                    ci.IsExpanded = true;
                }
            }

            foreach (var item in checkedNodes)
            {
                var ci = rootFolder.GetItemByRelativePath(item);
                if (ci != null)
                {
                    ci.IsChecked = true;
                }
            }


            this.Items = new List <CheckableItem> {
                rootFolder
            };

            currentTreeRevision = revision;
            currentTreeHeadPath = path;
            currentSubversionSearcherUsedForTree = subversionSearcher;
        }