Esempio n. 1
0
        // remind_path = '/' 부터 시작
        void ReLoadDirectory(string remainned_path = null)
        {
            SftpFile[] files;
            files = SSHController.PullListInDirectory(this.path);
            if (files == null)
            {
                this.IsExpanded = false;
                return;
            }

            this.Items.Clear();

            int count_have_directory = 0;

            foreach (var file in files)
            {
                int i;
                for (i = 0; i < IGNORE_FILENAME.Length; i++)
                {
                    if (file.Name == IGNORE_FILENAME[i])
                    {
                        break;
                    }
                }
                if (i != IGNORE_FILENAME.Length)
                {
                    continue;
                }

                LinuxTreeViewItem ltvi;
                if (file.IsDirectory)
                {
                    //this.Items.Insert(0, new LinuxTreeViewItem(file.FullName, file.Name, true));
                    //this.Items.Add(new LinuxTreeViewItem(file.FullName, file.Name, true));
                    ltvi = new LinuxTreeViewItem(file.FullName, file, file.Name, true, this);
                    this.Items.Insert(count_have_directory++, ltvi);

                    // remainned_path = '/' 부터 시작
                    if (remainned_path != null)
                    {
                        string[] split = remainned_path.Split('/');
                        if (split.Length > 1 && split[1] == file.Name)
                        {
                            ltvi.RefreshChild(remainned_path.Substring(split[1].Length + 1));
                        }
                    }
                }
                else
                {
                    ltvi = new LinuxTreeViewItem(file.FullName, file, file.Name, false, this);
                    this.Items.Add(ltvi);
                }
            }
        }
Esempio n. 2
0
        public void RefreshChildFromParent()
        {
            LinuxTreeViewItem par = this.Parent as LinuxTreeViewItem;

            if (par == null)
            {
                return;
            }

            par.RefreshChild();
        }