NewLife/XCoder

样式.导出文件
BearXiongLaoXiong authored at 2020-09-04 17:38:56
e2bf103
Tree
1 Parent(s) 710b941
Summary: 4 changed files with 289 additions and 247 deletions.
Modified +12 -2
Modified +119 -91
Modified +3 -3
Modified +155 -151
Modified +12 -2
diff --git a/XCoderWpf/Models/DataBasePublishModel.cs b/XCoderWpf/Models/DataBasePublishModel.cs
index dca1e5e..a353bb6 100644
--- a/XCoderWpf/Models/DataBasePublishModel.cs
+++ b/XCoderWpf/Models/DataBasePublishModel.cs
@@ -1,6 +1,8 @@
 using System;
 using System.Windows;
 using Prism.Commands;
+using Prism.Mvvm;
+using XCode.DataAccessLayer;
 
 namespace XCoderWpf.Models
 {
@@ -8,6 +10,11 @@ namespace XCoderWpf.Models
     {
 
     }
+    public enum DataSourceType
+    {
+        Xml,
+        Db
+    }
 
     public class ConnectionStringModel
     {
@@ -18,10 +25,13 @@ namespace XCoderWpf.Models
         public DelegateCommand<ConnectionStringModel> SelectConncectionCmd { get; set; }
     }
 
-    public class TableInfoModel
+    public class TableInfoModel : BindableBase
     {
-        public bool IsChecked { get; set; }
+        public bool IsChecked { get => _isChecked; set => SetProperty(ref _isChecked, value); }
+        private bool _isChecked;
+
         public string Name { get; set; }
         public bool IsView { get; set; }
+        public IDataTable Data { get; set; }
     }
 }
Modified +119 -91
diff --git a/XCoderWpf/ViewModels/DataBasePublishViewModel.cs b/XCoderWpf/ViewModels/DataBasePublishViewModel.cs
index 6134c3f..abfee9f 100644
--- a/XCoderWpf/ViewModels/DataBasePublishViewModel.cs
+++ b/XCoderWpf/ViewModels/DataBasePublishViewModel.cs
@@ -1,36 +1,34 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Diagnostics;
 using System.IO;
 using System.Linq;
-using System.Text;
-using System.Threading;
 using System.Threading.Tasks;
-using System.Windows.Threading;
 using HandyControl.Controls;
 using Microsoft.Win32;
-using NewLife;
-using NewLife.Configuration;
-using NewLife.Threading;
 using Prism.Commands;
-using Prism.Events;
 using Prism.Mvvm;
-using Prism.Services.Dialogs;
+using XCode.Code;
 using XCode.DataAccessLayer;
-using XCoder;
 using XCoderWpf.Models;
-using XCoderWpf.Views;
 
 namespace XCoderWpf.ViewModels
 {
     public class DataBasePublishViewModel : BindableBase
     {
+        private DataSourceType _dataSourceType;
+        /// <summary>
+        /// 选中的连接
+        /// </summary>
+        private ConnectionStringModel _selectConnectionStringModel;
         /// <summary>
         /// 连接列表
         /// </summary>
         private List<ConnectionStringModel> _connectionStringList;
-        public IList<IDataTable> Tables { get; set; }
+        /// <summary>
+        /// 表列表
+        /// </summary>
+        private IList<TableInfoModel> _tableList { get; set; }
 
         public DataBasePublishViewModel()
         {
@@ -40,103 +38,132 @@ namespace XCoderWpf.ViewModels
                 Server = x.Value,
                 IconSource = new Uri($"/Resources/Images/SqlServer/{DAL.Create(x.Key).DbType.ToString().ToLower()}.png", UriKind.Relative),
                 SelectConncectionCmd = new Lazy<DelegateCommand<ConnectionStringModel>>(() => new DelegateCommand<ConnectionStringModel>((x) => _selectConnectionStringModel = x)).Value,
-
             }));
             _connectionStringCollection = new ObservableCollection<ConnectionStringModel>(_connectionStringList);
-
-            _TableCollection = new ObservableCollection<TableInfoModel>();
+            CurrentDirectoryFullPath = Environment.CurrentDirectory + @"\";
+            _tableCollection = new ObservableCollection<TableInfoModel>();
         }
 
+
         #region Property
+        public int XmlTableListCount { get => _xmlTableListCount; set => SetProperty(ref _xmlTableListCount, value); }
+        private int _xmlTableListCount;
+
+        public int DbTableListCount { get => _dbTableListCount; set => SetProperty(ref _dbTableListCount, value); }
+        private int _dbTableListCount;
+
+        public string FileName { get => _fileName; set => SetProperty(ref _fileName, value); }
+        private string _fileName;
+
         /// <summary>
-        /// 搜索框
+        /// 连接筛选
         /// </summary>
