管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-08-22 ca4c281f3e2f52b1e0cbb9caaf75581286d58a52
修改资源树的选择功能
已修改6个文件
52 ■■■■ 文件已修改
DataLoader/LoginWin.xaml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/MainWindow.xaml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/MainWindow.xaml.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/Model/CommonProp.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/ResWin.xaml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/ResWin.xaml.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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="登录窗口" ShowInTaskbar="False" WindowStyle="None"
        Loaded="Window_Loaded" Title="登录窗口" ShowInTaskbar="True" WindowStyle="None"
        Height="500" Width="750" WindowStartupLocation="CenterScreen">
    <Grid>
        <Chrome:ChromiumWebBrowser x:Name="web" Margin="1" Grid.Row="1" />
DataLoader/MainWindow.xaml
@@ -168,7 +168,7 @@
        <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>-->
        <ComboBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" VerticalContentAlignment="Center" Background="White" SelectedIndex="0" Width="322" Height="38" BorderThickness="0" x:Name="cbMetaType">
        <ComboBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" VerticalContentAlignment="Center" Cursor="Hand" Background="White" SelectedIndex="0" Width="322" Height="38" BorderThickness="0" x:Name="cbMetaType">
            <ComboBoxItem>请选择</ComboBoxItem>
            <ComboBoxItem>数字正射影像图</ComboBoxItem>
            <ComboBoxItem>数字高程模型</ComboBoxItem>
DataLoader/MainWindow.xaml.cs
@@ -83,14 +83,13 @@
        // 资源目录
        private void Dir_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {
            resWin = new ResWin();
            if (null == resWin) resWin = new ResWin();
            this.Hide();
            resWin.Show();
            this.resWin.Show();
        }
        public void SetRes(string dircode, string fullName)
        {
            if (resWin != null) resWin.Close();
            this.Show();
            if (!string.IsNullOrEmpty(dircode))
DataLoader/Model/CommonProp.cs
@@ -61,6 +61,11 @@
        public static string Depname;
        /// <summary>
        /// 目录ID
        /// </summary>
        public static int dirId;
        /// <summary>
        /// 目录编码
        /// </summary>
        public static string Dircode;
DataLoader/ResWin.xaml
@@ -1,7 +1,7 @@
<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"
        Loaded="Window_Loaded" Closing="Window_Closing"
        xmlns:model="clr-namespace:DataLoader.Model" Background="Transparent"
        Title="请选择资源" Height="750" Width="600" WindowStartupLocation="CenterScreen">
    <Window.Resources>
DataLoader/ResWin.xaml.cs
@@ -7,6 +7,8 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using CefSharp.Callback;
using System.Windows.Media;
namespace DataLoader
{
@@ -35,6 +37,7 @@
            FindTreeItems(dirs, items, 0);
            this.tvResTree.ItemsSource = items.Child;
            //SetCheckedBox();
        }
        private void FindTreeItems(List<SysDir> list, TreeItem ti, int pid)
@@ -49,9 +52,35 @@
                    item.Name = dir.name;
                    item.FullName = dir.fullName;
                    item.IsExpanded = true;
                    item.IsChecked = CommonProp.dirId == dir.id;
                    ti.Child.Add(item);
                    FindTreeItems(list, item, dir.id);
                }
            }
        }
        private void SetCheckedBox()
        {
            if (CommonProp.dirId == 0) return;
            foreach (var item in this.tvResTree.Items)
            {
                TreeViewItem tvItem = this.tvResTree.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
                if (null == tvItem) continue;  //((System.Windows.Controls.Panel)tvItem.VisualParent).Children
                for (int i = 0, c = VisualTreeHelper.GetChildrenCount(tvItem); i < c; i++)
                {
                    DependencyObject child = VisualTreeHelper.GetChild(this.tvResTree, i);
                    if (child is CheckBox)
                    {
                        CheckBox cb = child as CheckBox;
                        if (cb.IsChecked == true)
                        {
                            this.cbLast = cb;
                            return;
                        }
                    }
                }
            }
        }
@@ -75,12 +104,13 @@
            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.dirId = int.Parse(this.cbLast.Tag.ToString());
                dir = (from d in dirs where d.id == CommonProp.dirId select d).First<SysDir>();
            }
            CommonProp.Owner.resWin = null;
            this.Hide();
            CommonProp.Owner.SetRes(null == dir ? null : dir.code, null == dir ? null : dir.fullName);
            e.Cancel = true;
        }
    }
}