layouts/framework/TreeListView.xaml.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.IO;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;
using System.Linq;
using System.Windows.Data;
using tablegen2.logic;
using System.Collections.Generic;

namespace tablegen2.layouts
{
    /// <summary>
    /// TreeListView.xaml 的交互逻辑
    /// </summary>
    public partial class TreeListView : UserControl
    {
        private TreeListItem selectedItem_ = null;
        public event Action SelectedChangedEvent;
        public event Action CreateExcelEvent;

        public TreeListView()
        {
            InitializeComponent();
        }

        public TreeListItem SelectedItem
        {
            get { return selectedItem_; }
            set { _selectItem(value); }
        }

        public IEnumerable<string> AllExcels
        {
            get { return wp.Children.Cast<TreeListItem>().Select(a => a.FullPath); }
        }

        public void refreshByDir(string dir)
        {
            if (string.IsNullOrEmpty(dir) || !Directory.Exists(dir))
            {
                _selectItem(null);
                wp.Children.Clear();
                spEmpty.Visibility = Visibility.Visible;
            }
            else
            {
                _selectItem(null);
                wp.Children.Clear();

                var files = Directory.GetFiles(dir, "*.xls", SearchOption.TopDirectoryOnly).ToList();
                files = files.Union(Directory.GetFiles(dir, "*.xlsx", SearchOption.TopDirectoryOnly)).ToList();
                files.Sort((a, b) => string.Compare(Path.GetFileNameWithoutExtension(a), Path.GetFileNameWithoutExtension(b), true));

                spEmpty.Visibility = files.Count == 0 ? Visibility.Visible : Visibility.Hidden;
                foreach (var fullPath in files)
                {
                    if (Path.GetFileName(fullPath).StartsWith("~$"))
                        continue;

后面还有 178 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。