-        private string _searchFilter;
-        public String SearchFilter
+        public string SearchConnectionStringFilter
         {
-            get => _searchFilter;
+            get => _searchConnectionStringFilter;
             set
             {
-                SetProperty(ref _searchFilter, value);
+                SetProperty(ref _searchConnectionStringFilter, value);
                 _connectionStringCollection.Clear();
-                _connectionStringCollection.AddRange(_searchFilter?.Trim().Length > 0 ? _connectionStringList.Where(x => x.Title.ToLower().Contains(_searchFilter.ToLower())) : _connectionStringList);
+                _connectionStringCollection.AddRange(_searchConnectionStringFilter?.Trim().Length > 0 ? _connectionStringList.Where(x => x.Title.ToLower().Contains(_searchConnectionStringFilter.ToLower())) : _connectionStringList);
             }
         }
-
-        /// <summary>
-        /// 选中的连接
-        /// </summary>
-        private ConnectionStringModel _selectConnectionStringModel;
+        private string _searchConnectionStringFilter;
 
         /// <summary>
         /// 展示的连接列表
         /// </summary>
+        public ObservableCollection<ConnectionStringModel> ConnectionStringCollection { get => _connectionStringCollection; set => SetProperty(ref _connectionStringCollection, value); }
         private ObservableCollection<ConnectionStringModel> _connectionStringCollection;
-        public ObservableCollection<ConnectionStringModel> ConnectionStringCollection { get => _connectionStringCollection; set { SetProperty(ref _connectionStringCollection, value); } }
-
 
         /// <summary>
-        /// 表/视图列表
+        /// 当前工作目录
         /// </summary>
-        private ObservableCollection<TableInfoModel> _TableCollection;
-        public ObservableCollection<TableInfoModel> TableCollection { get => _TableCollection; set { SetProperty(ref _TableCollection, value); } }
+        public string CurrentDirectoryFullPath { get; set; } /*{ get => _currentDirectory; set => SetProperty(ref _currentDirectory, value); }*/
 
+        public string CurrentDirectoryShortPath => $@"{(CurrentDirectoryFullPath.Length > 5 ? $@"{CurrentDirectoryFullPath.Substring(0, CurrentDirectoryFullPath.Length / 2)}" : CurrentDirectoryFullPath)}".Trim('\\') + @"...\";
+
+        public string OutputPath { get => _outputPath; set => SetProperty(ref _outputPath, value); }
+        private string _outputPath = "OutputPathxxx";
+
+        public string NameSpace { get => _nameSpace; set => SetProperty(ref _nameSpace, value); }
+        private string _nameSpace = "NameSpacexxx";
+
+        public string EntityConnName { get => _entityConnName; set => SetProperty(ref _entityConnName, value); }
+        private string _entityConnName = "EntityConnNamexxx";
+
+        public string BaseClass { get => _baseClass; set => SetProperty(ref _baseClass, value); }
+        private string _baseClass = "BaseClassxxx";
+
+        public bool IsAllSelected { get => _isAllSelected; set { SetProperty(ref _isAllSelected, value); foreach (var item in _tableCollection) item.IsChecked = value; } }
         private bool _isAllSelected;
-        public bool IsAllSelected { get => _isAllSelected; set { SetProperty(ref _isAllSelected, value); } }
 
+        public bool IsContainsView { get => _isContainsView; set { SetProperty(ref _isContainsView, value); _ = SetTablesListByFilter(); } }
         private bool _isContainsView = true;
-        public bool IsContainsView { get => _isContainsView; set { SetProperty(ref _isContainsView, value); _ = SetTablesListByIsView(); } }
 
-        private MenuModel selectedMenu;
-        /// <summary>选中菜单</summary>
-        public MenuModel SelectedMenu
-        {
-            get => selectedMenu;
-            set { selectedMenu = value; RaisePropertyChanged(); }
-        }
-
-        private int _tableListCount;
-        public int TableListCount { get => _tableListCount; set { SetProperty(ref _tableListCount, value); } }
+        /// <summary>
+        /// 表筛选
+        /// </summary>
+        public string SearchTableFilter { get => _searchTableFilter; set { SetProperty(ref _searchTableFilter, value); _ = SetTablesListByFilter(); } }
+        private string _searchTableFilter;
 
+        /// <summary>
+        /// 表/视图列表
+        /// </summary>
+        public ObservableCollection<TableInfoModel> TableCollection { get => _tableCollection; set => SetProperty(ref _tableCollection, value); }
+        private ObservableCollection<TableInfoModel> _tableCollection;
         #endregion
 
-        #region Command
 
-        public DelegateCommand SelectCmd => new DelegateCommand(() =>
-          {
-              MessageBox.Show("123");
-          });
 
