布置图输入值改成可输入的下拉框,ini操作异常修改,布置图加载修改

This commit is contained in:
chenjinbu 2025-09-10 10:57:20 +08:00
parent 93967b9e1d
commit 4eddfe1f59
25 changed files with 286 additions and 1309 deletions

View File

@ -69,9 +69,9 @@ namespace DI_Electrical.ViewModels
MessageBox.Show("本地文件目录不存在。"); MessageBox.Show("本地文件目录不存在。");
return; return;
} }
var data = _configService.parser.ReadFile(_configService.path); //var data = _configService.parser.ReadFile(_configService.path);
_configService._httpService.Init(address, port); //_configService._httpService.Init(address, port);
IsBusy = true; IsBusy = true;
BusyContent = "保存中..."; BusyContent = "保存中...";
var testRes = await _LoginService.Login("1", "11"); var testRes = await _LoginService.Login("1", "11");
@ -85,10 +85,17 @@ namespace DI_Electrical.ViewModels
{ {
address = address.Replace("https://", "").Replace("http://", ""); address = address.Replace("https://", "").Replace("http://", "");
} }
data["Profile"]["Address"] = address; //data["Profile"]["Address"] = address;
data["Profile"]["Port"] = port.ToString(); //data["Profile"]["Port"] = port.ToString();
data["Profile"]["Directory"] = _directory; //data["Profile"]["Directory"] = _directory;
_configService.parser.WriteFile(_configService.path, data); //_configService.parser.WriteFile(_configService.path, data);
//IniHelper.WriteValueFromIniFile("Profile", "strIPAddress", address);
//IniHelper.WriteValueFromIniFile("Profile", "nPort", port.ToString());
//IniHelper.WriteValueFromIniFile("Profile", "strLocalWorkDir", _directory);
_configService.Save("Profile", "strIPAddress", address);
_configService.Save("Profile", "nPort", port.ToString());
_configService.Save("Profile", "strLocalWorkDir", _directory);
GlobalObject.isConfigIniCreateBySys = false; GlobalObject.isConfigIniCreateBySys = false;
GlobalObject.SetLocalFileDirectory(_directory); GlobalObject.SetLocalFileDirectory(_directory);

View File

