DataLoader/CS/DBHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/DataLoader.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/LoginWin.xaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/MainWindow.xaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/MainWindow.xaml.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/Model/SysDir.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/Model/TreeItem.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/ResWin.xaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DataLoader/ResWin.xaml.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
DataLoader/CS/DBHelper.cs
@@ -66,7 +66,7 @@ /// </summary> public static List<SysDir> GetDirList() { string sql = "select * from lf.sys_dir"; string sql = "select a.*, fn_get_fullname(a.code, 2) fullName from lf.sys_dir a"; DataTable dt = Tools.DBHelper.GetDataTable(sql); if (null == dt || dt.Rows.Count == 0) return null; DataLoader/DataLoader.csproj
@@ -119,6 +119,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="Model\TreeItem.cs" /> <Compile Include="ResWin.xaml.cs"> <DependentUpon>ResWin.xaml</DependentUpon> </Compile> <Page Include="LoginWin.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -152,6 +156,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> <Page Include="ResWin.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> </ItemGroup> <ItemGroup> <Compile Include="Model\SysMeta.cs" /> DataLoader/LoginWin.xaml
@@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Chrome="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" Loaded="Window_Loaded" Title="ç»å½çªå£" Loaded="Window_Loaded" Title="ç»å½çªå£" ShowInTaskbar="False" WindowStyle="None" Height="500" Width="750" WindowStartupLocation="CenterScreen"> <Grid> <Chrome:ChromiumWebBrowser x:Name="web" Margin="1" Grid.Row="1" /> DataLoader/MainWindow.xaml
@@ -1,8 +1,7 @@ <Window x:Class="DataLoader.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="700" Width="900" Loaded="Window_Loaded" Height="700" Width="900" Loaded="Window_Loaded" Title="æ°æ®å ¥åº v1.5" WindowStartupLocation="CenterScreen"> <Window.Resources> <Style x:Key="btn" TargetType="Button"> @@ -23,8 +22,9 @@ <Style x:Key="tb" TargetType="TextBox"> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Height" Value="30"/> <Setter Property="FontSize" Value="20"/> <Setter Property="FontSize" Value="16"/> </Style> <!--Combox--> @@ -127,7 +127,7 @@ <Setter Property="BorderThickness" Value="0"/> </Style> <!--<Style TargetType="DatePickerTextBox"> <Style TargetType="DatePickerTextBox"> <Setter Property="ItemsControl.Template"> <Setter.Value> <ControlTemplate> @@ -135,7 +135,7 @@ </ControlTemplate> </Setter.Value> </Setter> </Style>--> </Style> </Window.Resources> <Grid x:Name="gMain"> <Grid.RowDefinitions> @@ -164,7 +164,7 @@ <Button Grid.Row="0" Grid.Column="4" Content="ç» å½" Style="{StaticResource btn}" Click="Login_MouseLeftButtonDown"/> <Label Grid.Row="1" Grid.Column="0" Content="令çï¼" VerticalAlignment="Center" HorizontalAlignment="Right" /> <TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource tb}" IsReadOnly="True" x:Name="tbToken"/> <TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource tb}" IsReadOnly="True" x:Name="tbToken"/> <Label Grid.Row="1" Grid.Column="2" Content="å æ°æ®ç±»åï¼" VerticalAlignment="Center" HorizontalAlignment="Right" /> <!--<TextBox Grid.Row="1" Grid.Column="3" Style="{StaticResource tb}" x:Name="tbAcqTim2e"/>--> <!--<ComboBox Grid.Row="1" Grid.Column="3" IsReadOnly="True" DisplayMemberPath="Name" Style="{StaticResource ComboBoxStyle}" Width="320" Height="30" HorizontalAlignment="Left" x:Name="cbMetaType"></ComboBox>--> @@ -187,7 +187,7 @@ <Label Grid.Row="3" Grid.Column="0" Content="èµæºç®å½ï¼" VerticalAlignment="Center" HorizontalAlignment="Right" /> <TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Style="{StaticResource tb}" x:Name="tbDir"/> <TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Style="{StaticResource tb}" IsReadOnly="True" x:Name="tbDir"/> <Button Grid.Row="3" Grid.Column="4" Content="é æ©" Style="{StaticResource btn}" Click="Dir_MouseLeftButtonDown" x:Name="btnDir"/> <Label Grid.Row="4" Grid.Column="0" Content="æ°æ®ç®å½ï¼" VerticalAlignment="Center" HorizontalAlignment="Right" /> DataLoader/MainWindow.xaml.cs
@@ -15,9 +15,11 @@ { public partial class MainWindow : Window { private ObservableCollection<ViewData> viewDatas = new ObservableCollection<ViewData>(); public ResWin resWin; private LoginWin win; private LoginWin loginWin; private ObservableCollection<ViewData> viewDatas = new ObservableCollection<ViewData>(); public MainWindow() { @@ -60,24 +62,19 @@ // 设置 private void Login_MouseLeftButtonDown(object sender, RoutedEventArgs e) { win = new LoginWin(); loginWin = new LoginWin(); this.Hide(); win.Show(); loginWin.Show(); } public void SetLoginInfo() { if (win != null) win.Close(); if (loginWin != null) loginWin.Close(); this.Show(); //this.tbUid.Text = Tool.UserId.ToString(); //this.tbToken.Text = Tool.Token; //string uidStr = this.tbUid.Text.Trim(); //string didStr = this.tbDir.Text.Trim(); //int.TryParse(uidStr, out Common.UserId); //int.TryParse(didStr, out Common.DirId); this.tbUid.Text = CommonProp.UserId.ToString(); this.tbUname.Text = CommonProp.Uname; this.tbToken.Text = CommonProp.Token; this.btnLoad.IsEnabled = true; this.btnImport.IsEnabled = true; @@ -86,7 +83,21 @@ // èµæºç®å½ private void Dir_MouseLeftButtonDown(object sender, RoutedEventArgs e) { resWin = new ResWin(); this.Hide(); resWin.Show(); } public void SetRes(string dircode, string fullName) { if (resWin != null) resWin.Close(); this.Show(); if (!string.IsNullOrEmpty(dircode)) { CommonProp.Dircode = dircode; this.tbDir.Text = fullName; } } // æ°æ®ç®å½ DataLoader/Model/SysDir.cs
@@ -86,5 +86,10 @@ /// ç¼ç /// </summary> public string code { set; get; } /// <summary> /// å®å ¨åç§° /// </summary> public string fullName { set; get; } } } DataLoader/Model/TreeItem.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,115 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataLoader.Model { public class TreeItem : INotifyPropertyChanged { private int id; private string name; private bool isChecked; private bool isExpanded; private ObservableCollection<TreeItem> child; public event PropertyChangedEventHandler PropertyChanged; public TreeItem() { } public TreeItem(int id, string name, string fullName) { this.id = id; this.name = name; this.FullName = fullName; } public int ID { set { this.id = value; ChangProperty("ID"); } get { return this.id; } } public string Name { set { this.name = value; ChangProperty("Name"); } get { return this.name; } } public bool IsChecked { set { isChecked = value; ChangProperty("IsChecked"); } get { return this.isChecked; } } public bool IsExpanded { set { isExpanded = value; ChangProperty("IsExpanded"); } get { return isExpanded; } } public string FullName { set; get; } public ObservableCollection<TreeItem> Child { set { child = value; ChangProperty("Child"); } get { return child; } } private void ChangProperty(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } } } DataLoader/ResWin.xaml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,67 @@ <Window x:Class="DataLoader.ResWin" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShowInTaskbar="False" Loaded="Window_Loaded" Closing="Window_Closing" xmlns:model="clr-namespace:DataLoader.Model" Background="Transparent" Title="è¯·éæ©èµæº" Height="750" Width="600" WindowStartupLocation="CenterScreen"> <Window.Resources> <Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="OverridesDefaultStyle" Value="False" /> <Setter Property="Height" Value="52"/> <Setter Property="IsChecked" Value="False"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="CheckBox"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Height}"> <Rectangle x:Name="CheckBoxRectangle" Fill="#00446F" Opacity="1" RadiusY="0" RadiusX="0"/> <Rectangle x:Name="CheckBoxRectangleOut" Stroke="#00A0E9" StrokeThickness="1" RadiusY="0" RadiusX="0"/> <Grid x:Name="CheckedMark" Height="{TemplateBinding Height}" Width="{TemplateBinding Height}" Visibility="Collapsed" > <Viewbox> <Grid> <Path SnapsToDevicePixels="True" StrokeThickness="4" Data="M1,9 L10,17" Stroke="#F6A411"/> <Path SnapsToDevicePixels="True" StrokeThickness="4" Data="M8,17 L20,4" Stroke="#F6A411"/> </Grid> </Viewbox> </Grid> </Grid> <ContentPresenter Grid.Column="1" VerticalAlignment="Center" Margin="8,0,0,0"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="CheckedMark" Property="Visibility" Value="Visible"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid> <Grid.Background> <SolidColorBrush Color="#0B498F" Opacity="0.3"/> </Grid.Background> <ScrollViewer Grid.Row="0" Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="5" Background="Transparent"> <TreeView x:Name="tvResTree" FontSize="13" Background="Transparent" Foreground="White" BorderThickness="0"> <TreeView.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type model:TreeItem}" ItemsSource="{Binding Path=Child}"> <StackPanel Orientation="Horizontal" Margin="0 10" Background="Transparent"> <CheckBox IsChecked="{Binding IsChecked}" Tag="{Binding ID}" Style="{StaticResource CheckBoxStyle}" Click="CheckBox_Click" Cursor="Hand" Margin="0 0 10 0" VerticalAlignment="Center" BorderBrush="#00A0E9" BorderThickness="1" Background="#00446F" Width="20" Height="20" VerticalContentAlignment='Center'/> <Border Tag="{Binding ID}" Height="32" VerticalAlignment="Center" BorderBrush="#1A63B5" BorderThickness="1" Padding="15 2 15 0" Cursor="Hand" MouseLeftButtonDown="Border_MouseLeftButtonDown"> <Border.Background> <SolidColorBrush Color="#0B498F" Opacity="0.3"/> </Border.Background> <TextBlock VerticalAlignment="Center" Text="{Binding Name}" FontSize="16" FontFamily="MicrosoftYaHei" Foreground="White" HorizontalAlignment="Center"/> </Border> </StackPanel> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> </ScrollViewer> </Grid> </Window> DataLoader/ResWin.xaml.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,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); } } }