-        public DelegateCommand ImportXmlCmd => new Lazy<DelegateCommand>(new DelegateCommand(() =>
+
+
+        #region Command
+        public DelegateCommand ImportXmlCmd => new Lazy<DelegateCommand>(new DelegateCommand(async () =>
         {
             var openFileDialog = new OpenFileDialog();
             if (!openFileDialog.ShowDialog().Value || String.IsNullOrEmpty(openFileDialog.FileName)) return;
             try
             {
+                FileName = Path.GetFileName(openFileDialog.FileName);
                 var list = DAL.Import(File.ReadAllText(openFileDialog.FileName));
                 //if (!cbIncludeView.Checked) list = list.Where(t => !t.IsView).ToList();
                 //if (Config.NeedFix) list = Engine.FixTable(list);
 
                 //Engine = null;
                 //Engine.Tables = list;
-                Tables = list;
-                _TableCollection.Clear();
-                _TableCollection.AddRange(list.Select(x => new TableInfoModel { Name = $"{x.TableName} ({(string.IsNullOrWhiteSpace(x.Description) ? x.Name : x.Description)})", IsView = x.IsView }));
+                _tableList = list.Select(x => new TableInfoModel { IsChecked = _isAllSelected, Name = $"{x.TableName} ({(string.IsNullOrWhiteSpace(x.Description) ? x.Name : x.Description)})", IsView = x.IsView, Data = x }).ToList();
+                
                 //SetTables(list);
-
-
                 //MessageBox.Show("导入架构成功!共" + (list == null ? 0 : list.Count) + "张表!", "导入架构", MessageBoxButtons.OK);
             }
             catch (Exception ex)
             {
-                //MessageBox.Show(ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                MessageBox.Show(ex.Message);
                 return;
             }
+            _dataSourceType = DataSourceType.Xml;
+            await SetTablesListByFilter();
         })).Value;
 
         public DelegateCommand ImportConfigCmd => new Lazy<DelegateCommand>(new DelegateCommand(async () =>
         {
-            await GetTablesList();
+            IList<IDataTable> list = null;
+            _tableCollection.Clear();
+            try
+            {
+                await Task.Run(() => list = DAL.Create(_selectConnectionStringModel.Title).Tables);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return;
+            }
+            if (list == null) return;
+            _tableList = list.Select(x => new TableInfoModel { IsChecked = _isAllSelected, Name = $"{x.TableName} ({(string.IsNullOrWhiteSpace(x.Description) ? x.Name : x.Description)})", IsView = x.IsView, Data = x }).ToList();
+            
+            _dataSourceType = DataSourceType.Db;
+            await SetTablesListByFilter();
         })).Value;
 
         public DelegateCommand<ConnectionStringModel> SelectConncectionCmd => new Lazy<DelegateCommand<ConnectionStringModel>>(new DelegateCommand<ConnectionStringModel>((x) =>
@@ -145,36 +172,47 @@ namespace XCoderWpf.ViewModels
 
         })).Value;
 
-        #endregion
-
-        #region Method
+        public DelegateCommand OpenOutputFolderCmd => new Lazy<DelegateCommand>(new DelegateCommand(() =>
+        {
+            var dir = _outputPath.GetFullPath();
+            if (!Directory.Exists(dir)) dir = AppDomain.CurrentDomain.BaseDirectory;
+            System.Diagnostics.Process.Start("explorer.exe", "\"" + dir + "\"");
+        })).Value;
 
-        private async Task GetTablesList()
+        public DelegateCommand BuildTablesCmd => new Lazy<DelegateCommand>(new DelegateCommand(() =>
         {
-            
-            try
-            {
-                IList<IDataTable> list = null;
-                await Task.Run(() => { Thread.Sleep(10000); list = DAL.Create(_selectConnectionStringModel.Title).Tables; });
-                if (list == null) return;
-                Tables = list;
-                await SetTablesListByIsView();
-            }
-            catch (Exception ex)
+            var list = _tableCollection.Where(x => x.IsChecked).Select(x => x.Data).ToList();
+            // _outputPath, _nameSpace, _entityConnName, _baseClass
+            var rs = EntityBuilder.BuildTables(_tableCollection.Where(x => x.IsChecked).Select(x => x.Data).ToList(), new BuilderOption
             {
-                MessageBox.Show(ex.ToString());
-            }
-            Debug.WriteLine("33333333333333333333333");
-        }
+                Output = _outputPath,
+                Namespace = _nameSpace,
+                ConnName = _entityConnName,
+                BaseClass = _baseClass
+            });
+        })).Value;
+        #endregion
+
+
+
+
 
-        private async Task<IList<IDataTable>> SetTablesListByIsView()
+        #region Method
+        private async Task<IList<TableInfoModel>> SetTablesListByFilter()
         {
-            var list = Tables;
-            if (!_isContainsView) list = list.Where(t => !t.IsView).ToList();
-            TableListCount = list.Count();
-            _TableCollection.Clear();
-            _TableCollection.AddRange(list.Select(x => new TableInfoModel { Name = $"{x.TableName} ({(string.IsNullOrWhiteSpace(x.Description) ? x.Name : x.Description)})", IsView = x.IsView }));
-            return await Task.FromResult(list);
+
+            var list = _tableList.AsEnumerable();
+            if (!_isContainsView) list = list.Where(t => !t.IsView);
+            if (_searchTableFilter?.Trim().Length > 0) list = list.Where(x => x.Name.ToLower().Contains(_searchTableFilter.ToLower()));
+            foreach (var item in list) item.IsChecked = _isAllSelected;
+
+            var listCount = list.Count();
+            XmlTableListCount = _dataSourceType == DataSourceType.Xml ? listCount : 0;
+            DbTableListCount = _dataSourceType == DataSourceType.Db ? listCount : 0;
+
+            _tableCollection.Clear();
+            _tableCollection.AddRange(list);
+            return await Task.FromResult(list.ToList()); ;
         }
 
         //private  void SetTables(Object source)