@ -72,9 +72,9 @@ namespace DI_Electrical.ViewModels
Command_Config = new DelegateCommand(onConfig); Command_Config = new DelegateCommand(onConfig);
containerProvider = container; containerProvider = container;
if (GlobalObject.isConfigIniCreateBySys) if (GlobalObject.isConfigIniCreateBySys)
{ {
var config= container.Resolve<Config>(); var config = container.Resolve<Config>();
config.ShowDialog(); config.ShowDialog();
} }
UserName = _configService.Read(nameof(ConfigIni.UserName)); UserName = _configService.Read(nameof(ConfigIni.UserName));
@ -91,14 +91,14 @@ namespace DI_Electrical.ViewModels
{ {
sPASSWORD = GlobalObject.userInfo.userPs; sPASSWORD = GlobalObject.userInfo.userPs;
} }
curServer = "当前服务器: " + _configService.Read(nameof(ConfigIni.Address)) + ":" + _configService.Read(nameof(ConfigIni.Port)); curServer = "当前服务器: " + _configService.Read("strIPAddress") + ":" + _configService.Read("nPort");
} }
public void onConfig(object o) public void onConfig(object o)
{ {
var config = containerProvider.Resolve<Config>(); var config = containerProvider.Resolve<Config>();
config.ShowDialog(); config.ShowDialog();
curServer = "当前服务器: " + _configService.Read(nameof(ConfigIni.Address)) + ":" + _configService.Read(nameof(ConfigIni.Port)); curServer = "当前服务器: " + _configService.Read("strIPAddress") + ":" + _configService.Read("nPort");
} }
public override async void ExecuteOKCommandAsync(object obj) public override async void ExecuteOKCommandAsync(object obj)
@ -116,7 +116,7 @@ namespace DI_Electrical.ViewModels
else else
{ {
IsBusy = true; BusyContent = "登录中..."; IsBusy = true; BusyContent = "登录中...";
var res = await _Service.Login(UserName, Userpass); var res = await _Service.Login(UserName, Userpass);
IsBusy = false; IsBusy = false;
if (string.IsNullOrEmpty(res)) if (string.IsNullOrEmpty(res))
{ {

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,6 @@
<StartProgram>D:\Program Files\KunHeng\KunHengCAD V21 zh_CN\kunhengcad.exe</StartProgram> <StartProgram>D:\Program Files\KunHeng\KunHengCAD V21 zh_CN\kunhengcad.exe</StartProgram>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ProjectFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -70,7 +70,6 @@ namespace SWS.CAD.ViewModels
Application.ShowAlertDialog("本地文件目录不存在。"); Application.ShowAlertDialog("本地文件目录不存在。");
return; return;
} }
var data = _configService.parser.ReadFile(_configService.path);
_configService._httpService.Init(address, port); _configService._httpService.Init(address, port);
IsBusy = true; IsBusy = true;
@ -85,10 +84,14 @@ namespace SWS.CAD.ViewModels
{ {
address = address.Replace("https://", "").Replace("http://", ""); address = address.Replace("https://", "").Replace("http://", "");
} }
data["Profile"]["Address"] = address; //var data = _configService.parser.ReadFile(_configService.path);
data["Profile"]["Port"] = port.ToString(); //data["Profile"]["Address"] = address;
data["Profile"]["Directory"] = _directory; //data["Profile"]["Port"] = port.ToString();
_configService.parser.WriteFile(_configService.path, data); //data["Profile"]["Directory"] = _directory;
//_configService.parser.WriteFile(_configService.path, data);
_configService.Save("Profile", "strIPAddress", address);
_configService.Save("Profile", "nPort", port.ToString());
_configService.Save("Profile", "strLocalWorkDir", _directory);
GlobalObject.isConfigIniCreateBySys = false; GlobalObject.isConfigIniCreateBySys = false;
GlobalObject.SetLocalFileDirectory(_directory); GlobalObject.SetLocalFileDirectory(_directory);

View File

@ -92,7 +92,7 @@ namespace SWS.CAD.ViewModels
{ {
sPASSWORD = GlobalObject.userInfo.userPs; sPASSWORD = GlobalObject.userInfo.userPs;
} }
curServer = "当前服务器: " + _configService.Read(nameof(ConfigIni.Address)) + ":" + _configService.Read(nameof(ConfigIni.Port)); curServer = "当前服务器: " + _configService.Read("strIPAddress") + ":" + _configService.Read("nPort");
} }
public override async void ExecuteOKCommandAsync(object obj) public override async void ExecuteOKCommandAsync(object obj)
{ {

View File

@ -1455,10 +1455,9 @@
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<!-- 按钮禁用 --> <!-- 按钮禁用 -->
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter TargetName="PART_Icon" Property="Fill" <Setter TargetName="PART_Icon" Property="Fill" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" /> <Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" />

View File

@ -154,10 +154,11 @@ namespace SWS.Commons
{ {
if (string.IsNullOrEmpty(_LocalFileDirectory)) if (string.IsNullOrEmpty(_LocalFileDirectory))
{ {
string path = configPath; //string path = configPath;
FileIniDataParser parser = new FileIniDataParser(); //FileIniDataParser parser = new FileIniDataParser();
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
_LocalFileDirectory = data["Profile"]["strLocalWorkDir"]; //_LocalFileDirectory = data["Profile"]["strLocalWorkDir"];
_LocalFileDirectory = IniHelper.ReadValueFromIniFile("Profile", "strLocalWorkDir");
return _LocalFileDirectory; return _LocalFileDirectory;
} }
else else

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Commons
{
public static class IniHelper
{
[DllImport("kernel32", CharSet = CharSet.Unicode)]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32", CharSet = CharSet.Unicode)]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
/// <summary>
///读取ini文件数据
/// </summary>
/// <param name="Section">段</param>
/// <param name="Key">键名</param>
/// <param name="def">默认值</param>
/// <param name="filePath">文件路径</param>
/// <returns>读出内容</returns>
public static string ReadValueFromIniFile(string Section, string Key, string def=null, string filePath= null)
{
if (def == null)
{ def = ""; }
if (filePath == null)
{
filePath = GlobalObject.configPath;
}
StringBuilder temp = new StringBuilder(4096);
int i = GetPrivateProfileString(Section, Key, def, temp, 4096, filePath);
return temp.ToString();
}
/// <summary>
/// 写入数据到ini文件
/// </summary>
/// <param name="Section">段</param>
/// <param name="Key">键名</param>
/// <param name="Value">键值</param>
/// <param name="filePath">文件路径</param>
public static void WriteValueFromIniFile(string Section, string Key, string Value, string filePath = null)
{
if (filePath == null)
{
filePath = GlobalObject.configPath;
}
WritePrivateProfileString(Section, Key, Value, filePath);
}
}
}

View File

@ -24,6 +24,8 @@ namespace SWS.Commons
string dllPath = codeBase.Replace("file:///", ""); string dllPath = codeBase.Replace("file:///", "");
dllPath = Path.GetDirectoryName(dllPath); dllPath = Path.GetDirectoryName(dllPath);
logPath = Path.Combine(dllPath, "Logs\\"); logPath = Path.Combine(dllPath, "Logs\\");
if (!Directory.Exists(logPath))
{ Directory.CreateDirectory(logPath); }
var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config")); var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config"));
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile); log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile);
} }

