管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-08-22 1e45582d78413ae5696e0b0bc971fad7e9d64c49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using DataLoader.CS;
using DataLoader.Model;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
 
namespace DataLoader
{
    public partial class ResWin : Window
    {
        private TreeItem items = new TreeItem();
 
        private List<SysDir> dirs;
 
        private CheckBox cbLast;
 
        public ResWin()
        {
            InitializeComponent();
        }
 
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //
        }
 
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dirs = DBHelper.GetDirList();
            if (null == dirs || 0 == dirs.Count) return;
 
            FindTreeItems(dirs, items, 0);
            this.tvResTree.ItemsSource = items.Child;
        }
 
        private void FindTreeItems(List<SysDir> list, TreeItem ti, int pid)
        {
            if (ti.Child == null) ti.Child = new ObservableCollection<TreeItem>();
            foreach (SysDir dir in list)
            {
                if (pid == dir.pid)
                {
                    TreeItem item = new TreeItem();
                    item.ID = dir.id;
                    item.Name = dir.name;
                    item.FullName = dir.fullName;
                    item.IsExpanded = true;
                    ti.Child.Add(item);
 
                    FindTreeItems(list, item, dir.id);
                }
            }
        }
 
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox cb = sender as CheckBox;
            if (cb.IsChecked == true)
            {
                if (null != this.cbLast) this.cbLast.IsChecked = false;
                this.cbLast = cb;
            }
            else
            {
                this.cbLast = null;
            }
        }
 
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            SysDir dir = null;
            if (this.cbLast != null)
            {
                int id = int.Parse(this.cbLast.Tag.ToString());
                dir = (from d in dirs where d.id == id select d).First<SysDir>();
            }
 
            CommonProp.Owner.resWin = null;
            CommonProp.Owner.SetRes(null == dir ? null : dir.code, null == dir ? null : dir.fullName);
        }
    }
}