@@ -214,14 +252,4 @@ namespace XCoderWpf.ViewModels
         #endregion
     }
 
-    public class MenuModel
-    {
-        public String IconFont { get; set; }
-
-        public String Title { get; set; }
-
-        public String BackColor { get; set; }
-
-        public Type Type { get; set; }
-    }
 }
Modified +3 -3
diff --git a/XCoderWpf/ViewModels/MainWindowViewModel.cs b/XCoderWpf/ViewModels/MainWindowViewModel.cs
index a82e751..423a5d6 100644
--- a/XCoderWpf/ViewModels/MainWindowViewModel.cs
+++ b/XCoderWpf/ViewModels/MainWindowViewModel.cs
@@ -16,18 +16,18 @@ namespace XCoderWpf.ViewModels
         private readonly IRegionManager _region;
         public  List<MainMenuModel> MainMenuList => new List<MainMenuModel>
         {
-            new MainMenuModel { Id = 0 , Pid = 0 , IconFont = "\xe635", Header = "数据库", BackColor = "#218868" },
+            new MainMenuModel { Id = 0 , Pid = 0 , IconFont = "\xe94d", Header = "数据库", BackColor = "#218868" },
             new MainMenuModel { Id = 1 , Pid = 0 , IconFont = "\xe635", Header = "数据建模", BackColor = "#218868", Tag = nameof(DataBasePublish) },
             new MainMenuModel { Id = 2 , Pid = 0 , IconFont = "\xe6b6", Header = "网络工具", BackColor = "#EE3B3B", Tag = nameof(RegexWindow)},
             new MainMenuModel { Id = 3 , Pid = 0 , IconFont = "\xe6e1", Header = "RPC工具", BackColor = "#218868" },
 
-            new MainMenuModel { Id = 20, Pid = 20, IconFont = "\xe614", Header = "串口工具", BackColor = "#EE3B3B" },
+            new MainMenuModel { Id = 20, Pid = 20, IconFont = "\xe8fd", Header = "串口工具", BackColor = "#EE3B3B" },
             new MainMenuModel { Id = 21, Pid = 20, IconFont = "\xe755", Header = "地图接口", BackColor = "#218868" },
             new MainMenuModel { Id = 22, Pid = 20, IconFont = "\xe635", Header = "正则表达式", BackColor = "#218868", Tag = nameof(RegexWindow) },
             new MainMenuModel { Id = 23, Pid = 20, IconFont = "\xe6b6", Header = "图标水印", BackColor = "#EE3B3B" },
             new MainMenuModel { Id = 24, Pid = 20, IconFont = "\xe6e1", Header = "加密解密", BackColor = "#218868" },
 
-            new MainMenuModel { Id = 50, Pid = 50, IconFont = "\xe614", Header = "语音助手", BackColor = "#EE3B3B" },
+            new MainMenuModel { Id = 50, Pid = 50, IconFont = "\xe8e4", Header = "语音助手", BackColor = "#EE3B3B" },
             new MainMenuModel { Id = 52, Pid = 50, IconFont = "\xe755", Header = "文件夹统计", BackColor = "#218868" },
             new MainMenuModel { Id = 53, Pid = 50, IconFont = "\xe635", Header = "文件编码", BackColor = "#218868" }
         };
Modified +155 -151
diff --git a/XCoderWpf/Views/DataBasePublish.xaml b/XCoderWpf/Views/DataBasePublish.xaml
index 99e85e8..d98897e 100644
--- a/XCoderWpf/Views/DataBasePublish.xaml
+++ b/XCoderWpf/Views/DataBasePublish.xaml
@@ -5,170 +5,174 @@
              xmlns:hc="https://handyorg.github.io/handycontrol"
              prism:ViewModelLocator.AutoWireViewModel="True">
 
-    <Grid Background="{DynamicResource BackgroundBrush}">
-        <Border Background="{DynamicResource RegionBrush}"  Effect="{StaticResource EffectShadow4}" CornerRadius="16" Margin="10">
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition/>
-                    <ColumnDefinition Width="2*"/>
-                </Grid.ColumnDefinitions>
-
-                <Border Effect="{StaticResource EffectShadow4}" Background="{DynamicResource DarkDefaultBrush}" CornerRadius="16,0,0,16">
-
-                    <DockPanel LastChildFill="True">
-                        <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="10" Background="{DynamicResource BorderBrush}" Effect="{StaticResource EffectShadow5}">
-                            <StackPanel>
-                                <Border Style="{StaticResource BorderTipDanger}">
-                                    <TextBlock HorizontalAlignment="Left"  Style="{StaticResource TextBlockDefaultAccent}">  <Bold>数据源1:</Bold> xml文件</TextBlock>
-                                </Border>
-                                <RepeatButton Margin="0,10,0,0" Content="读取文件" Command="{Binding ImportXmlCmd}" HorizontalAlignment="Right" DockPanel.Dock="Bottom"  Style="{StaticResource RepeatButtonDashedDanger}"/>
+    <Border Background="{DynamicResource RegionBrush}" CornerRadius="4" Margin="3">
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition/>
+                <ColumnDefinition Width="2.5*"/>
+            </Grid.ColumnDefinitions>
+
+            <Border BorderThickness="0">
+                <DockPanel LastChildFill="True">
+                    <Border Padding="5" Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="5" Background="{DynamicResource BorderBrush}" Effect="{StaticResource EffectShadow5}">
+                        <StackPanel>
+                            <Border Style="{StaticResource BorderTipDanger}">
+                                <TextBlock HorizontalAlignment="Left"  Style="{StaticResource TextBlockDefaultAccent}">  <Bold>数据源1:</Bold> xml文件</TextBlock>
+                            </Border>
+                            <StackPanel Margin="0,5,0,0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
+                                <TextBlock VerticalAlignment="Center" Text="{Binding FileName}"/>
+                                <hc:Badge HorizontalAlignment="Right" Text="{Binding XmlTableListCount}" BadgeMargin="0,-10,-10,0" Height="30" ToolTip="数量" Style="{StaticResource BadgeDanger}">
+                                    <RepeatButton Margin="10,0,0,0" Content="读取表"  Command="{Binding ImportXmlCmd}" Style="{StaticResource RepeatButtonDashedDanger}"/>
+                                </hc:Badge>
                             </StackPanel>