View File

@ -110,6 +110,7 @@
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" /> <Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
<Compile Include="Helper\Converter\ColumnValueConverter.cs" /> <Compile Include="Helper\Converter\ColumnValueConverter.cs" />
<Compile Include="Helper\Converter\StatusToColourConverter.cs" /> <Compile Include="Helper\Converter\StatusToColourConverter.cs" />
<Compile Include="Helper\IniHelper.cs" />
<Compile Include="Helper\FileHelper.cs" /> <Compile Include="Helper\FileHelper.cs" />
<Compile Include="Helper\LoggerHelper.cs" /> <Compile Include="Helper\LoggerHelper.cs" />
<Compile Include="Helper\PasswordHelper.cs" /> <Compile Include="Helper\PasswordHelper.cs" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ProjectFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
@ -11,6 +12,7 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using IniParser; using IniParser;
using IniParser.Model;
using Newtonsoft.Json; using Newtonsoft.Json;
using Prism.Ioc; using Prism.Ioc;
using SWS.Commons; using SWS.Commons;
@ -41,17 +43,29 @@ namespace SWS.Electrical
{ {
try try
{ {
var data = configIni.ReadFile(GlobalObject.configPath); //var parser = new FileIniDataParser();
string token = data["LoginInfo"]["LoginToken"]; //string[] lines = File.ReadAllLines(GlobalObject.configPath);
string loginkey = data["LoginInfo"]["LoginMark"]; //IniData data = parser.Parser.Parse(File.ReadAllText(GlobalObject.configPath));
string curProjId = data["LoginInfo"]["CurProjId"]; //var data = configIni.ReadFile(GlobalObject.configPath);
LocalWorkDir= data["Profile"]["strLocalWorkDir"]; //string token = data["LoginInfo"]["LoginToken"];
string address = data["Profile"]["strIPAddress"]; //string loginkey = data["LoginInfo"]["LoginMark"];
string port = data["Profile"]["nPort"]; //string curProjId = data["LoginInfo"]["CurProjId"];
string dbType = data["Profile"]["nConType"]; //LocalWorkDir= data["Profile"]["strLocalWorkDir"];
//string address = data["Profile"]["strIPAddress"];
//string port = data["Profile"]["nPort"];
//string dbType = data["Profile"]["nConType"];
//string domain= data["Profile"]["strDomainName"];
string token = IniHelper.ReadValueFromIniFile("LoginInfo", "LoginToken");
string loginkey = IniHelper.ReadValueFromIniFile("LoginInfo", "LoginMark");
string curProjId = IniHelper.ReadValueFromIniFile("LoginInfo", "CurProjId");
LocalWorkDir = IniHelper.ReadValueFromIniFile("Profile", "strLocalWorkDir");
string address = IniHelper.ReadValueFromIniFile("Profile", "strIPAddress");
string port = IniHelper.ReadValueFromIniFile("Profile", "nPort");
string dbType = IniHelper.ReadValueFromIniFile("Profile", "nConType");
string domain = IniHelper.ReadValueFromIniFile("Profile", "strDomainName");
if (dbType == "1") if (dbType == "1")
{ {
string strDomain = data["Profile"]["strDomainName"]; string strDomain = domain;
GlobalObject.client = new HttpClient() GlobalObject.client = new HttpClient()
{ {
BaseAddress = new Uri($"{strDomain}/api/"), BaseAddress = new Uri($"{strDomain}/api/"),

View File

@ -153,6 +153,7 @@
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="配置说明.docx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SWS.CAD.Base\SWS.CAD.Base.csproj"> <ProjectReference Include="..\SWS.CAD.Base\SWS.CAD.Base.csproj">

View File

@ -130,6 +130,7 @@ namespace SWS.Electrical.ViewModels
if (value != this._selectRange) if (value != this._selectRange)
{ {
this._selectRange = value; this._selectRange = value;
RangeChange(value);
RaisePropertyChanged(nameof(selectRange)); RaisePropertyChanged(nameof(selectRange));
} }
} }
@ -167,6 +168,22 @@ namespace SWS.Electrical.ViewModels
} }
} }
} }
private ObservableCollection<KeyValueModel> _listValue;
/// <summary>
/// 输入值 列表
/// </summary>
public ObservableCollection<KeyValueModel> listValue
{
get { return this._listValue; }
set
{
if (value != this._listValue)
{
this._listValue = value;
RaisePropertyChanged(nameof(listValue));
}
}
}
private string _inputValue = ""; private string _inputValue = "";
/// <summary> /// <summary>
/// 输入值 /// 输入值
@ -195,11 +212,15 @@ namespace SWS.Electrical.ViewModels
EnginedataService _ServiceEnginedata; EnginedataService _ServiceEnginedata;
ObjectTypeService _ServiceObjectType; ObjectTypeService _ServiceObjectType;
ProjectSettingsService _ServiceProjectSettings; ProjectSettingsService _ServiceProjectSettings;
DataItemService _ServiceDataItem;
List<string> listTagNumberSucc = new List<string>(); List<string> listTagNumberSucc = new List<string>();
private bool isSearch = false;//是否正在查询 private bool isSearch = false;//是否正在查询
private bool isDrawing = false;//是否正在画图 private bool isDrawing = false;//是否正在画图
private string dwgName = string.Empty; private string dwgName = string.Empty;
private List<string> listLibraryTagName = new List<string>();//元件图纸上的位号属性名称, private List<string> listLibraryTagName = new List<string>();//元件图纸上的位号属性名称,
private List<KeyValueModel> listDeck=new List<KeyValueModel>();//甲板号值列表
private List<KeyValueModel> listArea = new List<KeyValueModel>();//区域值列表
private List<KeyValueModel> listSystem = new List<KeyValueModel>();//所属系统值列表
public DialogAutoArrangeLayoutViewModel() public DialogAutoArrangeLayoutViewModel()
{ {
Command_StartDrawing = new DelegateCommand(onStartDrawing); Command_StartDrawing = new DelegateCommand(onStartDrawing);
@ -215,6 +236,7 @@ namespace SWS.Electrical.ViewModels
_ServiceEnginedata = GlobalObject.container.Resolve<EnginedataService>(); _ServiceEnginedata = GlobalObject.container.Resolve<EnginedataService>();
_ServiceObjectType = GlobalObject.container.Resolve<ObjectTypeService>(); _ServiceObjectType = GlobalObject.container.Resolve<ObjectTypeService>();
_ServiceProjectSettings = GlobalObject.container.Resolve<ProjectSettingsService>(); _ServiceProjectSettings = GlobalObject.container.Resolve<ProjectSettingsService>();
_ServiceDataItem= GlobalObject.container.Resolve<DataItemService>();
listDrawings = new ObservableCollection<DtoDrawing>(); listDrawings = new ObservableCollection<DtoDrawing>();
listBasePoint = new ObservableCollection<DtoAutoPlotLayout>(); listBasePoint = new ObservableCollection<DtoAutoPlotLayout>();
listMsg = new ObservableCollection<TextBlock>(); listMsg = new ObservableCollection<TextBlock>();
@ -223,7 +245,6 @@ namespace SWS.Electrical.ViewModels
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); listRange = new ObservableCollection<KeyValueModel>(list);
selectRange = listRange[0];
listOperator = new ObservableCollection<KeyValueModel>() listOperator = new ObservableCollection<KeyValueModel>()
{ new KeyValueModel { Key = "等于", Value = "=" } { new KeyValueModel { Key = "等于", Value = "=" }
}; };
@ -243,7 +264,33 @@ namespace SWS.Electrical.ViewModels
{ {
} }
private List<TreeModel> GetChildNodes(TreeModel treeModel)
{
List<TreeModel> listModel = new List<TreeModel>();
if (treeModel.ChildNodes != null && treeModel.ChildNodes.Any())
{
foreach (var item in treeModel.ChildNodes)
{
if (item.NodeType == "1")
{
listModel.Add(item);
}
else
{
var list = GetChildNodes(item);
if (list.Any())
{
listModel.AddRange(list);
}
}
}
return listModel;
}
else
{
return listModel;
}
}
public async void OnDialogOpened(IDialogParameters parameters) public async void OnDialogOpened(IDialogParameters parameters)
{ {
try try
@ -259,8 +306,19 @@ namespace SWS.Electrical.ViewModels
if (item.NodeType == "1") if (item.NodeType == "1")
{ {
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text }); listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
ec_drawing_file dwgFile = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString()); }
else
{
if (item.Text == "封面、目录、设计说明" || item.Text == "材料表")
{ continue; }
var list = GetChildNodes(item);
if (list.Any())
{
foreach (var dto in list)
{
listDrawings.Add(new DtoDrawing() { DrawingFileID = dto.ID, DrawingFileName = dto.Text });
}
}
} }
} }
} }
@ -289,14 +347,24 @@ namespace SWS.Electrical.ViewModels
if (item.NodeType == "1") if (item.NodeType == "1")
{ {
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text }); listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
ec_drawing_file dwgFile = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString()); }
else
{
if (item.Text == "封面、目录、设计说明" || item.Text == "材料表")
{ continue; }
var list = GetChildNodes(item);
if (list.Any())
{
foreach (var dto in list)
{
listDrawings.Add(new DtoDrawing() { DrawingFileID = dto.ID, DrawingFileName = dto.Text });
}
}
} }
} }
} }
} }
AddMsg($"布置图列表加载完成!"); AddMsg($"布置图列表加载完成!");
} }
var settingModel = await _ServiceProjectSettings.GetEntity("布置图图例显示位号名称"); var settingModel = await _ServiceProjectSettings.GetEntity("布置图图例显示位号名称");
if (settingModel == null) if (settingModel == null)
@ -304,16 +372,48 @@ namespace SWS.Electrical.ViewModels
listLibraryTagName.Add("位号");//默认 listLibraryTagName.Add("位号");//默认
} }
else { listLibraryTagName = settingModel.SettingValue.Split(',').ToList(); } else { listLibraryTagName = settingModel.SettingValue.Split(',').ToList(); }
//区域下拉框对应值列表
var listDetail = await _ServiceDataItem.GetDetails("Area");
if (listDetail != null && listDetail.Any())
{
foreach (var item in listDetail)
{ listArea.Add(new KeyValueModel() { Key=item.DataItemName, Value=item.DataItemName }); }
}
//甲板号下拉框对应值列表
listDetail = await _ServiceDataItem.GetDetails("甲板号");
if (listDetail != null && listDetail.Any())
{
foreach (var item in listDetail)
{ listDeck.Add(new KeyValueModel() { Key = item.DataItemName, Value = item.DataItemName }); }
}
//所属系统下拉框对应值列表
listDetail = await _ServiceDataItem.GetDetails("Be_DrawingSystem");
if (listDetail != null && listDetail.Any())
{
foreach (var item in listDetail)
{ listSystem.Add(new KeyValueModel() { Key = item.DataItemName, Value = item.DataItemName }); }
}
selectRange = listRange[0];
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("DialogOpened异常" + ex.Message); MessageBox.Show("DialogOpened异常" + ex.Message);
} }
//selectRange = listRange[2];
//inputValue = "声力电话";
} }
/// <summary>
/// 下拉值列表绑定
/// </summary>
/// <param name="model"></param>
private void RangeChange(KeyValueModel model)
{
inputValue = "";
if (model.Value == "甲板号")
{ listValue = new ObservableCollection<KeyValueModel>(listDeck); }
else if (model.Value == "区域")
{ listValue = new ObservableCollection<KeyValueModel>(listArea); }
else if (model.Value == "所属系统")
{ listValue = new ObservableCollection<KeyValueModel>(listSystem); }
}
/// <summary> /// <summary>
/// 获取基点信息 /// 获取基点信息
/// </summary> /// </summary>

