Compare commits
2 Commits
bda7c4f849
...
3a2d551fc8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3a2d551fc8 | ||
![]() |
d5d39ed68d |
Binary file not shown.
BIN
newFront/c#前端/CAD.Extend/Images/pic1.png
Normal file
BIN
newFront/c#前端/CAD.Extend/Images/pic1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 755 B |
42
newFront/c#前端/CAD.Extend/Model/KeyValueModel.cs
Normal file
42
newFront/c#前端/CAD.Extend/Model/KeyValueModel.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CAD.Extend.Model
|
||||
{
|
||||
public class KeyValueModel
|
||||
{
|
||||
private string _Key;
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Key;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Key = value;
|
||||
}
|
||||
}
|
||||
private string _Value;
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
using Bricscad.ApplicationServices;
|
||||
using Bricscad.Windows;
|
||||
using Prism.Dialogs;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Telerik.Windows.Controls;
|
||||
using Unity;
|
||||
|
||||
namespace CAD.Extend.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// abstract 不同于接口,可以实现具体的代码
|
||||
/// </summary>
|
||||
public abstract class DialogBase : ViewModelBase
|
||||
{
|
||||
public DialogBase()
|
||||
{
|
||||
_dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
||||
window_loaded = new DelegateCommand(onWindow_loaded);
|
||||
CloseCommand = new DelegateCommand(ExecuteCloseCommand);
|
||||
OKCommand = new DelegateCommand(ExecuteOKCommandAsync);
|
||||
|
||||
}
|
||||
#region binding
|
||||
private bool _isbusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return _isbusy; }
|
||||
set { _isbusy = value; RaisePropertyChanged(nameof(IsBusy)); }
|
||||
}
|
||||
private string _BusyContent;
|
||||
|
||||
public string BusyContent
|
||||
{
|
||||
get { return _BusyContent; }
|
||||
set { _BusyContent = value; RaisePropertyChanged(nameof(BusyContent)); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载后
|
||||
/// </summary>
|
||||
public ICommand window_loaded { get; }
|
||||
public ICommand CloseCommand { get; }
|
||||
|
||||
public ICommand OKCommand { get; }
|
||||
private string _title;
|
||||
|
||||
public string title
|
||||
{
|
||||
get { return _title; }
|
||||
set { _title = value; RaisePropertyChanged(nameof(title)); }
|
||||
}
|
||||
#endregion
|
||||
IUnityContainer _unityContainer;
|
||||
public readonly IDialogService _dialogService;
|
||||
/// <summary>
|
||||
/// CODE-BEHAND里设置为this.close以关闭。调用时,.invoke即可
|
||||
/// </summary>
|
||||
public Action CloseWindowAction { get; set; }
|
||||
/// <summary>
|
||||
/// virtual 可以重写
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public virtual void ExecuteCloseCommand(object parameter)
|
||||
{
|
||||
// 关闭窗口 (需要通过 CommandParameter 传入窗口实例)
|
||||
if (parameter is System.Windows.Window window)
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
public virtual void onWindow_loaded(object para)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void ExecuteOKCommandAsync(object para)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<UserControl
|
||||
x:Class="CAD.Extend.Views.CustomControl.customWindowTitleBar"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CAD.Extend.Views.CustomControl"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<!-- 引用外部资源字典 -->
|
||||
<UserControl.Resources>
|
||||
<!-- 使用相对路径引用 CustomStyles.xaml -->
|
||||
<ResourceDictionary Source="pack://application:,,,/CAD.Extend;component/Views/Style/CustomStyles.xaml" />
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border
|
||||
Height="30"
|
||||
VerticalAlignment="Top"
|
||||
Background="{StaticResource ColorPrimary}"
|
||||
MouseDown="Border_MouseDown">
|
||||
<Grid>
|
||||
<Label
|
||||
x:Name="lblTitle"
|
||||
Height="30"
|
||||
VerticalContentAlignment="Center"
|
||||
d:Content="标题栏文字"
|
||||
Content="{Binding title, Mode=TwoWay}"
|
||||
FontSize="12"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Width="30"
|
||||
Height="30"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Command="{Binding CloseCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
Content="✖"
|
||||
Foreground="White" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CAD.Extend.Views.CustomControl
|
||||
{
|
||||
/// <summary>
|
||||
/// customWindowTitleBar.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class customWindowTitleBar : UserControl
|
||||
{
|
||||
public customWindowTitleBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Border_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// 将事件传递给父窗口,要求窗口进行拖动
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
var window = Window.GetWindow(this); // 获取父窗口
|
||||
window?.DragMove(); // 调用窗口的 DragMove 方法
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置Title
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
public void SetTitle(string title)
|
||||
{
|
||||
lblTitle.Content = title;
|
||||
}
|
||||
}
|
||||
}
|
21
newFront/c#前端/CAD.Extend/Views/CustomDialogWindow.xaml
Normal file
21
newFront/c#前端/CAD.Extend/Views/CustomDialogWindow.xaml
Normal file
@ -0,0 +1,21 @@
|
||||
<Window
|
||||
x:Class="CAD.Extend.Views.CustomDialogWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Width="auto"
|
||||
Height="auto"
|
||||
AllowsTransparency="True"
|
||||
Background="White"
|
||||
BorderBrush="#026BE3"
|
||||
BorderThickness="1"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/CAD.Extend;component/Views/Style/CustomStyles.xaml" />
|
||||
</Window.Resources>
|
||||
|
||||
</Window>
|
36
newFront/c#前端/CAD.Extend/Views/CustomDialogWindow.xaml.cs
Normal file
36
newFront/c#前端/CAD.Extend/Views/CustomDialogWindow.xaml.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using Prism.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CAD.Extend.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomDialogWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CustomDialogWindow : Window, IDialogWindow
|
||||
{
|
||||
public CustomDialogWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口样式(可选)
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
|
||||
}
|
||||
|
||||
public IDialogResult Result { get ; set ; }
|
||||
}
|
||||
}
|
132
newFront/c#前端/CAD.Extend/Views/DialogConvertBaseMap.xaml
Normal file
132
newFront/c#前端/CAD.Extend/Views/DialogConvertBaseMap.xaml
Normal file
@ -0,0 +1,132 @@
|
||||
<UserControl
|
||||
x:Class="CAD.Extend.Views.DialogConvertBaseMap"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CAD.Extend.Views.CustomControl"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||
Width="360"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<!-- 使用相对路径引用 CustomStyles.xaml -->
|
||||
<ResourceDictionary Source="pack://application:,,,/CAD.Extend;component/Views/Style/CustomStyles.xaml" />
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<local:customWindowTitleBar x:Name="titleBar" />
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Height="auto"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Content="底图颜色:" />
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
Width="60"
|
||||
Height="25"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{Binding BlockColor}"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1" />
|
||||
<telerik:RadButton
|
||||
Margin="10,0,0,0"
|
||||
Background="SeaGreen"
|
||||
Command="{Binding Command_Color}"
|
||||
Content="选择颜色"
|
||||
Style="{StaticResource sysBtn2}" />
|
||||
</StackPanel>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Height="auto"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Content="底图图层:" />
|
||||
<telerik:RadComboBox
|
||||
x:Name="comboxLayerName"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Height="25"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Left"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{Binding listLayerName}"
|
||||
SelectedItem="{Binding SelectedLayerName, Mode=TwoWay}"
|
||||
Style="{StaticResource sysCombobox}" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Height="auto"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Content="变为图块:" />
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<CheckBox
|
||||
Width="30"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
IsChecked="{Binding IsToBlock}" />
|
||||
<telerik:RadWatermarkTextBox
|
||||
x:Name="txtBlockName"
|
||||
Width="170"
|
||||
Height="25"
|
||||
Margin="0,0,0,0"
|
||||
IsEnabled="{Binding IsToBlock}"
|
||||
Text="{Binding BlockName, Mode=TwoWay}"
|
||||
WatermarkContent="请输入块名" />
|
||||
<telerik:RadButton
|
||||
Background="SeaGreen"
|
||||
Command="{Binding Command_BlockName}"
|
||||
Content="随机"
|
||||
IsEnabled="{Binding IsToBlock}"
|
||||
Style="{StaticResource sysBtn}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Height="30"
|
||||
Background="{StaticResource ColorPrimary}">
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<telerik:RadButton
|
||||
Margin="5"
|
||||
Command="{Binding OKCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
Content="确定"
|
||||
Style="{StaticResource sysBtn}" />
|
||||
<telerik:RadButton
|
||||
Margin="5"
|
||||
Command="{Binding CloseCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
Content="取消"
|
||||
Style="{StaticResource sysBtn2}" />
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
16
newFront/c#前端/CAD.Extend/Views/DialogConvertBaseMap.xaml.cs
Normal file
16
newFront/c#前端/CAD.Extend/Views/DialogConvertBaseMap.xaml.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CAD.Extend.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogConvertBaseMap.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DialogConvertBaseMap : UserControl
|
||||
{
|
||||
public DialogConvertBaseMap()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
155
newFront/c#前端/CAD.Extend/Views/Style/CustomStyles.xaml
Normal file
155
newFront/c#前端/CAD.Extend/Views/Style/CustomStyles.xaml
Normal file
@ -0,0 +1,155 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:CAD.Extend.Views.CustomControl"
|
||||
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
|
||||
<!-- 系统颜色 -->
|
||||
<SolidColorBrush x:Key="ColorPrimary" Color="#026BE3" />
|
||||
<SolidColorBrush x:Key="ColorSecond" Color="#02ADFF" />
|
||||
<SolidColorBrush x:Key="ColorOther" Color="#DBE0E4" />
|
||||
|
||||
|
||||
|
||||
<!-- style放后面,单纯的属性放前面,否则解析顺序不对 -->
|
||||
<!-- modalwindow -->
|
||||
<Style x:Key="CustomWindowStyle" TargetType="Window">
|
||||
<Setter Property="AllowsTransparency" Value="True" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="ResizeMode" Value="NoResize" />
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
</Style>
|
||||
<!-- 系统按钮风格 -->
|
||||
<Style x:Key="sysBtn" TargetType="Button">
|
||||
<Setter Property="Width" Value="65" />
|
||||
<Setter Property="Height" Value="26" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="{StaticResource ColorSecond}" />
|
||||
<Style.Triggers>
|
||||
<!-- 鼠标滑过时的背景颜色和前景颜色 -->
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
<!-- 高亮背景色 -->
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="sysBtn2" TargetType="Button">
|
||||
<Setter Property="Width" Value="65" />
|
||||
<Setter Property="Height" Value="26" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="{StaticResource ColorOther}" />
|
||||
<Style.Triggers>
|
||||
<!-- 鼠标滑过时的背景颜色和前景颜色 -->
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
<!-- 高亮背景色 -->
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="sysBtn3" TargetType="Button">
|
||||
<Setter Property="Width" Value="120" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
<Setter Property="Margin" Value="5,2,5,2" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="{StaticResource ColorOther}" />
|
||||
<Style.Triggers>
|
||||
<!-- 鼠标滑过时的背景颜色和前景颜色 -->
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource ColorOther}" />
|
||||
<!-- 高亮背景色 -->
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 系统textblock -->
|
||||
<Style x:Key="sysLabel" TargetType="TextBlock">
|
||||
<Setter Property="Height" Value="20" />
|
||||
<Setter Property="Margin" Value="0,5,0,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="sysLabel2" TargetType="TextBlock">
|
||||
<Setter Property="Width" Value="Auto" />
|
||||
<Setter Property="Height" Value="15" />
|
||||
<Setter Property="Margin" Value="5,0,0,0" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!-- 系统textbox -->
|
||||
<Style x:Key="sysTextBox" TargetType="TextBox">
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Margin" Value="5,5,5,0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="WhiteStyle" TargetType="TextBox">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="#2d3135" />
|
||||
<Setter Property="BorderBrush" Value="Black" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="sysDescribeTextBox" TargetType="TextBox">
|
||||
<Setter Property="Height" Value="50" />
|
||||
<Setter Property="Width" Value="213" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="AcceptsReturn" Value="True" />
|
||||
<Setter Property="Margin" Value="5,5,5,0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
<Style x:Key="sysTextAreaInfo" TargetType="TextBox">
|
||||
<Setter Property="Height" Value="100" />
|
||||
<Setter Property="Width" Value="300" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="AcceptsReturn" Value="True" />
|
||||
<Setter Property="Margin" Value="10,5,10,5" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
<!-- 全局 RadFilePathPicker 样式 -->
|
||||
<Style x:Key="sysFilePathPicker" TargetType="telerik:RadFilePathPicker">
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Margin" Value="5,0,5,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="sysCombobox" TargetType="telerik:RadComboBox">
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Margin" Value="5,5,5,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
Binary file not shown.
Binary file not shown.
55
newFront/c#前端/DI-Electrical/GlobalObject.cs
Normal file
55
newFront/c#前端/DI-Electrical/GlobalObject.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using DI_Electrical.Model;
|
||||
using IniParser;
|
||||
using Prism.Ioc;
|
||||
using Unity;
|
||||
|
||||
namespace DI_Electrical
|
||||
{
|
||||
public class GlobalObject
|
||||
{
|
||||
public static loginRes userInfo;
|
||||
public static HttpClient client;
|
||||
public static bool isConfigIniCreateBySys = true;
|
||||
public static List<User> Users;
|
||||
public static ec_project curProject;
|
||||
public static string ConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Config.ini");
|
||||
public static IUnityContainer container;
|
||||
#region 本地文件目录
|
||||
static string _LocalFileDirectory;
|
||||
/// <summary>
|
||||
/// 获取本地目录文件夹
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetLocalFileDirectory()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_LocalFileDirectory))
|
||||
{
|
||||
FileIniDataParser parser = new FileIniDataParser();
|
||||
var data = parser.ReadFile(ConfigPath);
|
||||
_LocalFileDirectory = data["Profile"]["Directory"];
|
||||
return _LocalFileDirectory;
|
||||
}
|
||||
else
|
||||
{ return _LocalFileDirectory; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置本地目录文件夹
|
||||
/// </summary>
|
||||
/// <param name="dir">文件夹目录</param>
|
||||
public static void SetLocalFileDirectory(string dir)
|
||||
{ _LocalFileDirectory = dir; }
|
||||
#endregion
|
||||
public enum dialogPar
|
||||
{
|
||||
id,
|
||||
title,
|
||||
info,
|
||||
para1,
|
||||
para2
|
||||
}
|
||||
}
|
||||
}
|
@ -11,8 +11,9 @@ using Teigha.DatabaseServices;
|
||||
using Teigha.Geometry;
|
||||
using Database = Teigha.DatabaseServices.Database;
|
||||
using Entity = Teigha.DatabaseServices.Entity;
|
||||
using Path = System.IO.Path;
|
||||
using Path = System.IO.Path;
|
||||
using Color = Teigha.Colors.Color;
|
||||
using System.Security.Cryptography;
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
public static class General
|
||||
@ -570,11 +571,14 @@ namespace SWS.CAD.Base
|
||||
SymbolUtilityServices.GetBlockModelSpaceId(destDb),
|
||||
OpenMode.ForWrite
|
||||
);
|
||||
|
||||
// 处理插入结果
|
||||
if (dragResult.Status == PromptStatus.OK)
|
||||
{
|
||||
btr.AppendEntity(br);
|
||||
tr.AddNewlyCreatedDBObject(br, true);
|
||||
|
||||
//AddValueToAcdbDictionary(tr, br, "1410523e-d594-4527-9f04-130bb89c1cf0", "");
|
||||
tr.Commit();
|
||||
oid = br.Id;
|
||||
ed.WriteMessage($"\n 成功插入图元: {filePath} \n");
|
||||
@ -591,10 +595,12 @@ namespace SWS.CAD.Base
|
||||
{
|
||||
Entity ent01 = transaction.GetObject(oid, OpenMode.ForWrite) as Entity;
|
||||
ResultBuffer rb = new ResultBuffer();
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataRegAppName, tagNumber));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataAsciiString, "TEST"));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataRegAppName, "HKSK_NODES"));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataAsciiString, "HKSK_END"));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataHandle, oid.Handle.ToString()));
|
||||
ent01.XData = rb;
|
||||
transaction.Commit();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -657,6 +663,182 @@ namespace SWS.CAD.Base
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 创建块字典
|
||||
private static void AddValueToAcdbDictionary(Transaction tr, BlockReference blockRef, string key, string value)
|
||||
{
|
||||
// 1. 确保块参照有扩展字典
|
||||
DBDictionary extDict = GetOrCreateExtensionDictionary(tr, blockRef);
|
||||
|
||||
// 2. 获取或创建acdbdictionary
|
||||
DBDictionary acdbDict = GetOrCreateAcdbDictionary(tr, extDict);
|
||||
|
||||
// 3. 创建XRecord存储值
|
||||
Xrecord valueXrec = new Xrecord();
|
||||
tr.AddNewlyCreatedDBObject(valueXrec, true);
|
||||
|
||||
// 4. 设置XRecord数据
|
||||
//ResultBuffer rb = new ResultBuffer(
|
||||
// new TypedValue(1000, "块自定义数据"),
|
||||
// new TypedValue(1000, key),
|
||||
// new TypedValue(1000, value)
|
||||
//);
|
||||
//valueXrec.Data = rb;
|
||||
|
||||
// 5. 添加到acdbdictionary
|
||||
acdbDict.SetAt(key, valueXrec);
|
||||
}
|
||||
|
||||
private static DBDictionary GetOrCreateExtensionDictionary(Transaction tr, DBObject obj)
|
||||
{
|
||||
if (obj.ExtensionDictionary.IsNull)
|
||||
{
|
||||
// 创建新扩展字典
|
||||
obj.UpgradeOpen();
|
||||
obj.CreateExtensionDictionary();
|
||||
}
|
||||
|
||||
return (DBDictionary)tr.GetObject(
|
||||
obj.ExtensionDictionary, OpenMode.ForWrite);
|
||||
}
|
||||
|
||||
private static DBDictionary GetOrCreateAcdbDictionary(Transaction tr, DBDictionary extDict)
|
||||
{
|
||||
const string acdbDictName = "StLegend";
|
||||
|
||||
if (extDict.Contains(acdbDictName))
|
||||
{
|
||||
return (DBDictionary)tr.GetObject(
|
||||
extDict.GetAt(acdbDictName), OpenMode.ForWrite);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 创建新acdbdictionary
|
||||
DBDictionary acdbDict = new DBDictionary();
|
||||
extDict.SetAt(acdbDictName, acdbDict);
|
||||
tr.AddNewlyCreatedDBObject(acdbDict, true);
|
||||
return acdbDict;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 读取元件块,插入图纸
|
||||
/// <summary>
|
||||
/// 读取元件块,插入图纸
|
||||
/// </summary>
|
||||
/// <param name="filePath">图元文件路径</param>
|
||||
/// <param name="tag">传入的位号</param>
|
||||
/// <param name="tag">位号值</param>
|
||||
/// <param name="objTypeId">元件类型ID</param>
|
||||
/// <param name="scale">比例大小</param>
|
||||
/// <param name="tagPoint">坐标位置</param>
|
||||
/// <returns></returns>
|
||||
public static ObjectId AddTagDWG(string filePath, string tagName, string tag, string objTypeId, double scale, Point3d tagPoint)
|
||||
{
|
||||
if (scale == 0)
|
||||
{ scale = 1; }
|
||||
Document doc = Application.DocumentManager.MdiActiveDocument;
|
||||
var ed = doc.Editor;
|
||||
ObjectId oid = ObjectId.Null;
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
ed.WriteMessage("\n 错误:图元文件不存在!\n");
|
||||
return oid;
|
||||
}
|
||||
// 获取当前数据库
|
||||
Database destDb = HostApplicationServices.WorkingDatabase;
|
||||
using (Transaction tr = destDb.TransactionManager.StartTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建临时数据库读取外部DWG
|
||||
using (Database sourceDb = new Database(false, true))
|
||||
{
|
||||
sourceDb.ReadDwgFile(filePath, FileOpenMode.OpenForReadAndAllShare, false, null);
|
||||
|
||||
// 生成唯一块名(避免重名)
|
||||
string blockName = GetUniqueBlockName(destDb, tagName);
|
||||
// 将外部DWG转换为块定义
|
||||
ObjectId blockId = destDb.Insert(blockName, sourceDb, true);
|
||||
// 创建块参照
|
||||
BlockReference br = new BlockReference(
|
||||
Point3d.Origin, // 插入点(可修改)
|
||||
blockId// bt[blockName]
|
||||
);
|
||||
br.Position = tagPoint;
|
||||
// 设置比例和旋转
|
||||
br.ScaleFactors = new Scale3d(scale); //比例因子
|
||||
br.Rotation = 0.0; // 旋转角度(弧度)
|
||||
// 获取实时鼠标位置
|
||||
// 添加到当前模型空间
|
||||
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(
|
||||
SymbolUtilityServices.GetBlockModelSpaceId(destDb),
|
||||
OpenMode.ForWrite
|
||||
);
|
||||
|
||||
// 处理插入结果
|
||||
btr.AppendEntity(br);
|
||||
tr.AddNewlyCreatedDBObject(br, true);
|
||||
//创建位号属性
|
||||
var attDef = AddAttributeDefinition(btr, "HKSK_TAG", tag);
|
||||
AttributeReference attRef = new AttributeReference();
|
||||
attRef.SetAttributeFromBlock(attDef, br.BlockTransform);
|
||||
br.AttributeCollection.AppendAttribute(attRef);
|
||||
tr.AddNewlyCreatedDBObject(attRef, true);
|
||||
//添加字典
|
||||
AddValueToAcdbDictionary(tr, br, objTypeId, "");
|
||||
tr.Commit();
|
||||
oid = br.Id;
|
||||
ed.WriteMessage($"\n 成功插入图元: {filePath} \n");
|
||||
|
||||
}
|
||||
// 设置XData
|
||||
CreateRegApp(doc, tag);
|
||||
using (Transaction transaction = destDb.TransactionManager.StartTransaction())
|
||||
{
|
||||
Entity ent01 = transaction.GetObject(oid, OpenMode.ForWrite) as Entity;
|
||||
ResultBuffer rb = new ResultBuffer();
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataRegAppName, "HKSK_NODES"));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataAsciiString, "HKSK_END"));
|
||||
rb.Add(new TypedValue((int)DxfCode.ExtendedDataHandle, oid.Handle.ToString()));
|
||||
ent01.XData = rb;
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tr.Abort();
|
||||
ed.WriteMessage($"\n错误: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
return oid;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static AttributeDefinition AddAttributeDefinition(BlockTableRecord btr, string tag, string value)
|
||||
{
|
||||
// 创建属性定义
|
||||
AttributeDefinition attDef = new AttributeDefinition()
|
||||
{
|
||||
// 属性位置(在圆形下方)
|
||||
Position = new Point3d(0, 100, 0),
|
||||
// 属性文字设置
|
||||
Height = 2, // 文字高度
|
||||
Justify = AttachmentPoint.BaseMid, // 对齐
|
||||
// 属性定义参数
|
||||
Tag = tag,// 属性标签(唯一标识)
|
||||
Prompt = "", // 提示信息
|
||||
TextString = value, // 默认值
|
||||
Layer = "0", // 图层
|
||||
// 设置属性可见性
|
||||
Invisible = false,
|
||||
Visible = false // 可见
|
||||
// 将属性定义添加到块
|
||||
};
|
||||
btr.AppendEntity(attDef);
|
||||
return attDef;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取当前图纸选择集数量
|
||||
/// <summary>
|
||||
@ -883,6 +1065,74 @@ namespace SWS.CAD.Base
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取当前图纸所有实体
|
||||
/// <summary>
|
||||
/// 获取当前图纸XData不为空的所有实体
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<DtoBasePoint> GetAllEntity()
|
||||
{
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
|
||||
List<DtoBasePoint> handles = new List<DtoBasePoint>();
|
||||
try
|
||||
{
|
||||
// 开启事务
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
// 获取模型空间块表记录
|
||||
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
|
||||
BlockTableRecord modelSpace = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
|
||||
|
||||
// 遍历模型空间中的所有实体
|
||||
foreach (ObjectId objId in modelSpace)
|
||||
{
|
||||
Entity entity = tr.GetObject(objId, OpenMode.ForRead) as Entity;
|
||||
if (entity != null && entity.XData != null)
|
||||
{
|
||||
// 提取句柄(十六进制格式)
|
||||
var blockRef = entity as BlockReference;
|
||||
if (blockRef != null)
|
||||
{
|
||||
var dto = new DtoBasePoint()
|
||||
{
|
||||
Handle = entity.Handle.ToString(),
|
||||
X = blockRef.Position.X,
|
||||
Y = blockRef.Position.Y,
|
||||
Z = blockRef.Position.Z
|
||||
};
|
||||
// 检查属性
|
||||
// 检查属性集合
|
||||
foreach (ObjectId attId in blockRef.AttributeCollection)
|
||||
{
|
||||
AttributeReference attRef = (AttributeReference)tr.GetObject(
|
||||
attId, OpenMode.ForRead);
|
||||
|
||||
if (attRef.Tag == "HKSK_TAG")
|
||||
{
|
||||
dto.TagNumber = attRef.TextString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handles.Add(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
ed.WriteMessage($"\n错误: {ex.Message}");
|
||||
}
|
||||
return handles;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关联云线
|
||||
|
||||
public static List<string> SelectHandles = new List<string>();
|
||||
@ -1093,7 +1343,7 @@ namespace SWS.CAD.Base
|
||||
{
|
||||
//ed.WriteMessage("\n未找到匹配的图元");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Entity entity = (Entity)tr.GetObject(objId, OpenMode.ForWrite);
|
||||
if (entity.XData != null)
|
||||
{ continue; }
|
||||
@ -1465,7 +1715,287 @@ namespace SWS.CAD.Base
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取所有顶级字典名称
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有顶级字典名称
|
||||
/// </summary>
|
||||
public static List<string> GetTopLevelDictionaryNames()
|
||||
{
|
||||
var doc = Application.DocumentManager.MdiActiveDocument;
|
||||
var ed = doc.Editor;
|
||||
var db = doc.Database;
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
DBDictionary nod = (DBDictionary)tr.GetObject(
|
||||
db.NamedObjectsDictionaryId, OpenMode.ForRead);
|
||||
|
||||
return nod.Cast<DBDictionaryEntry>()
|
||||
.Select(entry => entry.Key)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取字典内容
|
||||
/// <summary>
|
||||
/// 获取字典内容
|
||||
/// </summary>
|
||||
public static Dictionary<string, object> GetDictionaryContents(string dictionaryName)
|
||||
{
|
||||
var doc = Application.DocumentManager.MdiActiveDocument;
|
||||
var ed = doc.Editor;
|
||||
var db = doc.Database;
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
DBDictionary nod = (DBDictionary)tr.GetObject(
|
||||
db.NamedObjectsDictionaryId, OpenMode.ForRead);
|
||||
|
||||
if (nod.Contains(dictionaryName))
|
||||
{
|
||||
DBDictionary dict = (DBDictionary)tr.GetObject(
|
||||
nod.GetAt(dictionaryName), OpenMode.ForRead);
|
||||
|
||||
foreach (DBDictionaryEntry entry in dict)
|
||||
{
|
||||
// result[entry.Key] = GetDbObjectValue(tr, entry.Value);
|
||||
}
|
||||
}
|
||||
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
private static string GetDxfCodeDescription(int dxfCode)
|
||||
{
|
||||
string res = string.Empty;
|
||||
switch (dxfCode)
|
||||
{
|
||||
case 0:
|
||||
res = "实体类型";
|
||||
break;
|
||||
case 1:
|
||||
res = "主文本值";
|
||||
break;
|
||||
case 2:
|
||||
res = "名称";
|
||||
break;
|
||||
case 3:
|
||||
res = "其他文本值";
|
||||
break;
|
||||
case 4:
|
||||
res = "附加文本";
|
||||
break;
|
||||
case 5:
|
||||
res = "实体句柄";
|
||||
break;
|
||||
case 6:
|
||||
res = "线型名称";
|
||||
break;
|
||||
case 7:
|
||||
res = "文字样式名称";
|
||||
break;
|
||||
case 8:
|
||||
res = "图层名称";
|
||||
break;
|
||||
case 10:
|
||||
res = "X坐标";
|
||||
break;
|
||||
case 20:
|
||||
res = "Y坐标";
|
||||
break;
|
||||
case 30:
|
||||
res = "Z坐标";
|
||||
break;
|
||||
case 40:
|
||||
res = "数值";
|
||||
break;
|
||||
case 50:
|
||||
res = "角度";
|
||||
break;
|
||||
case 60:
|
||||
res = "实体可见性";
|
||||
break;
|
||||
case 62:
|
||||
res = "颜色编号";
|
||||
break;
|
||||
case 70:
|
||||
res = "标志值";
|
||||
break;
|
||||
case 90:
|
||||
res = "32位整数";
|
||||
break;
|
||||
case 100:
|
||||
res = "子类标记";
|
||||
break;
|
||||
case 1000:
|
||||
res = "扩展数据字符串";
|
||||
break;
|
||||
case 1001:
|
||||
res = "扩展数据应用名称";
|
||||
break;
|
||||
case 1002:
|
||||
res = "扩展数据控制字符串";
|
||||
break;
|
||||
case 1003:
|
||||
res = "图层名称";
|
||||
break;
|
||||
case 1004:
|
||||
res = "二进制数据";
|
||||
break;
|
||||
case 1005:
|
||||
res = "数据库句柄";
|
||||
break;
|
||||
case 1010:
|
||||
res = "X值";
|
||||
break;
|
||||
case 1020:
|
||||
res = "Y值";
|
||||
break;
|
||||
case 1030:
|
||||
res = "Z值";
|
||||
break;
|
||||
case 1040:
|
||||
res = "双精度浮点值";
|
||||
break;
|
||||
case 1070:
|
||||
res = "16位整数";
|
||||
break;
|
||||
case 1071:
|
||||
res = "32位整数";
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
private static Dictionary<int, object> ProcessXRecord(Xrecord xrec)
|
||||
{
|
||||
var result = new Dictionary<int, object>();
|
||||
|
||||
if (xrec.Data != null)
|
||||
{
|
||||
foreach (TypedValue tv in xrec.Data)
|
||||
{
|
||||
result[tv.TypeCode] = tv.Value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存当前图纸
|
||||
/// <summary>
|
||||
/// 保存当前图纸的命令
|
||||
/// </summary>
|
||||
public static void SaveCurrentDrawing()
|
||||
{
|
||||
// 获取当前活动文档
|
||||
Document doc = Application.DocumentManager.MdiActiveDocument;
|
||||
// 获取编辑器,用于输出信息
|
||||
Editor ed = doc.Editor;
|
||||
try
|
||||
{
|
||||
doc.Database.Save();
|
||||
ed.WriteMessage("\n文档保存成功!");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
// 捕获并显示错误信息
|
||||
ed.WriteMessage("\n保存失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 打开元件图纸,改变位号的属性值
|
||||
/// <summary>
|
||||
/// 打开元件图纸,改变位号的属性值
|
||||
/// </summary>
|
||||
/// <param name="dwgName">元件图纸路径</param>
|
||||
/// <param name="listTagName">位号属性名</param>
|
||||
/// <param name="tagNumber">位号值</param>
|
||||
/// <param name="IsNotDefaultSymbol">true:默认块,false:异性块</param>
|
||||
/// <returns></returns>
|
||||
public static bool UpdateCableNo(string dwgName, List<string> listTagName, string tagNumber, bool IsNotDefaultSymbol, string tag, string system)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
OpenDwg(dwgName);
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
// 开启事务
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
// 获取模型空间块表记录
|
||||
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
|
||||
BlockTableRecord modelSpace = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
|
||||
|
||||
// 遍历模型空间中的所有实体
|
||||
foreach (ObjectId objId in modelSpace)
|
||||
{
|
||||
Entity entity = tr.GetObject(objId, OpenMode.ForRead) as Entity;
|
||||
if (entity != null)
|
||||
{
|
||||
// 提取句柄(十六进制格式)
|
||||
var blockRef = entity as BlockReference;
|
||||
if (blockRef != null)
|
||||
{
|
||||
// 检查属性
|
||||
// 检查属性集合
|
||||
foreach (ObjectId attId in blockRef.AttributeCollection)
|
||||
{
|
||||
AttributeReference attRef = (AttributeReference)tr.GetObject(
|
||||
attId, OpenMode.ForWrite);
|
||||
|
||||
if (listTagName.Contains(attRef.Tag) && !IsNotDefaultSymbol)
|
||||
{
|
||||
attRef.TextString = tagNumber;
|
||||
break;
|
||||
}
|
||||
if (IsNotDefaultSymbol)
|
||||
{
|
||||
if (attRef.Tag.ToLower() == "system")
|
||||
{
|
||||
attRef.TextString = system;
|
||||
//if (tagNumber.Contains("-"))
|
||||
//{
|
||||
// attRef.TextString = tagNumber.Substring(0, tagNumber.LastIndexOf("-"));
|
||||
//}
|
||||
//else { attRef.TextString = tagNumber; }
|
||||
}
|
||||
else if (attRef.Tag.ToLower() == "tag")
|
||||
{
|
||||
attRef.TextString = tag;
|
||||
//if (tagNumber.Contains("-"))
|
||||
//{
|
||||
// attRef.TextString = tagNumber.Substring(tagNumber.LastIndexOf("-") + 1);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
tr.Commit();
|
||||
}
|
||||
doc.CloseAndSave(dwgName);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SendMessage(ex.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
30
newFront/c#前端/SWS.CAD.Base/Model/DtoBasePoint.cs
Normal file
30
newFront/c#前端/SWS.CAD.Base/Model/DtoBasePoint.cs
Normal file
@ -0,0 +1,30 @@
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 基点信息
|
||||
/// </summary>
|
||||
public class DtoBasePoint
|
||||
{
|
||||
/// <summary>
|
||||
/// 句柄
|
||||
/// </summary>
|
||||
public string Handle { get; set; }
|
||||
/// <summary>
|
||||
/// 位号
|
||||
/// </summary>
|
||||
public string TagNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// x坐标
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
/// <summary>
|
||||
/// y坐标
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
/// <summary>
|
||||
/// z坐标
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -51,6 +51,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="BlockDragJig.cs" />
|
||||
<Compile Include="General.cs" />
|
||||
<Compile Include="Model\DtoBasePoint.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -36,7 +36,7 @@
|
||||
<HintPath>..\packages\Aspose.Cells.25.3.0\lib\net40\Aspose.Cells.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BrxMgd">
|
||||
<HintPath>..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\BrxMgd.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\BrxMgd.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DryIoc, Version=5.4.3.0, Culture=neutral, PublicKeyToken=dfbf2bd50fcf7768, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DryIoc.dll.5.4.3\lib\net45\DryIoc.dll</HintPath>
|
||||
@ -119,7 +119,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TD_Mgd">
|
||||
<HintPath>..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\TD_Mgd.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\TD_Mgd.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.Windows.Controls, Version=2023.2.718.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
@ -232,6 +232,19 @@ namespace SWS.Commons
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统缓存文件夹
|
||||
/// <summary>
|
||||
/// 系统缓存文件夹
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetCacheFolder()
|
||||
{
|
||||
string path = Path.Combine(GetLocalFileDirectory(), "Temp");
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
return path;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -34,7 +34,7 @@ namespace SWS.Electrical
|
||||
RibbonServices.CreateRibbonPaletteSet();
|
||||
|
||||
Start.RegisterTypes();
|
||||
|
||||
Start.AutoLogin();
|
||||
AddTab();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
@ -0,0 +1,28 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
namespace SWS.Electrical
|
||||
{
|
||||
public class ListBoxScrollToBottomBehavior : Behavior<ListBox>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
((INotifyCollectionChanged)AssociatedObject.Items).CollectionChanged += OnCollectionChanged;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
((INotifyCollectionChanged)AssociatedObject.Items).CollectionChanged -= OnCollectionChanged;
|
||||
}
|
||||
|
||||
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (AssociatedObject.HasItems)
|
||||
{
|
||||
AssociatedObject.ScrollIntoView(AssociatedObject.Items[AssociatedObject.Items.Count - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
87
newFront/c#前端/SWS.Electrical/Models/DtoAutoPlotLayout.cs
Normal file
87
newFront/c#前端/SWS.Electrical/Models/DtoAutoPlotLayout.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SWS.Model;
|
||||
using Telerik.Windows.Controls;
|
||||
|
||||
namespace SWS.Electrical.Models
|
||||
{
|
||||
public class DtoAutoPlotLayout : DtoDrawing
|
||||
{
|
||||
private string _AutoDrawing;
|
||||
/// <summary>
|
||||
/// 已绘制 未绘制
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string AutoDrawing
|
||||
{
|
||||
get { return _AutoDrawing; }
|
||||
set { _AutoDrawing = value; RaisePropertyChanged(nameof(AutoDrawing)); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工程数据ID
|
||||
/// </summary>
|
||||
public string EngineDataID { get; set; }
|
||||
/// <summary>
|
||||
/// 基点位号
|
||||
/// </summary>
|
||||
public string BasePointTagNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 比例
|
||||
/// </summary>
|
||||
public double Scale { get; set; }
|
||||
/// <summary>
|
||||
/// true:默认块,false:异性块
|
||||
/// </summary>
|
||||
public bool IsNotDefaultSymbol { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 元件位号
|
||||
/// </summary>
|
||||
public string TagNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// tag
|
||||
/// </summary>
|
||||
public string TagNumber_Upper { get; set; } = "";
|
||||
/// <summary>
|
||||
/// system
|
||||
/// </summary>
|
||||
public string TagNumber_Lower { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 图元文件Id
|
||||
/// </summary>
|
||||
public string FileId { get; set; }
|
||||
/// <summary>
|
||||
/// 基点在布置图上的句柄
|
||||
/// </summary>
|
||||
public string PixelOnDwg { get; set; }
|
||||
private string _TagPixelOnDwg;
|
||||
/// <summary>
|
||||
/// 元件在布置图上的句柄
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string TagPixelOnDwg
|
||||
{
|
||||
get { return _TagPixelOnDwg; }
|
||||
set { _TagPixelOnDwg = value; RaisePropertyChanged(nameof(TagPixelOnDwg)); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 肋位号 和 偏移量
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
public string XOff { get; set; }
|
||||
/// <summary>
|
||||
/// 纵骨号 偏移量
|
||||
/// </summary>
|
||||
public string YOff { get; set; }
|
||||
|
||||
public string deck { get; set; }
|
||||
public string area { get; set; }
|
||||
|
||||
public LayoutTagInfoBrief Tag { get; set; }
|
||||
}
|
||||
}
|
@ -27,22 +27,26 @@ namespace SWS.Electrical.Models
|
||||
/// 图纸文件名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Description("图纸名称")]
|
||||
[Description("图纸名称")]
|
||||
public string DrawingFileName
|
||||
{
|
||||
get { return _DrawingFileName; }
|
||||
set { _DrawingFileName = value; RaisePropertyChanged(nameof(DrawingFileName)); }
|
||||
}
|
||||
private bool _isChecked=false;
|
||||
private bool _IsSelected = false;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Description("选中")]
|
||||
public bool isChecked
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _isChecked; }
|
||||
set { _isChecked = value; RaisePropertyChanged(nameof(isChecked)); }
|
||||
get { return _IsSelected; }
|
||||
set
|
||||
{
|
||||
_IsSelected = value;
|
||||
RaisePropertyChanged(nameof(IsSelected));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands.cs" />
|
||||
<Compile Include="Control\ListBoxScrollToBottomBehavior.cs" />
|
||||
<Compile Include="GlobalObj.cs" />
|
||||
<Compile Include="Models\DtoAutoPlotLayout.cs" />
|
||||
<Compile Include="Models\DtoDrawing.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Start.cs" />
|
||||
|
@ -11,6 +11,14 @@ using Unity;
|
||||
using Prism.Ioc;
|
||||
using Prism.DryIoc;
|
||||
using DryIoc;
|
||||
using System.Threading.Tasks;
|
||||
using IniParser;
|
||||
using System.Net.Http;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using SWS.Model;
|
||||
namespace SWS.Electrical
|
||||
{
|
||||
public class Start
|
||||
@ -56,5 +64,59 @@ namespace SWS.Electrical
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalSelect, DialogSignalSelectViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogAutoArrangeLayout, DialogAutoArrangeLayoutViewModel>();
|
||||
}
|
||||
|
||||
public static void AutoLogin()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
FileIniDataParser configIni = new FileIniDataParser();
|
||||
var data = configIni.ReadFile(GlobalObject.configPath);
|
||||
string token = data["LoginInfo"]["LoginToken"];
|
||||
string loginkey = data["LoginInfo"]["LoginMark"];
|
||||
string curProjId = data["LoginInfo"]["CurProjId"];
|
||||
string address = data["Profile"]["strIPAddress"];
|
||||
string port = data["Profile"]["nPort"];
|
||||
string dbType = data["Profile"]["nConType"];
|
||||
if (dbType == "1")
|
||||
{
|
||||
string strDomain = data["Profile"]["strDomainName"];
|
||||
GlobalObject.client = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri($"{strDomain}/api/"),
|
||||
Timeout = TimeSpan.FromSeconds(120)
|
||||
};
|
||||
}
|
||||
else if (dbType == "0")
|
||||
{
|
||||
GlobalObject.client = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri($"http://{address}:{port}/api/"),
|
||||
Timeout = TimeSpan.FromSeconds(120)
|
||||
};
|
||||
}
|
||||
GlobalObject.client.DefaultRequestHeaders.Add("logintoken", token);
|
||||
GlobalObject.client.DefaultRequestHeaders.Add("loginkey", loginkey);
|
||||
var loginService = GlobalObject.container.Resolve<LoginService>();
|
||||
var flag = await loginService.ValidateLogin(token, loginkey);
|
||||
if (flag && GlobalObject.curProject == null)
|
||||
{
|
||||
//第一次要在后台初始化一些数据
|
||||
var projectService = GlobalObject.container.Resolve<ProjectService>();
|
||||
var listProjects = (await projectService.GetProjects(1, 1000)).Rows;
|
||||
var p = listProjects.FirstOrDefault(a => a.ProjectId == curProjId);
|
||||
GlobalObject.curProject = p;
|
||||
var obj = await projectService.InitProjInfo(curProjId, "");
|
||||
var treeData = obj.First(x => (string)x["Name"] == "图纸树(按目录)")["data"];
|
||||
GlobalObj.treeDrawings = JsonConvert.DeserializeObject<List<TreeModel>>(treeData.ToString());
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,14 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Media3D;
|
||||
using Bricscad.EditorInput;
|
||||
using Newtonsoft.Json;
|
||||
using Prism.Services.Dialogs;
|
||||
using SWS.CAD.Base;
|
||||
using SWS.Commons;
|
||||
@ -15,6 +21,8 @@ using SWS.Model;
|
||||
using SWS.Service;
|
||||
using SWS.WPF.ViewModels;
|
||||
using Teigha.DatabaseServices;
|
||||
using Teigha.Geometry;
|
||||
using Teigha.GraphicsSystem;
|
||||
using Telerik.Windows.Controls;
|
||||
using Unity;
|
||||
using Visibility = System.Windows.Visibility;
|
||||
@ -39,6 +47,61 @@ namespace SWS.Electrical.ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
private ObservableCollection<DtoAutoPlotLayout> _listBasePoint;
|
||||
/// <summary>
|
||||
/// 基点元件列表
|
||||
/// </summary>
|
||||
public ObservableCollection<DtoAutoPlotLayout> listBasePoint
|
||||
{
|
||||
get { return this._listBasePoint; }
|
||||
set
|
||||
{
|
||||
if (value != this._listBasePoint)
|
||||
{
|
||||
this._listBasePoint = value;
|
||||
RaisePropertyChanged(nameof(listBasePoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
private DtoAutoPlotLayout _SelectedTag;
|
||||
/// <summary>
|
||||
/// 基点元件
|
||||
/// </summary>
|
||||
public DtoAutoPlotLayout SelectedTag
|
||||
{
|
||||
get { return this._SelectedTag; }
|
||||
set
|
||||
{
|
||||
this._SelectedTag = value;
|
||||
RaisePropertyChanged(nameof(SelectedTag));
|
||||
}
|
||||
}
|
||||
private bool _IsSelectAll = false;
|
||||
public bool IsSelectAll
|
||||
{
|
||||
get { return _IsSelectAll; }
|
||||
set
|
||||
{
|
||||
_IsSelectAll = value;
|
||||
RaisePropertyChanged(nameof(IsSelectAll));
|
||||
}
|
||||
}
|
||||
private ObservableCollection<TextBlock> _listMsg;
|
||||
/// <summary>
|
||||
/// 信息列表
|
||||
/// </summary>
|
||||
public ObservableCollection<TextBlock> listMsg
|
||||
{
|
||||
get { return this._listMsg; }
|
||||
set
|
||||
{
|
||||
if (value != this._listMsg)
|
||||
{
|
||||
this._listMsg = value;
|
||||
RaisePropertyChanged(nameof(listMsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
private ObservableCollection<KeyValueModel> _listRange;
|
||||
/// <summary>
|
||||
/// 范围
|
||||
@ -118,40 +181,51 @@ namespace SWS.Electrical.ViewModels
|
||||
/// 命令事件
|
||||
/// </summary>
|
||||
public ICommand Command_StartDrawing { get; set; }
|
||||
public ICommand Command_GetBasePoint { get; set; }
|
||||
|
||||
public ICommand Command_SelectedTag { get; set; }
|
||||
|
||||
public ICommand Command_SelectedAll { get; set; }
|
||||
|
||||
PlotLayoutService _ServicePlotLayout;
|
||||
DrawingServce _ServiceDrawing;
|
||||
AnnexesService _ServiceAnnexes;
|
||||
LibraryFileService _ServiceLibraryFile;
|
||||
DrawingCatalogueService _ServiceDrawingCatalogue;
|
||||
EnginedataService _ServiceEnginedata;
|
||||
ObjectTypeService _ServiceObjectType;
|
||||
ProjectSettingsService _ServiceProjectSettings;
|
||||
List<string> listTagNumberSucc = new List<string>();
|
||||
private bool isSearch = false;//是否正在查询
|
||||
private bool isDrawing = false;//是否正在画图
|
||||
private string dwgName = string.Empty;
|
||||
private List<string> listLibraryTagName = new List<string>();//元件图纸上的位号属性名称,
|
||||
public DialogAutoArrangeLayoutViewModel()
|
||||
{
|
||||
Command_StartDrawing = new DelegateCommand(onStartDrawing);
|
||||
Command_GetBasePoint = new DelegateCommand(onGetBasePoint);
|
||||
Command_SelectedTag = new DelegateCommand(onSelectedTag);
|
||||
Command_SelectedAll = new DelegateCommand(onSelectedAll);
|
||||
title = "布置图自动绘制";
|
||||
_ServicePlotLayout = GlobalObject.container.Resolve<PlotLayoutService>();
|
||||
_ServiceDrawing = GlobalObject.container.Resolve<DrawingServce>();
|
||||
_ServiceAnnexes = GlobalObject.container.Resolve<AnnexesService>();
|
||||
_ServiceLibraryFile = GlobalObject.container.Resolve<LibraryFileService>();
|
||||
_ServiceDrawingCatalogue = GlobalObject.container.Resolve<DrawingCatalogueService>();
|
||||
_ServiceEnginedata = GlobalObject.container.Resolve<EnginedataService>();
|
||||
_ServiceObjectType = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||
_ServiceProjectSettings = GlobalObject.container.Resolve<ProjectSettingsService>();
|
||||
listDrawings = new ObservableCollection<DtoDrawing>();
|
||||
if (GlobalObj.treeDrawings.Any())
|
||||
{
|
||||
foreach (var model in GlobalObj.treeDrawings)
|
||||
{
|
||||
if (model.Text == "布置图")
|
||||
{
|
||||
foreach (var item in model.ChildNodes)
|
||||
{
|
||||
if (item.NodeType == "1")
|
||||
{
|
||||
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
listBasePoint = new ObservableCollection<DtoAutoPlotLayout>();
|
||||
listMsg = new ObservableCollection<TextBlock>();
|
||||
var list = new ObservableCollection<KeyValueModel>();
|
||||
list.Add(new KeyValueModel { Key = "甲板号", Value = "甲板号" });
|
||||
list.Add(new KeyValueModel { Key = "区域", Value = "区域" });
|
||||
list.Add(new KeyValueModel { Key = "系统", Value = "系统" });
|
||||
list.Add(new KeyValueModel { Key = "所属系统", Value = "所属系统" });
|
||||
listRange = new ObservableCollection<KeyValueModel>(list);
|
||||
selectRange = listRange[0];
|
||||
listOperator = new ObservableCollection<KeyValueModel>()
|
||||
{ new KeyValueModel { Key = "等于", Value = "等于" }
|
||||
{ new KeyValueModel { Key = "等于", Value = "=" }
|
||||
};
|
||||
selectOperator = listOperator[0];
|
||||
}
|
||||
@ -170,14 +244,12 @@ namespace SWS.Electrical.ViewModels
|
||||
|
||||
}
|
||||
|
||||
public void OnDialogOpened(IDialogParameters parameters)
|
||||
public async void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
Task.Factory.StartNew(() =>
|
||||
try
|
||||
{
|
||||
int i = 0;
|
||||
while (!listDrawings.Any())
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
if (GlobalObj.treeDrawings.Any())
|
||||
{
|
||||
foreach (var model in GlobalObj.treeDrawings)
|
||||
{
|
||||
if (model.Text == "布置图")
|
||||
@ -187,28 +259,431 @@ namespace SWS.Electrical.ViewModels
|
||||
if (item.NodeType == "1")
|
||||
{
|
||||
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
|
||||
ec_drawing_file dwgFile = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if(i>500)
|
||||
{ break; }
|
||||
}
|
||||
});
|
||||
if (!listDrawings.Any())
|
||||
{
|
||||
AddMsg($"布置图列表加载中...");
|
||||
var listDwg = await _ServiceDrawing.GetDrawingCatalogue();
|
||||
if (listDwg == null)
|
||||
{
|
||||
AddMsg($"布置图列表没有数据!");
|
||||
return;
|
||||
}
|
||||
foreach (var model in listDwg)
|
||||
{
|
||||
if (model.Text == "布置图")
|
||||
{
|
||||
if (model.ChildNodes == null)
|
||||
{
|
||||
AddMsg($"布置图列表没有数据!");
|
||||
continue;
|
||||
}
|
||||
foreach (var item in model.ChildNodes)
|
||||
{
|
||||
if (item.NodeType == "1")
|
||||
{
|
||||
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
|
||||
ec_drawing_file dwgFile = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AddMsg($"布置图列表加载完成!");
|
||||
|
||||
}
|
||||
var settingModel = await _ServiceProjectSettings.GetEntity("布置图图例显示位号名称");
|
||||
if (settingModel == null)
|
||||
{
|
||||
listLibraryTagName.Add("位号");//默认
|
||||
}
|
||||
else { listLibraryTagName = settingModel.SettingValue.Split(',').ToList(); }
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("DialogOpened异常:" + ex.Message);
|
||||
}
|
||||
//selectRange = listRange[2];
|
||||
//inputValue = "声力电话";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取基点信息
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public async void onGetBasePoint(object o)
|
||||
{
|
||||
if (isSearch)
|
||||
{
|
||||
MessageBox.Show("正在查询基点元件信息中...");
|
||||
return;
|
||||
}
|
||||
var listSelDwg = listDrawings.Where(a => a.IsSelected == true).ToList();
|
||||
if (!listSelDwg.Any())
|
||||
{
|
||||
AddMsg("请先选择布置图!");
|
||||
MessageBox.Show("请先选择布置图!");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
isSearch = true;
|
||||
AddMsg("开始查询布置图基点元件信息...");
|
||||
List<DtoAutoPlotLayout> listDto = new List<DtoAutoPlotLayout>();
|
||||
foreach (var dwg in listSelDwg)
|
||||
{
|
||||
var list = await _ServicePlotLayout.GetBasePointByDwg(selectRange.Value, selectOperator.Value, inputValue, dwg.DrawingFileID);
|
||||
if (list == null)
|
||||
{ continue; }
|
||||
foreach (var basePoint in list)
|
||||
{
|
||||
if (basePoint.Tags.Any())
|
||||
{
|
||||
foreach (var tag in basePoint.Tags)
|
||||
{
|
||||
listDto.Add(new DtoAutoPlotLayout()
|
||||
{
|
||||
IsSelected = true,
|
||||
DrawingFileID = dwg.DrawingFileID,
|
||||
DrawingFileName = dwg.DrawingFileName,
|
||||
EngineDataID = basePoint.EngineDataID,
|
||||
BasePointTagNumber = basePoint.TagNumber,
|
||||
Scale = basePoint.Scale,
|
||||
FileId = basePoint.FileId,
|
||||
PixelOnDwg = basePoint.PixelOnDwg,
|
||||
IsNotDefaultSymbol = basePoint.IsNotDefaultSymbol,
|
||||
X = basePoint.X,
|
||||
XOff = basePoint.XOff,
|
||||
YOff = basePoint.YOff,
|
||||
deck = basePoint.deck,
|
||||
area = basePoint.area,
|
||||
AutoDrawing = "未绘制",
|
||||
TagNumber = tag.TagNumber,
|
||||
TagNumber_Upper = basePoint.TagNumber_Upper,
|
||||
TagNumber_Lower = basePoint.TagNumber_Lower,
|
||||
Tag = tag
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
listBasePoint = new ObservableCollection<DtoAutoPlotLayout>(listDto);
|
||||
IsSelectAll = listBasePoint.Any() ? true : false;
|
||||
isSearch = false;
|
||||
AddMsg("布置图基点元件信息查询完成!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddMsg("基点元件信息查询异常:" + ex.Message);
|
||||
isSearch = false;
|
||||
}
|
||||
}
|
||||
public async void onStartDrawing(object o)
|
||||
{
|
||||
var listSelDwg = listDrawings.Where(a => a.isChecked == true).ToList();
|
||||
if (!listSelDwg.Any())
|
||||
if (isDrawing)
|
||||
{
|
||||
MessageBox.Show("请先选择布置图!");
|
||||
MessageBox.Show("正在自动绘制元件中,请勿操作...");
|
||||
return;
|
||||
}
|
||||
foreach (var item in listSelDwg)
|
||||
|
||||
var msg = string.Empty;
|
||||
var filePath = string.Empty;
|
||||
var listDto = listBasePoint.Where(a => a.IsSelected == true).ToList();
|
||||
if (!listDto.Any())
|
||||
{
|
||||
var list = await _ServicePlotLayout.GetBasePointByDwg(selectRange.Value, selectOperator.Value, inputValue, item.DrawingFileID);
|
||||
MessageBox.Show("请先勾选基点元件信息!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
isDrawing = true;
|
||||
listMsg.Clear();
|
||||
foreach (var basePoint in listDto)
|
||||
{
|
||||
if (basePoint.AutoDrawing == "已绘制")
|
||||
{
|
||||
AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{basePoint.TagNumber}]已绘制,跳至下一个元件");
|
||||
continue;
|
||||
}
|
||||
if (basePoint.AutoDrawing == "已存在")
|
||||
{
|
||||
AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{basePoint.TagNumber}]已存在,跳至下一个元件");
|
||||
continue;
|
||||
}
|
||||
|
||||
msg = await OpenDwg(basePoint.DrawingFileID);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
AddMsg($"图纸打开失败:{msg}", false);
|
||||
continue;
|
||||
}
|
||||
|
||||
AddMsg($"打开图纸:{basePoint.DrawingFileName} ");
|
||||
var listEntitys = General.GetAllEntity();//获取图纸所有实体
|
||||
var entity = listEntitys.FirstOrDefault(a => a.Handle.ToString() == basePoint.PixelOnDwg);
|
||||
if (entity == null)
|
||||
{
|
||||
AddMsg($"当前基点:{basePoint.BasePointTagNumber} 在图上找不到,不添加此元件,跳至下一个元件", false);
|
||||
continue;
|
||||
}
|
||||
|
||||
var tag = basePoint.Tag;
|
||||
if (string.IsNullOrEmpty(tag.FileId))
|
||||
{
|
||||
AddMsg($"当前元件:{tag.TagNumber} 的元件ID为空,不添加此元件,跳至下一个", false);
|
||||
continue;
|
||||
}
|
||||
var tagDto = listEntitys.FirstOrDefault(a => a.TagNumber == basePoint.TagNumber);
|
||||
if (tagDto != null)
|
||||
{
|
||||
AddMsg($"当前元件:{basePoint.TagNumber} 在图上已存在,句柄:{tagDto.Handle},不添加此元件,跳至下一个元件", false);
|
||||
basePoint.AutoDrawing = "已存在";
|
||||
basePoint.TagPixelOnDwg = tagDto.Handle;
|
||||
continue;
|
||||
}
|
||||
var flag = basePoint.deck == tag.deck && basePoint.area == tag.area;
|
||||
if (!flag)
|
||||
{
|
||||
AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{tag.TagNumber}] 的deck和area不一致,不添加此元件,跳至下一个元件", false);
|
||||
continue;
|
||||
}
|
||||
//下载元件图纸文件
|
||||
filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.TagNumber}.dwg");
|
||||
var obj = await _ServiceLibraryFile.GetEntity(tag.FileId);
|
||||
AddMsg($"元件图纸:{tag.TagNumber}, 开始下载...");
|
||||
msg = await _ServiceAnnexes.DownloadFile(filePath, obj.FolderId);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
AddMsg($"元件图纸下载失败,信息:" + msg, false);
|
||||
continue;
|
||||
}
|
||||
AddMsg($"元件图纸:{tag.TagNumber}, 下载成功");
|
||||
//filePath = "D:\\BricsCAD\\Temp\\测试11.dwg";
|
||||
//把元件的位号属性改成要绘制的位号值
|
||||
flag = General.UpdateCableNo(filePath, listLibraryTagName, tag.TagNumber, tag.IsNotDefaultSymbol, tag.TagNumber_Lower, tag.TagNumber_Upper);
|
||||
|
||||
//X轴:图上基点的坐标X +(接口数据元件的X + 接口数据元件的XOFF -接口数据基点的X-接口数据基点的Xoff)*比例系数
|
||||
//Y轴:图上基点的坐标Y +(接口数据元件的Yoff-接口数据基点的Yoff)*比例系数
|
||||
double scale = 1;//比例系数
|
||||
double x = entity.X + (tag.X + double.Parse(tag.XOff) - basePoint.X - double.Parse(basePoint.XOff)) * scale;
|
||||
double y = entity.Y + (double.Parse(tag.YOff) - double.Parse(basePoint.XOff)) * scale;
|
||||
double z = entity.Z;
|
||||
Point3d tagPoint = new Point3d(x, y, z);
|
||||
AddMsg($"元件图纸:{tag.TagNumber}, 开始添加进布置图中...");
|
||||
msg = await AddBlock(basePoint, obj.LibraryFileName, filePath, tagPoint);
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
{
|
||||
AddMsg($"布置图:{basePoint.DrawingFileName},成功插入元件:" + tag.TagNumber);
|
||||
basePoint.AutoDrawing = "已绘制";
|
||||
General.SetDrawingReadOnly(dwgName, false);
|
||||
}
|
||||
else { AddMsg($"元件:{tag.TagNumber},绘制异常:{msg}"); }
|
||||
|
||||
}
|
||||
AddMsg("操作已完成!");
|
||||
isDrawing = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("绘图异常:" + ex.Message);
|
||||
isDrawing = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 打开图纸
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<string> OpenDwg(string dwgId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string res = string.Empty;
|
||||
string fullpath = string.Empty;
|
||||
var dwgObj = await _ServiceDrawing.GetDrawingFile(dwgId);
|
||||
var cate = await _ServiceDrawingCatalogue.GetEntity(dwgObj.DrawingCatalogueID);
|
||||
if (cate.FullPath != cate.DrawingCatalogueID)
|
||||
{
|
||||
foreach (var id in cate.FullPath.Split(',').ToList())
|
||||
{
|
||||
cate = await _ServiceDrawingCatalogue.GetEntity(id);
|
||||
fullpath += $"{cate.DrawingCatalogueName}\\";
|
||||
}
|
||||
}
|
||||
else { fullpath = $"{cate.DrawingCatalogueName}\\"; }
|
||||
fullpath += dwgObj.DrawingFileName;
|
||||
fullpath = Path.Combine(GlobalObj.LocalWorkDir, GlobalObject.curProject.ProjectName, fullpath);
|
||||
if (!File.Exists(fullpath))
|
||||
{
|
||||
return dwgObj.DrawingFileName + ",图纸文件不存在,请先检出到本地!";
|
||||
}
|
||||
var listName = General.GetAllOpenDrawingNames();
|
||||
if (!listName.Contains(fullpath))
|
||||
{
|
||||
General.OpenDwg(fullpath);
|
||||
dwgName = fullpath;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
General.SwitchToDocument(fullpath);
|
||||
dwgName = fullpath;
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> AddBlock(DtoAutoPlotLayout basePoint, string tagName, string blockDwg, Point3d tagPoint)
|
||||
{
|
||||
try
|
||||
{
|
||||
string dwgId = basePoint.DrawingFileID;
|
||||
string enginedataId = basePoint.Tag.EngineDataID;
|
||||
string blockDwgId = basePoint.Tag.FileId;
|
||||
string tagNumber = basePoint.Tag.TagNumber;
|
||||
double scale = basePoint.Scale;
|
||||
string msg = string.Empty;
|
||||
string tagNum = string.Empty;
|
||||
var lsitEnginedata = await _ServiceObjectType.GetEngineDataListByTags(tagNumber);
|
||||
if (!lsitEnginedata.Any())
|
||||
{
|
||||
msg = $"元件位号:{tagNumber},属性未绑定,ServiceEnginedata.GetTagPixelsById({enginedataId})接口无数据";
|
||||
AddMsg(msg, false);
|
||||
return msg;
|
||||
}
|
||||
string objTypeId = lsitEnginedata[0].ObjectTypeID;
|
||||
string objTypeName = lsitEnginedata[0].ObjectTypeName;
|
||||
var objId = General.AddTagDWG(blockDwg, tagName, tagNumber, objTypeId, scale, tagPoint);
|
||||
#region 图纸上保存图元属性
|
||||
if (!objId.IsNull)
|
||||
{
|
||||
AddMsg($"元件已添加至图纸,句柄:{objId.Handle.ToString()}");
|
||||
AddMsg("开始关联元件属性至图纸...");
|
||||
var dwgLibrary = await _ServiceLibraryFile.GetEntity(blockDwgId);
|
||||
List<ec_enginedata_property> listPro = new List<ec_enginedata_property>();
|
||||
var handlid = objId.Handle.ToString();//添加图元返回的句柄
|
||||
ec_enginedata item = new ec_enginedata();
|
||||
item.TagNumber = tagNumber;
|
||||
item.ObjectTypeID = objTypeId;
|
||||
item.Layout_Block_File = dwgLibrary;
|
||||
//var result = await _ServiceObjectType.GetObjectTypePById(objTypeId);//添加属性
|
||||
var res = await _ServiceObjectType.GetTagInfosByTags(tagNumber);
|
||||
if (res.Any())
|
||||
{
|
||||
foreach (var dto in res[0].tags[0].EngineDataProperty)
|
||||
{
|
||||
listPro.Add(new ec_enginedata_property()
|
||||
{
|
||||
EngineDataPropertyID = dto.PropertyID,
|
||||
PropertyName = dto.PropertyName,
|
||||
PropertyNameEN = dto.PropertyNameEN,
|
||||
PropertyValue = dto.PropertyValue,
|
||||
MeasuringUnit = dto.MeasuringUnit,
|
||||
PropertyGID = dto.PropertyGID,
|
||||
PropertyGroupName = dto.PropertyGroupName
|
||||
});
|
||||
}
|
||||
}
|
||||
item.EngineDataProperty = listPro;
|
||||
List<ec_enginedata_pixel> listPixel = new List<ec_enginedata_pixel>();
|
||||
var pixelDto = new ec_enginedata_pixel()
|
||||
{
|
||||
TagNumber = tagNumber,
|
||||
DrawingFileID = dwgId,
|
||||
LibraryFileID = dwgLibrary.LibraryFileID,
|
||||
PixelCode = handlid,
|
||||
ObjectTypeID = objTypeId,
|
||||
ObjectTypeName = objTypeName,
|
||||
EngineDataProperty = listPro
|
||||
};
|
||||
listPixel.Add(pixelDto);
|
||||
item.EngineDataPixel = listPixel;
|
||||
|
||||
msg = await _ServiceObjectType.UpdatePixelAndProp(item);
|
||||
if (msg != string.Empty)
|
||||
{
|
||||
msg = "保存元件属性至图纸异常:" + msg;
|
||||
AddMsg(msg, false);
|
||||
return msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
basePoint.TagPixelOnDwg = handlid;
|
||||
AddMsg("添加元件属性至图纸成功!");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"元件:{blockDwg} ,添加失败";
|
||||
AddMsg(msg, false);
|
||||
return msg;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
public void onSelectedTag(object o)
|
||||
{
|
||||
var dto = listBasePoint.Where(p => p.TagNumber == o.ToString()).FirstOrDefault();
|
||||
if (dto != null)
|
||||
{
|
||||
if (!dto.IsSelected && IsSelectAll)
|
||||
{
|
||||
IsSelectAll = false;
|
||||
}
|
||||
else if (dto.IsSelected && !IsSelectAll)
|
||||
{
|
||||
foreach (var item in listBasePoint)
|
||||
{
|
||||
if (!item.IsSelected) return;
|
||||
}
|
||||
IsSelectAll = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onSelectedAll(object o)
|
||||
{
|
||||
foreach (var item in listBasePoint)
|
||||
{
|
||||
item.IsSelected = IsSelectAll;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加提示信息
|
||||
/// </summary>
|
||||
/// <param name="msg">信息</param>
|
||||
/// <param name="isSucc">是否成功</param>
|
||||
private void AddMsg(string msg, bool isSucc = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
tb.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "==>> " + msg;
|
||||
tb.Foreground = isSucc ? Brushes.LightSeaGreen : Brushes.Red;
|
||||
listMsg.Add(tb);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("添加提示信息异常:" + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,16 @@
|
||||
x:Class="SWS.Electrical.Views.DialogAutoArrangeLayout"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Custom="http://www.galasoft.ch/mvvmlight"
|
||||
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SWS.Electrical.Views"
|
||||
xmlns:local="clr-namespace:SWS.Electrical"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||
Width="500"
|
||||
Height="400"
|
||||
Width="750"
|
||||
Height="590"
|
||||
mc:Ignorable="d">
|
||||
<prism:Dialog.WindowStyle>
|
||||
<Style TargetType="Window">
|
||||
@ -23,51 +24,130 @@
|
||||
<Setter Property="Visibility" Value="{Binding isShow}" />
|
||||
</Style>
|
||||
</prism:Dialog.WindowStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="DataGrid">
|
||||
<Setter Property="RowHeaderWidth" Value="0" />
|
||||
<Setter Property="AutoGenerateColumns" Value="False" />
|
||||
<Setter Property="CanUserAddRows" Value="False" />
|
||||
<Setter Property="CanUserResizeColumns" Value="False" />
|
||||
<Setter Property="CanUserResizeRows" Value="False" />
|
||||
<Setter Property="HorizontalGridLinesBrush" Value="LightGray" />
|
||||
<Setter Property="VerticalGridLinesBrush" Value="LightGray" />
|
||||
<Setter Property="IsReadOnly" Value="False" />
|
||||
<Setter Property="BorderThickness" Value="1,0" />
|
||||
<Setter Property="BorderBrush" Value="LightGray" />
|
||||
<Setter Property="RowHeight" Value="30" />
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid表头样式 -->
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderThickness" Value="1,1,1,1" />
|
||||
<Setter Property="BorderBrush" Value="LightGray" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid复选框样式 -->
|
||||
<Style x:Key="VerticalCheckBox" TargetType="CheckBox">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type CheckBox}">
|
||||
<StackPanel Name="sp" HorizontalAlignment="Center">
|
||||
<ContentPresenter Margin="2" HorizontalAlignment="Center" />
|
||||
<Border
|
||||
x:Name="bd"
|
||||
Width="20"
|
||||
Height="20"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1.5">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0.05" Color="LightGray" />
|
||||
<GradientStop Offset="1" Color="White" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Path
|
||||
Name="checkPath"
|
||||
Width="18"
|
||||
Height="16"
|
||||
Stroke="Black"
|
||||
StrokeThickness="2" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="checkPath" Property="Data" Value="M 1.5,5 L 7,13 17,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bd" Property="Background" Value="LightGray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid单元格选中样式 #6495ED -->
|
||||
<Style TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="#6495ED" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="350" />
|
||||
<RowDefinition Height="220" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*" />
|
||||
<ColumnDefinition Width="0.6*" />
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<CustomControl:customWindowTitleBar
|
||||
x:Name="titleBar"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2" />
|
||||
<telerik:RadGridView
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
MaxHeight="360"
|
||||
telerik:StyleManager.Theme="Office_Blue"
|
||||
MaxHeight="350"
|
||||
AutoGenerateColumns="False"
|
||||
IsFilteringAllowed="False"
|
||||
IsReadOnly="False"
|
||||
CanUserAddRows="False"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding listDrawings, Mode=TwoWay}"
|
||||
RowIndicatorVisibility="Collapsed"
|
||||
ScrollMode="RealTime"
|
||||
SelectionMode="Single"
|
||||
ShowGroupPanel="False">
|
||||
<telerik:RadGridView.Columns>
|
||||
<telerik:GridViewCheckBoxColumn
|
||||
RowHeight="22"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn
|
||||
Width="30"
|
||||
DataMemberBinding="{Binding isChecked}"
|
||||
Binding="{Binding IsSelected}"
|
||||
Header=""
|
||||
IsVisible="True" />
|
||||
<telerik:GridViewDataColumn
|
||||
IsReadOnly="False" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
DataMemberBinding="{Binding DrawingFileName}"
|
||||
Binding="{Binding DrawingFileName}"
|
||||
Header="布置图"
|
||||
IsFilteringDeferred="True" />
|
||||
</telerik:RadGridView.Columns>
|
||||
</telerik:RadGridView>
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
@ -78,53 +158,37 @@
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="auto"
|
||||
FontSize="18"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="范围:" />
|
||||
<telerik:RadComboBox
|
||||
<ComboBox
|
||||
Grid.Column="1"
|
||||
Width="160"
|
||||
Width="100"
|
||||
Height="25"
|
||||
DisplayMemberPath="Key"
|
||||
FontSize="16"
|
||||
ItemsSource="{Binding listRange}"
|
||||
SelectedItem="{Binding selectRange, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Height="30"
|
||||
Margin="30,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="auto"
|
||||
FontSize="18"
|
||||
Text="判断:" />
|
||||
<telerik:RadComboBox
|
||||
<ComboBox
|
||||
Grid.Column="1"
|
||||
Width="160"
|
||||
Width="60"
|
||||
Height="25"
|
||||
Margin="5,0,0,0"
|
||||
DisplayMemberPath="Key"
|
||||
FontSize="16"
|
||||
ItemsSource="{Binding listOperator}"
|
||||
SelectedItem="{Binding selectOperator, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Height="30"
|
||||
Margin="30,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="auto"
|
||||
FontSize="18"
|
||||
Text=" 值:" />
|
||||
|
||||
<TextBox
|
||||
Width="170"
|
||||
FontSize="18"
|
||||
Width="200"
|
||||
Height="25"
|
||||
Margin="5,0,0,0"
|
||||
FontSize="16"
|
||||
Text="{Binding inputValue}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="3"
|
||||
Grid.Row="1"
|
||||
Height="30"
|
||||
Margin="30,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
@ -133,10 +197,125 @@
|
||||
<Button
|
||||
Width="140"
|
||||
Margin="60,0,0,0"
|
||||
Command="{Binding Command_GetBasePoint}"
|
||||
Content="获取元件信息"
|
||||
FontSize="16" />
|
||||
<Button
|
||||
Width="140"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding Command_StartDrawing}"
|
||||
Content="开始自动绘图"
|
||||
FontSize="18" />
|
||||
FontSize="16" />
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
x:Name="dgTag"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
MaxHeight="250"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserResizeColumns="True"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding listBasePoint, Mode=TwoWay}"
|
||||
RowHeight="22"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridCheckBoxColumn Binding="{Binding IsSelected, Mode=TwoWay}">
|
||||
<DataGridCheckBoxColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckbSelectedAll"
|
||||
Margin="4"
|
||||
Click="CheckAll_Click"
|
||||
IsChecked="{Binding DataContext.IsSelectAll, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" />
|
||||
</DataTemplate>
|
||||
</DataGridCheckBoxColumn.HeaderTemplate>
|
||||
</DataGridCheckBoxColumn>-->
|
||||
<DataGridTemplateColumn Width="30">
|
||||
<DataGridTemplateColumn.Header>
|
||||
<CheckBox IsChecked="{Binding DataContext.IsSelectAll, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedAll, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</CheckBox>
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedTag, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" CommandParameter="{Binding TagNumber}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</CheckBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--<DataGridCheckBoxColumn
|
||||
Width="30"
|
||||
Binding="{Binding isChecked}"
|
||||
Header=""
|
||||
IsReadOnly="False" />-->
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding DrawingFileName}"
|
||||
Header="布置图"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding BasePointTagNumber}"
|
||||
Header="基点"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="110"
|
||||
Binding="{Binding TagNumber}"
|
||||
Header="元件位号"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="60"
|
||||
Binding="{Binding AutoDrawing}"
|
||||
Header="绘制"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="50"
|
||||
Binding="{Binding TagPixelOnDwg}"
|
||||
Header="句柄"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding AutoDrawing}" Value="已绘制">
|
||||
<Setter Property="Background" Value="LightGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding AutoDrawing}" Value="已存在">
|
||||
<Setter Property="Background" Value="LightYellow" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Black">
|
||||
<ListBox
|
||||
Background="Black"
|
||||
ItemsSource="{Binding listMsg}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<i:Interaction.Behaviors>
|
||||
<local:ListBoxScrollToBottomBehavior />
|
||||
</i:Interaction.Behaviors>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7F38C9A2389C976AE983ACB22E5576B9CD55BCF4552B5A04C39704286EDC915E"
|
||||
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8006F31A06196293D0E58F4239B97FC4F768BCF414C1B4C2472A1C22D26CF0B1"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
@ -23,7 +23,7 @@ using Prism.Regions.Behaviors;
|
||||
using Prism.Services.Dialogs;
|
||||
using Prism.Unity;
|
||||
using SWS.CustomControl;
|
||||
using SWS.Electrical.Views;
|
||||
using SWS.Electrical;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
@ -77,13 +77,21 @@ namespace SWS.Electrical.Views {
|
||||
public partial class DialogAutoArrangeLayout : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
|
||||
|
||||
|
||||
#line 36 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
#line 119 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal SWS.CustomControl.customWindowTitleBar titleBar;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 211 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.DataGrid dgTag;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
private bool _contentLoaded;
|
||||
|
||||
/// <summary>
|
||||
@ -117,6 +125,9 @@ namespace SWS.Electrical.Views {
|
||||
case 1:
|
||||
this.titleBar = ((SWS.CustomControl.customWindowTitleBar)(target));
|
||||
return;
|
||||
case 2:
|
||||
this.dgTag = ((System.Windows.Controls.DataGrid)(target));
|
||||
return;
|
||||
}
|
||||
this._contentLoaded = true;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7F38C9A2389C976AE983ACB22E5576B9CD55BCF4552B5A04C39704286EDC915E"
|
||||
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8006F31A06196293D0E58F4239B97FC4F768BCF414C1B4C2472A1C22D26CF0B1"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
@ -23,7 +23,7 @@ using Prism.Regions.Behaviors;
|
||||
using Prism.Services.Dialogs;
|
||||
using Prism.Unity;
|
||||
using SWS.CustomControl;
|
||||
using SWS.Electrical.Views;
|
||||
using SWS.Electrical;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
@ -77,13 +77,21 @@ namespace SWS.Electrical.Views {
|
||||
public partial class DialogAutoArrangeLayout : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
|
||||
|
||||
|
||||
#line 36 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
#line 119 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal SWS.CustomControl.customWindowTitleBar titleBar;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 211 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.DataGrid dgTag;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
private bool _contentLoaded;
|
||||
|
||||
/// <summary>
|
||||
@ -117,6 +125,9 @@ namespace SWS.Electrical.Views {
|
||||
case 1:
|
||||
this.titleBar = ((SWS.CustomControl.customWindowTitleBar)(target));
|
||||
return;
|
||||
case 2:
|
||||
this.dgTag = ((System.Windows.Controls.DataGrid)(target));
|
||||
return;
|
||||
}
|
||||
this._contentLoaded = true;
|
||||
}
|
||||
|
@ -19,7 +19,16 @@ namespace SWS.Model
|
||||
/// <summary>
|
||||
/// 位号
|
||||
/// </summary>
|
||||
public string TagNumber { get; set; } = "";
|
||||
public string TagNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// tag
|
||||
/// </summary>
|
||||
public string TagNumber_Upper { get; set; } = "";
|
||||
/// <summary>
|
||||
/// system
|
||||
/// </summary>
|
||||
public string TagNumber_Lower { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 图元文件Id
|
||||
/// </summary>
|
||||
@ -29,6 +38,14 @@ namespace SWS.Model
|
||||
/// </summary>
|
||||
public string PixelOnDwg { get; set; }
|
||||
/// <summary>
|
||||
/// 比例
|
||||
/// </summary>
|
||||
public double Scale { get; set; }
|
||||
/// <summary>
|
||||
/// true:默认块,false:异性块
|
||||
/// </summary>
|
||||
public bool IsNotDefaultSymbol { get; set; }
|
||||
/// <summary>
|
||||
/// 肋位号 和 偏移量
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
|
@ -95,6 +95,7 @@
|
||||
<Compile Include="ec_operate_log.cs" />
|
||||
<Compile Include="ec_parallel_Cable.cs" />
|
||||
<Compile Include="ec_project.cs" />
|
||||
<Compile Include="ec_projectSettings.cs" />
|
||||
<Compile Include="ec_property.cs" />
|
||||
<Compile Include="ec_template_file.cs" />
|
||||
<Compile Include="ec_Wire_Group.cs" />
|
||||
|
30
newFront/c#前端/SWS.Model/ec_projectSettings.cs
Normal file
30
newFront/c#前端/SWS.Model/ec_projectSettings.cs
Normal file
@ -0,0 +1,30 @@
|
||||
namespace SWS.Model
|
||||
{
|
||||
public class ec_projectSettings
|
||||
{
|
||||
#region 实体成员
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public string SettingID { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 选项名字
|
||||
/// </summary>
|
||||
public string SettingName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 选项值
|
||||
/// </summary>
|
||||
public string SettingValue { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 选项组
|
||||
/// </summary>
|
||||
public string SettingGroup { get; set; } = "";
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -205,5 +205,22 @@ namespace SWS.Service
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取位号的工程属性(根据一堆位号)
|
||||
/// </summary>
|
||||
/// <param name="tagNumber">位号集合(用,连接)</param>
|
||||
public async Task<List<ec_enginedata>> GetEngineDataListByTags(string tagNumber)
|
||||
{
|
||||
|
||||
var res = await this.GetAsync<List<ec_enginedata>>($"ObjectTypeApi/GetEngineDataListByTags?projectId={GlobalObject.curProject.ProjectId}&tagNumber={tagNumber}");
|
||||
if (res.code == 200)
|
||||
{
|
||||
return res.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
43
newFront/c#前端/SWS.Service/ProjectSettingsService.cs
Normal file
43
newFront/c#前端/SWS.Service/ProjectSettingsService.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SWS.Commons;
|
||||
using SWS.Model;
|
||||
|
||||
namespace SWS.Service
|
||||
{
|
||||
public class ProjectSettingsService : HttpService
|
||||
{
|
||||
public ProjectSettingsService() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<ec_projectSettings>> GetList()
|
||||
{
|
||||
|
||||
var res = await this.GetAsync<List<ec_projectSettings>>($"SettingsApi/GetList?projId={GlobalObject.curProject.ProjectId}");
|
||||
if (res.code == 200)
|
||||
{
|
||||
return res.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public async Task<ec_projectSettings> GetEntity(string settingName)
|
||||
{
|
||||
|
||||
var res = await this.GetAsync<ec_projectSettings>($"SettingsApi/GetEntity?settingName={settingName}&projId={GlobalObject.curProject.ProjectId}");
|
||||
if (res.code == 200)
|
||||
{
|
||||
return res.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -65,6 +65,7 @@
|
||||
<Compile Include="LibraryFileService.cs" />
|
||||
<Compile Include="PlotLayoutService.cs" />
|
||||
<Compile Include="ProjectService.cs" />
|
||||
<Compile Include="ProjectSettingsService.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TemplateFileService.cs" />
|
||||
<Compile Include="UserService.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user