-                        </Border>
-
-                        <Border Style="{StaticResource BorderRegion}" Margin="10" Background="{DynamicResource BorderBrush}" Effect="{StaticResource EffectShadow5}">
-                            <DockPanel LastChildFill="True">
-                                <Border DockPanel.Dock="Top" Style="{StaticResource BorderTipDanger}">
-                                    <TextBlock  HorizontalAlignment="Left" Style="{StaticResource TextBlockDefaultAccent}"><Bold>数据源2:</Bold> config配置</TextBlock>
-                                </Border>
-                                <DockPanel LastChildFill="True" DockPanel.Dock="Top" Margin="0,10,0,0" >
-                                    <RepeatButton Margin="10,0,0,0" Content="读取配置" DockPanel.Dock="Right"  Command="{Binding ImportConfigCmd}"  Style="{StaticResource RepeatButtonDashedDanger}"/>
-                                    <hc:SearchBar  x:Name="SearchBarByTitle"   Text="{Binding SearchFilter,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SearchBarExtend}"/>
-                                </DockPanel>
-                                <Border  Margin="0,10,0,0" BorderThickness="1" BorderBrush="{StaticResource BorderBrush}">
-                                    <ScrollViewer VerticalScrollBarVisibility="Auto" >
-                                        <ItemsControl ItemsSource="{Binding ConnectionStringCollection}" BorderThickness="0" VirtualizingStackPanel.VirtualizationMode="Recycling"  ItemTemplate="{StaticResource DataBaseItems}">
-                                            <ItemsControl.ItemsPanel>
-                                                <ItemsPanelTemplate>
-                                                    <StackPanel Orientation="Vertical"/>
-                                                </ItemsPanelTemplate>
-                                            </ItemsControl.ItemsPanel>
-                                        </ItemsControl>
-                                    </ScrollViewer>
-                                </Border>
+                        </StackPanel>
+                    </Border>
+
+                    <Border Padding="5" Style="{StaticResource BorderRegion}" Margin="5" Background="{DynamicResource BorderBrush}" Effect="{StaticResource EffectShadow5}">
+                        <DockPanel LastChildFill="True">
+                            <Border DockPanel.Dock="Top" Style="{StaticResource BorderTipDanger}">
+                                <TextBlock  HorizontalAlignment="Left" Style="{StaticResource TextBlockDefaultAccent}"><Bold>数据源2:</Bold> config配置</TextBlock>
+                            </Border>
+                            <DockPanel LastChildFill="True" DockPanel.Dock="Top" Margin="0,5,0,0" >
+                                <hc:Badge HorizontalAlignment="Right" DockPanel.Dock="Right"  Text="{Binding DbTableListCount}" BadgeMargin="0,-10,-10,0" Height="30" ToolTip="数量" Style="{StaticResource BadgeDanger}">
+                                    <RepeatButton Margin="10,0,0,0" Content="读取表"  Command="{Binding ImportConfigCmd}" Style="{StaticResource RepeatButtonDashedDanger}" ToolTip="获取当前选中连接中的表、视图"/>
+                                </hc:Badge>
+                                <hc:SearchBar Text="{Binding SearchConnectionStringFilter,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SearchBarExtend}" ToolTip="删选连接"/>
                             </DockPanel>