View File

@ -178,13 +178,22 @@
FontSize="16" FontSize="16"
ItemsSource="{Binding listOperator}" ItemsSource="{Binding listOperator}"
SelectedItem="{Binding selectOperator, Mode=TwoWay}" /> SelectedItem="{Binding selectOperator, Mode=TwoWay}" />
<ComboBox
<TextBox Grid.Column="1"
Width="200"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
IsEditable="True"
ItemsSource="{Binding listValue}"
Text="{Binding inputValue, Mode=TwoWay}" />
<!--<TextBox
Width="200" Width="200"
Height="25" Height="25"
Margin="5,0,0,0" Margin="5,0,0,0"
FontSize="16" FontSize="16"
Text="{Binding inputValue}" /> Text="{Binding inputValue}" />-->
</StackPanel> </StackPanel>
<StackPanel <StackPanel

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8006F31A06196293D0E58F4239B97FC4F768BCF414C1B4C2472A1C22D26CF0B1" #pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ABECE6D950BC12BD1A8DC30FBB96A86A4798DF4A77E402D6CDDD9CF497D2FC76"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
@ -85,7 +85,7 @@ namespace SWS.Electrical.Views {
#line hidden #line hidden
#line 211 "..\..\..\Views\DialogAutoArrangeLayout.xaml" #line 219 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag; internal System.Windows.Controls.DataGrid dgTag;

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8006F31A06196293D0E58F4239B97FC4F768BCF414C1B4C2472A1C22D26CF0B1" #pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "55992553F782D436B236E9D0626B49AE48376927B5906F253898CDC4189B1D22"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
@ -85,7 +85,7 @@ namespace SWS.Electrical.Views {
#line hidden #line hidden
#line 211 "..\..\..\Views\DialogAutoArrangeLayout.xaml" #line 220 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag; internal System.Windows.Controls.DataGrid dgTag;

View File

@ -0,0 +1,10 @@
第1步把文件拷贝到D盘文件夹[SWS.Electrical]里面
第2步在坤恒CAD的安装目录里找到文件on_start.lsp ,用记事本打开
第3步把下面一行命令添加到最下面
(command "netload" "D:\\SWS.Electrical\\SWS.Electrical.dll")
PS:存放文件夹路径可以自己定

View File

@ -2,6 +2,7 @@
using SWS.Commons; using SWS.Commons;
using System; using System;
using System.IO; using System.IO;
using static System.Collections.Specialized.BitVector32;
namespace SWS.Service namespace SWS.Service
{ {
@ -16,13 +17,12 @@ namespace SWS.Service
void SetDefaultConfigValue() void SetDefaultConfigValue()
{ {
if (!File.Exists(path)) if (!File.Exists(path))
{//默认值 {
//默认值
var data = parser.Parser.Parse(""); var data = parser.Parser.Parse("");
data["Profile"]["strIPAddress"] = "1.117.161.11"; data["Profile"]["strIPAddress"] = "1.117.161.11";
data["Profile"]["nPort"] = "8080"; data["Profile"]["nPort"] = "8080";
string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
data["Profile"]["strLocalWorkDir"] = $"{userProfilePath}\\AppData\\Roaming\\BricsCAD Electrical"; data["Profile"]["strLocalWorkDir"] = $"{userProfilePath}\\AppData\\Roaming\\BricsCAD Electrical";
Directory.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
parser.WriteFile(path, data); parser.WriteFile(path, data);
@ -40,17 +40,21 @@ namespace SWS.Service
string address; string address;
int port; int port;
string locDrawingPath; string locDrawingPath;
Read(out address, out port,out locDrawingPath); Read(out address, out port, out locDrawingPath);
_httpService.Init(address, port); _httpService.Init(address, port);
} }
public void Read(out string address, out int port, out string directory) public void Read(out string address, out int port, out string directory)
{ {
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
address = data["Profile"]["strIPAddress"]; //address = data["Profile"]["strIPAddress"];
port = int.Parse(data["Profile"]["nPort"]); //port = int.Parse(data["Profile"]["nPort"]);
directory = data["Profile"]["strLocalWorkDir"]; //directory = data["Profile"]["strLocalWorkDir"];
address = IniHelper.ReadValueFromIniFile("Profile", "strIPAddress");
port = int.Parse(IniHelper.ReadValueFromIniFile("Profile", "nPort"));
directory = IniHelper.ReadValueFromIniFile("Profile", "strLocalWorkDir");
} }
/// <summary> /// <summary>
/// 查询某个 /// 查询某个
/// </summary> /// </summary>
@ -58,8 +62,11 @@ namespace SWS.Service
/// <returns></returns> /// <returns></returns>
public string Read(string keyName) public string Read(string keyName)
{ {
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
return data["Profile"][keyName]; //return data["Profile"][keyName];
var data = IniHelper.ReadValueFromIniFile("Profile", keyName);
return data;
} }
/// <summary> /// <summary>
/// 查询某个 /// 查询某个
@ -67,14 +74,17 @@ namespace SWS.Service
/// <param name="session">节点</param> /// <param name="session">节点</param>
/// <param name="keyName">key名称</param> /// <param name="keyName">key名称</param>
/// <returns></returns> /// <returns></returns>
public string Read(string session,string keyName) public string Read(string session, string keyName)
{ {
try try
{ {
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
return data[session][keyName]; //return data[session][keyName];
var data = IniHelper.ReadValueFromIniFile(session, keyName);
return data;
} }
catch catch
{ {
return null; return null;
} }
@ -86,9 +96,10 @@ namespace SWS.Service
/// <param name="value"></param> /// <param name="value"></param>
public void Save(string keyName, string value) public void Save(string keyName, string value)
{ {
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
data["Profile"][keyName] = value; //data["Profile"][keyName] = value;
parser.WriteFile(path, data); //parser.WriteFile(path, data);
IniHelper.WriteValueFromIniFile("Profile", keyName, value);
} }
/// <summary> /// <summary>
/// 保存某个值 /// 保存某个值
@ -98,9 +109,11 @@ namespace SWS.Service
/// <param name="value">值</param> /// <param name="value">值</param>
public void Save(string session, string keyName, string value) public void Save(string session, string keyName, string value)
{ {
var data = parser.ReadFile(path); //var data = parser.ReadFile(path);
data[session][keyName] = value; //data[session][keyName] = value;
parser.WriteFile(path, data); //parser.WriteFile(path, data);
IniHelper.WriteValueFromIniFile(session, keyName, value);
} }
} }
} }

View File

@ -1,10 +1,10 @@
<ResourceDictionary <ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl" xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons" xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
xmlns:local="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<!-- 系统颜色 --> <!-- 系统颜色 -->
@ -579,7 +579,7 @@
</Style> </Style>
<!-- 多选搜索 Combox End --> <!-- 多选搜索 Combox End -->
<!-- 信号状态样式 --> <!-- 信号状态样式 -->
<Style x:Key="ToDeleteStatusStyle" TargetType="telerik:GridViewRow"> <Style x:Key="ToDeleteStatusStyle" TargetType="telerik:GridViewRow">
<Setter Property="Foreground" Value="#db9fa9" /> <Setter Property="Foreground" Value="#db9fa9" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />

View File

@ -9,8 +9,6 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using SWS.Commons.Helper.Converter;
using SWS.CustomControl;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows; using System.Windows;
@ -31,28 +29,6 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Shell; using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.WPF.Views { namespace SWS.WPF.Views {

View File

@ -9,8 +9,6 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using SWS.Commons.Helper.Converter;
using SWS.CustomControl;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows; using System.Windows;
@ -31,28 +29,6 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Shell; using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.WPF.Views { namespace SWS.WPF.Views {