管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-01-01 95869b034691c668ea854bc3e6315f0f1ff84b91
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using DataLoader.CS;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
 
namespace DataLoader
{
    public partial class MainWindow : Window, INotifyPropertyChanged
    {
        private ObservableCollection<ViewData> viewDatas = new ObservableCollection<ViewData>();
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private string _sourcePath;
 
        private string _targetPath;
 
        public string SourcePath
        {
            get { return _sourcePath; }
            set
            {
                if (!String.IsNullOrEmpty(value) && Directory.Exists(value))
                {
                    _sourcePath = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("SourcePath"));
                }
            }
        }
 
        public string TargetPath
        {
            get { return _targetPath; }
            set
            {
                if (!String.IsNullOrEmpty(value) && Directory.Exists(value))
                {
                    _targetPath = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("TargetPath"));
                }
            }
        }
 
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;
        }
 
        protected virtual void OnPropertyChanged(string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
 
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Main.Owner = this;
 
            lvView.DataContext = viewDatas;
            lvView.SetBinding(ListView.ItemsSourceProperty, new Binding());
        }
 
 
        // 登录
        private void Login_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
 
        }
 
        // 源目录
        private void Source_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            if (!String.IsNullOrEmpty(SourcePath) && Directory.Exists(SourcePath)) dialog.SelectedPath = SourcePath;
 
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
 
            this.SourcePath = dialog.SelectedPath.Trim();
        }
 
        // 目标目录
        private void Target_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            if (!String.IsNullOrEmpty(TargetPath) && Directory.Exists(TargetPath)) dialog.SelectedPath = TargetPath;
 
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
 
            this.TargetPath = dialog.SelectedPath.Trim();
        }
 
        // 导入
        private void Import_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            viewDatas.Add(new ViewData() { ID = 1, FilePath = "c:\\", Status = "加载中" });
            viewDatas.Add(new ViewData() { ID = 2, FilePath = "c:\\", Status = "完成" });
        }
    }
}