-                        </Border>
-                    </DockPanel>
-                </Border>
-
-                <Border Effect="{StaticResource EffectShadow4}" Grid.Column="1" Background="{DynamicResource RegionBrush}" CornerRadius="0,16,16,0">
-                    <DockPanel LastChildFill="True">
-                        <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="10" Padding="1">
-                            <StackPanel Margin="10,0,0,0" Orientation="Horizontal" HorizontalAlignment="Left">
-                                <TextBlock FontFamily="/Resources/#iconfont" VerticalAlignment="Center">
+                            <Border Margin="0,5,0,0" BorderThickness="1" BorderBrush="{StaticResource BorderBrush}">
+                                <ScrollViewer VerticalScrollBarVisibility="Auto" >
+                                    <ItemsControl ItemsSource="{Binding ConnectionStringCollection}" BorderThickness="0" VirtualizingStackPanel.VirtualizationMode="Recycling"  ItemTemplate="{StaticResource DataBaseItems}">
+                                        <ItemsControl.ItemsPanel>
+                                            <ItemsPanelTemplate>
+                                                <StackPanel Orientation="Vertical"/>
+                                            </ItemsPanelTemplate>
+                                        </ItemsControl.ItemsPanel>
+                                    </ItemsControl>
+                                </ScrollViewer>
+                            </Border>
+                        </DockPanel>
+                    </Border>
+                </DockPanel>
+            </Border>
+
+            <Border BorderThickness="0" Grid.Column="1" Margin="5" >
+                <DockPanel LastChildFill="True">
+                    <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Padding="0" >
+                        <StackPanel Margin="10,0,0,0" Orientation="Horizontal" HorizontalAlignment="Left">
+                            <TextBlock FontFamily="/Resources/#iconfont" VerticalAlignment="Center">
                                     <Run ToolTip="导出文件存储位置" FontSize="18" Foreground="{StaticResource AccentBrush}">&#xe694;</Run>
-                                    <Run ToolTip="ahahhahhaha">C:\Xiong\输出目录\</Run>
-                                </TextBlock>
-                                <TextBox BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="100" Text="目录" hc:InfoElement.Placeholder="输出目录" Style="{StaticResource TextBoxExtend}"/>
-                            </StackPanel>
-                        </Border>
-
-                        <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="10,0,10,0" Padding="1">
-                            <StackPanel Orientation="Vertical" HorizontalAlignment="Left">
-                                <TextBlock>
+                                    <Hyperlink Command="{Binding OpenOutputFolderCmd}"> 
+                                        <Run ToolTip="{Binding CurrentDirectoryFullPath}" Text="{Binding CurrentDirectoryShortPath,Mode=OneTime}"/>
+                                    </Hyperlink>
+                            </TextBlock>
+                            <TextBox Text="{Binding OutputPath}" BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" Padding="0" MinWidth="100" hc:InfoElement.Placeholder="输出目录" Style="{StaticResource TextBoxExtend}"/>
+                        </StackPanel>
+                    </Border>
+
+                    <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="0,5,0,0" Padding="10,0">
+                        <StackPanel Orientation="Vertical" HorizontalAlignment="Left">
+                            <TextBlock>
                                     <Run Foreground="Blue" Text="using "/> System; <LineBreak/> <Run Foreground="Blue" Text="using "/> XCode;
-                                </TextBlock>
-                                <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left" >
-                                    <TextBlock Foreground="Blue" VerticalAlignment="Center" Text="namespace "></TextBlock>
-                                    <TextBox BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="100" Text="NameSpace" hc:InfoElement.Placeholder="命名空间" Style="{StaticResource TextBoxExtend}"/>
-                                </StackPanel>
-                                <TextBlock VerticalAlignment="Center">{</TextBlock>
-                                <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left">
-                                    <TextBlock VerticalAlignment="Center">
+                            </TextBlock>
+                            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left" >
+                                <TextBlock Foreground="Blue" VerticalAlignment="Center" Text="namespace "></TextBlock>
+                                <TextBox BorderThickness="0,0,0,1" Margin="0" Padding="0" hc:BorderElement.CornerRadius="0" MinWidth="100" Text="{Binding NameSpace}" hc:InfoElement.Placeholder="命名空间" Style="{StaticResource TextBoxExtend}"/>
+                            </StackPanel>
+                            <TextBlock VerticalAlignment="Center">{</TextBlock>
+                            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left">
+                                <TextBlock VerticalAlignment="Center">
                                         <Run Foreground="Blue" Text="    public partial class "/><Run  Foreground="#3DC9B0" Text="Demo" /> :
-                                    </TextBlock>
-                                    <TextBox VerticalAlignment="Center"  BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="100" Text="Entity1" hc:InfoElement.Placeholder="实体基类" Style="{StaticResource TextBoxExtend}"/>
-                                    <TextBlock VerticalAlignment="Center">
+                                </TextBlock>
+                                <TextBox VerticalAlignment="Center" Padding="0" BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="100" Text="{Binding BaseClass}" hc:InfoElement.Placeholder="实体基类" Style="{StaticResource TextBoxExtend}"/>
+                                <TextBlock VerticalAlignment="Center">
                                          &lt; <Run Foreground="#3DC9B0" Text="Demo" /><Run Text=">"/>&#160;{&#160;...&#160;}
-                                    </TextBlock>
-                                </StackPanel>
-                                <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left">
-                                    <TextBlock VerticalAlignment="Center">
-                                        &#160;&#160;&#160;&#160;[<Run  Foreground="#3DC9B0" Text="BindTable" /><Run Foreground="#9E9D62" Text="(&quot;Demo&quot;"/>, Description =  <Run Foreground="#9E9D62" Text="&quot;&quot;"/>, ConnName =
-                                    </TextBlock>
-                                    <TextBox VerticalAlignment="Center"  BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="60" Text="ConnName1" hc:InfoElement.Placeholder="连接名" Style="{StaticResource TextBoxExtend}"/>
-                                    <TextBlock VerticalAlignment="Center"><Run Foreground="#9E9D62" Text=")"/>]</TextBlock>
-                                </StackPanel>
+                                </TextBlock>
+                            </StackPanel>
+                            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left">
                                 <TextBlock VerticalAlignment="Center">
-                                        <Run Foreground="Blue" Text="    public partial class "/><Run  Foreground="#3DC9B0" Text="Demo" />&#160;:<Run Foreground="#87D778" Text=" IDemo" /> &#160;&#160;&#160;&#160;{&#160;...&#160;}
+                                        &#160;&#160;&#160;&#160;[<Run  Foreground="#3DC9B0" Text="BindTable" /><Run Foreground="#9E9D62" Text="(&quot;Demo&quot;"/>, Description =  <Run Foreground="#9E9D62" Text="&quot;&quot;"/>, ConnName =
                                 </TextBlock>
-                                <TextBlock VerticalAlignment="Center" Text="}"/>
+                                <TextBox VerticalAlignment="Center" Padding="0" BorderThickness="0,0,0,1" hc:BorderElement.CornerRadius="0" MinWidth="60" Text="{Binding EntityConnName}" hc:InfoElement.Placeholder="实体链接名" Style="{StaticResource TextBoxExtend}"/>
+                                <TextBlock VerticalAlignment="Center"><Run Foreground="#9E9D62" Text=")"/>]</TextBlock>
                             </StackPanel>
+                            <TextBlock VerticalAlignment="Center">
+                                        <Run Foreground="Blue" Text="    public partial class "/><Run  Foreground="#3DC9B0" Text="Demo" />&#160;:<Run Foreground="#87D778" Text=" IDemo" /> &#160;&#160;&#160;&#160;{&#160;...&#160;}
+                            </TextBlock>
+                            <TextBlock VerticalAlignment="Center" Text="}"/>
+                        </StackPanel>
 
-                        </Border>
+                    </Border>
 
-                        <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="10,10,10,0" Padding="1">
-                            <DockPanel>
-                                <StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
-                                    <CheckBox IsChecked="{Binding IsAllSelected}" Margin="5,0,0,0" Content="全选"/>
-                                    <CheckBox IsChecked="{Binding IsContainsView}" Margin="10,0,0,0" Content="包含视图"/>
-                                    <hc:Badge HorizontalAlignment="Right" Text="{Binding TableListCount}" BadgeMargin="0,-14,-20,0" Height="30"  Margin="10,3,0,3" Style="{StaticResource BadgeDanger}">
-                                        <Button Content="刷新"/>
-                                    </hc:Badge>
+                    <Border Style="{StaticResource BorderRegion}" DockPanel.Dock="Top" Margin="0,5,0,0" Padding="1">
+                        <DockPanel>
+                            <StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
+                                <CheckBox IsChecked="{Binding IsAllSelected}" Margin="5,0,0,0" Content="全选"/>
+                                <CheckBox IsChecked="{Binding IsContainsView}" Margin="10,0,0,0" Content="包含视图"/>
+                                <hc:SearchBar  Margin="10,3,0,3" Width="120" Text="{Binding SearchTableFilter,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SearchBarExtend}" ToolTip="筛选表"/>
 
-                                </StackPanel>
+                            </StackPanel>
 
-                                <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
-                                    <RepeatButton Margin="10,0,10,0" Content="生成选中表"  Style="{StaticResource RepeatButtonDashed}" hc:IconElement.Width="15" hc:IconElement.Height="12" hc:IconElement.Geometry="{StaticResource DownloadGeometry}"/>
-                                    <!--<RepeatButton Margin="10,3,0,3" Content="生成选中表" IsEnabled="False" Style="{StaticResource RepeatButtonDashed}" hc:IconElement.Geometry="{StaticResource DownloadGeometry}"/>-->
+                            <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
+                                <RepeatButton Command="{Binding BuildTablesCmd}" Margin="0,0,3,0" Content="生成选中表"  Style="{StaticResource RepeatButtonDashed}" hc:IconElement.Width="15" hc:IconElement.Height="12" hc:IconElement.Geometry="{StaticResource DownloadGeometry}"/>
+                                <!--<RepeatButton Margin="10,3,0,3" Content="生成选中表" IsEnabled="False" Style="{StaticResource RepeatButtonDashed}" hc:IconElement.Geometry="{StaticResource DownloadGeometry}"/>-->
 
 
-                                </StackPanel>
-                            </DockPanel>
-                        </Border>
-                        <Border Style="{StaticResource BorderRegion}" Margin="10" Padding="1">
-                            <ListBox ItemsSource="{Binding TableCollection}" BorderThickness="0" VirtualizingStackPanel.VirtualizationMode="Recycling">
-                                <ItemsControl.ItemsPanel>
-                                    <ItemsPanelTemplate>
-                                        <VirtualizingStackPanel Orientation="Vertical"/>
-                                    </ItemsPanelTemplate>
-                                </ItemsControl.ItemsPanel>
-                                <ItemsControl.ItemContainerStyle>
-                                    <Style  TargetType="ListBoxItem">
-                                        <Style.Triggers>
-                                            <Trigger Property="IsSelected" Value="True">
-                                                <Setter Property="Background" Value="{StaticResource DarkInfoBrush}" />
-                                            </Trigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </ItemsControl.ItemContainerStyle>
-                                <ItemsControl.ItemTemplate>
-                                    <DataTemplate>
-
-                                        <StackPanel Orientation="Horizontal" Height="40">
-                                            <CheckBox VerticalAlignment="Center" Style="{x:Null}" Name="CheckBoxZone"/>
-                                            <Label BorderThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="35" Margin="30,5,50,5" Padding="3" hc:BorderElement.CornerRadius="10">
-                                                <Label.Style>
-                                                    <Style TargetType="Label">
-                                                        <Style.Triggers>
-                                                            <DataTrigger Binding="{Binding IsView}" Value="True">
-                                                                <Setter Property="Background" Value="#F0F5FF"/>
-                                                                <Setter Property="BorderBrush" Value="#ADC6FF"/>
-                                                                <Setter Property="Foreground" Value="#A577EC"/>
-                                                                <Setter Property="Content" Value="视图"/>
-                                                            </DataTrigger>
-                                                            <DataTrigger Binding="{Binding IsView}" Value="False">
-                                                                <Setter Property="Background" Value="#F6FDEE"/>
-                                                                <Setter Property="BorderBrush" Value="#C0ED9F"/>
-                                                                <Setter Property="Foreground" Value="#6BCB3B"/>
-                                                                <Setter Property="Content" Value="表"/>
-                                                            </DataTrigger>
-                                                        </Style.Triggers>
-                                                    </Style>
-
-                                                </Label.Style>
-
-                                            </Label>
-                                            <TextBlock VerticalAlignment="Center" Text="{Binding Name}"></TextBlock>
-                                        </StackPanel>
-
-                                    </DataTemplate>
-                                </ItemsControl.ItemTemplate>
-                            </ListBox>
-                        </Border>
-
-                    </DockPanel>
-                </Border>
-            </Grid>
-        </Border>
-    </Grid>
+                            </StackPanel>
+                        </DockPanel>
+                    </Border>
+                    <Border Style="{StaticResource BorderRegion}" Margin="0,5,0,0" Padding="0">
+                        <ListBox ItemsSource="{Binding TableCollection}" Margin="0,5" BorderThickness="0" VirtualizingStackPanel.VirtualizationMode="Recycling">
+                            <ItemsControl.ItemsPanel>
+                                <ItemsPanelTemplate>
+                                    <VirtualizingStackPanel Orientation="Vertical"/>
+                                </ItemsPanelTemplate>
+                            </ItemsControl.ItemsPanel>
+                            <ItemsControl.ItemContainerStyle>
+                                <Style  TargetType="ListBoxItem">
+                                    <Style.Triggers>
+                                        <Trigger Property="IsSelected" Value="True">
+                                            <Setter Property="Background" Value="{StaticResource DarkInfoBrush}" />
+                                        </Trigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </ItemsControl.ItemContainerStyle>
+                            <ItemsControl.ItemTemplate>
+                                <DataTemplate>
+
+                                    <StackPanel Orientation="Horizontal" Height="40">
+                                        <CheckBox VerticalAlignment="Center" Style="{x:Null}" Name="CheckBoxZone" IsChecked="{Binding IsChecked}"/>
+                                        <Label BorderThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="35" Margin="30,5,50,5" Padding="3" hc:BorderElement.CornerRadius="10">
+                                            <Label.Style>
+                                                <Style TargetType="Label">
+                                                    <Style.Triggers>
+                                                        <DataTrigger Binding="{Binding IsView}" Value="True">
+                                                            <Setter Property="Background" Value="#F0F5FF"/>
+                                                            <Setter Property="BorderBrush" Value="#ADC6FF"/>
+                                                            <Setter Property="Foreground" Value="#A577EC"/>
+                                                            <Setter Property="Content" Value="视图"/>
+                                                        </DataTrigger>
+                                                        <DataTrigger Binding="{Binding IsView}" Value="False">
+                                                            <Setter Property="Background" Value="#F6FDEE"/>
+                                                            <Setter Property="BorderBrush" Value="#C0ED9F"/>
+                                                            <Setter Property="Foreground" Value="#6BCB3B"/>
+                                                            <Setter Property="Content" Value="表"/>
+                                                        </DataTrigger>
+                                                    </Style.Triggers>
+                                                </Style>
+
+                                            </Label.Style>
+
+                                        </Label>
+                                        <TextBlock VerticalAlignment="Center" Text="{Binding Name}" Style="{StaticResource TextBlockDefault}"></TextBlock>
+                                    </StackPanel>
+
+                                </DataTemplate>
+                            </ItemsControl.ItemTemplate>
+                        </ListBox>
+                    </Border>
+
+                </DockPanel>
+            </Border>
+        </Grid>
+    </Border>
 </UserControl>