电气前端提交
This commit is contained in:
parent
9c2734fc6b
commit
5f9f05885d
File diff suppressed because one or more lines are too long
189
newFront/c#前端/CAD.Extend/CAD.Extend.csproj
Normal file
189
newFront/c#前端/CAD.Extend/CAD.Extend.csproj
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{8740B023-B585-4E69-8521-4F62FA754A1B}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>CAD.Extend</RootNamespace>
|
||||||
|
<AssemblyName>CAD.Extend</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="BrxMgd">
|
||||||
|
<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>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.122\lib\net462\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="Prism, Version=9.0.537.60525, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Core.9.0.537\lib\net47\Prism.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Container.Abstractions, Version=9.0.106.9543, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Container.Abstractions.9.0.106\lib\net47\Prism.Container.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Container.DryIoc, Version=9.0.106.9543, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Container.DryIoc.9.0.106\lib\net47\Prism.Container.DryIoc.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Container.Unity, Version=9.0.106.9543, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Container.Unity.9.0.106\lib\net462\Prism.Container.Unity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.DryIoc.Wpf, Version=9.0.537.60525, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.DryIoc.9.0.537\lib\net47\Prism.DryIoc.Wpf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Events, Version=9.0.537.60525, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Events.9.0.537\lib\net47\Prism.Events.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Unity.Wpf, Version=9.0.537.60525, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Unity.9.0.537\lib\net47\Prism.Unity.Wpf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Wpf, Version=9.0.537.60525, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Wpf.9.0.537\lib\net47\Prism.Wpf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Windows" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<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>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Data, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.FileDialogs, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.FileDialogs.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.GridView, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.GridView.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Input, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Input.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Navigation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Data, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Unity.Abstractions.5.11.7\lib\net48\Unity.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.Container, Version=5.11.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Unity.Container.5.11.11\lib\net48\Unity.Container.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Commands.cs" />
|
||||||
|
<Compile Include="GlobalObject.cs" />
|
||||||
|
<Compile Include="Model\KeyValueModel.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogConvertBaseMapViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\myViewModelBase\DialogBase.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\customWindowTitleBar.xaml.cs">
|
||||||
|
<DependentUpon>customWindowTitleBar.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\CustomDialogWindow.xaml.cs">
|
||||||
|
<DependentUpon>CustomDialogWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\DialogConvertBaseMap.xaml.cs">
|
||||||
|
<DependentUpon>DialogConvertBaseMap.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Images\pic1.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Views\CustomControl\customWindowTitleBar.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\CustomDialogWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\DialogConvertBaseMap.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Style\CustomStyles.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SWS.CAD.Base\SWS.CAD.Base.csproj">
|
||||||
|
<Project>{d4a15774-1469-45a0-9eff-771271764a00}</Project>
|
||||||
|
<Name>SWS.CAD.Base</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="CADFunc\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
7
newFront/c#前端/CAD.Extend/CAD.Extend.csproj.user
Normal file
7
newFront/c#前端/CAD.Extend/CAD.Extend.csproj.user
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||||
|
<StartAction>Program</StartAction>
|
||||||
|
<StartProgram>D:\Program Files\KunHeng\KunHengCAD V21 zh_CN\kunhengcad.exe</StartProgram>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
145
newFront/c#前端/CAD.Extend/Commands.cs
Normal file
145
newFront/c#前端/CAD.Extend/Commands.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Bricscad.Ribbon;
|
||||||
|
using Bricscad.Windows;
|
||||||
|
using CAD.Extend;
|
||||||
|
using CAD.Extend.ViewModels;
|
||||||
|
using CAD.Extend.Views;
|
||||||
|
using Prism.Container.DryIoc;
|
||||||
|
using Prism.Dialogs;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using SWS.CAD.Base;
|
||||||
|
using Teigha.Runtime;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
using Application = Bricscad.ApplicationServices.Application;
|
||||||
|
|
||||||
|
[assembly: CommandClass(typeof(Commands))]
|
||||||
|
[assembly: ExtensionApplication(typeof(Commands))]
|
||||||
|
namespace CAD.Extend
|
||||||
|
{
|
||||||
|
public partial class Commands : IExtensionApplication
|
||||||
|
{
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
if (RibbonServices.RibbonPaletteSet == null)
|
||||||
|
RibbonServices.CreateRibbonPaletteSet();
|
||||||
|
|
||||||
|
Register();
|
||||||
|
|
||||||
|
AddTab();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Application.ShowAlertDialog(" An exception occurred in Initialize():\n" + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Register()
|
||||||
|
{
|
||||||
|
|
||||||
|
GlobalObject._prismContainer = new DryIocContainerExtension();
|
||||||
|
GlobalObject._prismContainer.Register<IDialogService, DialogService>();
|
||||||
|
GlobalObject._prismContainer.Register<IDialogWindow, CustomDialogWindow>();
|
||||||
|
GlobalObject._prismContainer.RegisterDialog<DialogConvertBaseMap, DialogConvertBaseMapViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 记录异常信息到日志文件,这里简单打印到控制台
|
||||||
|
System.Exception ex = e.ExceptionObject as System.Exception;
|
||||||
|
Console.WriteLine($"发生未处理的异常: {ex.Message}");
|
||||||
|
Console.WriteLine($"异常堆栈跟踪: {ex.StackTrace}");
|
||||||
|
|
||||||
|
// 关闭所有打开的对话框窗口
|
||||||
|
|
||||||
|
|
||||||
|
// 提示用户发生了错误
|
||||||
|
MessageBox.Show("发生错误,请检查日志文件以获取更多信息。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
catch (System.Exception innerEx)
|
||||||
|
{
|
||||||
|
// 如果在处理异常时又发生了异常,简单打印信息
|
||||||
|
Console.WriteLine($"处理异常时发生错误: {innerEx.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Terminate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddTab()
|
||||||
|
{
|
||||||
|
RibbonControl rbnCtrl = ComponentManager.Ribbon; //整个上面都是ribbon,比如莫工做的电气系统,就是ribbon中的一个tab
|
||||||
|
|
||||||
|
if (rbnCtrl == null) return;
|
||||||
|
#region create Ribbon tab
|
||||||
|
RibbonTab tab1 = new RibbonTab();
|
||||||
|
tab1.Title = "扩展功能";
|
||||||
|
tab1.Id = "扩展功能";
|
||||||
|
rbnCtrl.Tabs.Add(tab1);//一个就行了
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Ribbon 图层管理
|
||||||
|
RibbonPanelSource dataSource = new RibbonPanelSource();
|
||||||
|
dataSource.Title = "图层操作";
|
||||||
|
dataSource.Id = "图层操作";
|
||||||
|
RibbonPanel dataPanel = new RibbonPanel();
|
||||||
|
dataPanel.Source = dataSource;
|
||||||
|
tab1.Panels.Add(dataPanel);
|
||||||
|
|
||||||
|
//垂直排列按钮panel
|
||||||
|
RibbonRowPanel ribbonRowPanel = new RibbonRowPanel();
|
||||||
|
|
||||||
|
#region buttons 一键转底图
|
||||||
|
RibbonButton btnSinalManage = new RibbonButton();
|
||||||
|
btnSinalManage.ToolTip = "一键转底图";
|
||||||
|
btnSinalManage.Text = "一键转底图";
|
||||||
|
btnSinalManage.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||||
|
btnSinalManage.CommandHandler = new DelegateCommand(x =>
|
||||||
|
{
|
||||||
|
var listObjectId=General.GetSelectedObjectId();
|
||||||
|
if (listObjectId==null||!listObjectId.Any())
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先选择图元!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//打开窗体
|
||||||
|
Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters();
|
||||||
|
para.Add(GlobalObject.dialogPar.info.ToString(), listObjectId);
|
||||||
|
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
||||||
|
_dialogService.ShowDialog(nameof(DialogConvertBaseMap), para, (RES) =>
|
||||||
|
{
|
||||||
|
if (RES.Result == ButtonResult.Yes)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (RES.Result == ButtonResult.No)
|
||||||
|
{ }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CAD.Extend.Images.pic1.png");
|
||||||
|
btnSinalManage.Id = "一键转底图";
|
||||||
|
ribbonRowPanel.Items.Add(btnSinalManage);
|
||||||
|
ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列
|
||||||
|
#endregion
|
||||||
|
dataSource.Items.Add(ribbonRowPanel);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
48
newFront/c#前端/CAD.Extend/GlobalObject.cs
Normal file
48
newFront/c#前端/CAD.Extend/GlobalObject.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace CAD.Extend
|
||||||
|
{
|
||||||
|
public class GlobalObject
|
||||||
|
{
|
||||||
|
public static IContainerExtension _prismContainer;
|
||||||
|
public enum dialogPar
|
||||||
|
{
|
||||||
|
info,
|
||||||
|
para1,
|
||||||
|
para2
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resName">包括命名空间</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static System.Windows.Media.ImageSource ImageSourceFromEmbeddedResourceStream(string resName)
|
||||||
|
{
|
||||||
|
System.Reflection.Assembly assy = System.Reflection.Assembly.GetExecutingAssembly();
|
||||||
|
//foreach (string resource in assy.GetManifestResourceNames())
|
||||||
|
//{
|
||||||
|
// Console.WriteLine(resource);//遍历所有的内嵌资源
|
||||||
|
//}
|
||||||
|
System.IO.Stream stream = assy.GetManifestResourceStream(resName);
|
||||||
|
if (stream == null)
|
||||||
|
return null;
|
||||||
|
System.Windows.Media.Imaging.BitmapImage img = new System.Windows.Media.Imaging.BitmapImage();
|
||||||
|
img.BeginInit();
|
||||||
|
img.StreamSource = stream;
|
||||||
|
img.EndInit();
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
33
newFront/c#前端/CAD.Extend/Properties/AssemblyInfo.cs
Normal file
33
newFront/c#前端/CAD.Extend/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("CAD.Extend")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("CAD.Extend")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("8740b023-b585-4e69-8521-4f62fa754a1b")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -0,0 +1,206 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Bricscad.Windows;
|
||||||
|
using CAD.Extend.Model;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Dialogs;
|
||||||
|
using SWS.CAD.Base;
|
||||||
|
using Teigha.Colors;
|
||||||
|
using Teigha.DatabaseServices;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
using Color = System.Windows.Media.Color;
|
||||||
|
|
||||||
|
namespace CAD.Extend.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogConvertBaseMapViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
#region binding
|
||||||
|
private ObservableCollection<KeyValueModel> _listLayerName = new ObservableCollection<KeyValueModel>();
|
||||||
|
/// <summary>
|
||||||
|
/// 底图名列表
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<KeyValueModel> listLayerName
|
||||||
|
{
|
||||||
|
get { return _listLayerName; }
|
||||||
|
set { _listLayerName = value; RaisePropertyChanged(nameof(listLayerName)); }
|
||||||
|
}
|
||||||
|
private KeyValueModel _SelectedLayerName;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中的底图名
|
||||||
|
/// </summary>
|
||||||
|
public KeyValueModel SelectedLayerName
|
||||||
|
{
|
||||||
|
get { return _SelectedLayerName; }
|
||||||
|
set { _SelectedLayerName = value; RaisePropertyChanged(nameof(SelectedLayerName)); }
|
||||||
|
}
|
||||||
|
private bool _IsToBlock;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否转为图块
|
||||||
|
/// </summary>
|
||||||
|
public bool IsToBlock
|
||||||
|
{
|
||||||
|
get { return _IsToBlock; }
|
||||||
|
set { _IsToBlock = value; RaisePropertyChanged(nameof(IsToBlock)); }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string _BlockName = "EI-Elec专用底图";
|
||||||
|
/// <summary>
|
||||||
|
/// 块名
|
||||||
|
/// </summary>
|
||||||
|
public string BlockName
|
||||||
|
{
|
||||||
|
get { return _BlockName; }
|
||||||
|
set { _BlockName = value; RaisePropertyChanged(nameof(BlockName)); }
|
||||||
|
}
|
||||||
|
private Brush _BlockColor;
|
||||||
|
/// <summary>
|
||||||
|
/// 图层颜色
|
||||||
|
/// </summary>
|
||||||
|
public Brush BlockColor
|
||||||
|
{
|
||||||
|
get { return _BlockColor; }
|
||||||
|
set { _BlockColor = value; RaisePropertyChanged(nameof(BlockColor)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 随机块名
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_BlockName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 颜色
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_Color { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 图层颜色 默认灰色
|
||||||
|
/// </summary>
|
||||||
|
Teigha.Colors.Color layerColor = Teigha.Colors.Color.FromColorIndex(ColorMethod.ByAci, 8);
|
||||||
|
List<ObjectId> listObjectId = new List<ObjectId>();
|
||||||
|
string layerName = "EI-Elec专用底图图层";
|
||||||
|
public DialogConvertBaseMapViewModel()
|
||||||
|
{
|
||||||
|
title = "背景底图设置";
|
||||||
|
Command_BlockName = new DelegateCommand(onBlockName);
|
||||||
|
Command_Color = new DelegateCommand(onColor);
|
||||||
|
System.Drawing.Color winColor = layerColor.ColorValue;
|
||||||
|
var c = Color.FromArgb(winColor.A, winColor.R, winColor.G, winColor.B);
|
||||||
|
BlockColor = new SolidColorBrush(c);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 颜色选择
|
||||||
|
/// </summary>
|
||||||
|
public void onColor()
|
||||||
|
{
|
||||||
|
var list=General.GetTopLevelDictionaryNames();
|
||||||
|
|
||||||
|
ColorDialog dlg = new ColorDialog();
|
||||||
|
|
||||||
|
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
layerColor = dlg.Color;
|
||||||
|
System.Drawing.Color winColor = dlg.Color.ColorValue;
|
||||||
|
var b = Color.FromArgb(winColor.A, winColor.R, winColor.G, winColor.B);
|
||||||
|
BlockColor = new SolidColorBrush(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 随机块名
|
||||||
|
/// </summary>
|
||||||
|
public void onBlockName()
|
||||||
|
{
|
||||||
|
var a = GetRndABC();
|
||||||
|
Thread.Sleep(10);
|
||||||
|
var b = GetRndABC();
|
||||||
|
Thread.Sleep(10);
|
||||||
|
var c = GetRndABC();
|
||||||
|
BlockName = "EI-Elec图块" + a + b + c;
|
||||||
|
}
|
||||||
|
public string GetRndABC()
|
||||||
|
{
|
||||||
|
// a-z ASCII值 97-122
|
||||||
|
// A-Z ASCII值 65-90
|
||||||
|
int i = new Random().Next(65, 90);
|
||||||
|
char c = (char)i;
|
||||||
|
return c.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Dialog
|
||||||
|
|
||||||
|
public DialogCloseListener RequestClose { get; }
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
listObjectId = parameters.GetValue<List<ObjectId>>(GlobalObject.dialogPar.info.ToString());
|
||||||
|
var list = General.GetAllLayerNames();
|
||||||
|
foreach (var layerName in list)
|
||||||
|
{
|
||||||
|
if (layerName.Equals(layerName))
|
||||||
|
{ listLayerName.Insert(0, new KeyValueModel() { Key = layerName, Value = layerName }); }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listLayerName.Add(new KeyValueModel() { Key = layerName, Value = layerName });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!listLayerName.Where(a => a.Key == layerName).Any())
|
||||||
|
{ listLayerName.Insert(0, new KeyValueModel() { Key = layerName, Value = layerName }); }
|
||||||
|
SelectedLayerName = listLayerName[0];
|
||||||
|
}
|
||||||
|
public override void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
if (IsToBlock)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(BlockName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("块名不能为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (General.CheckHasBlockName(BlockName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("块名已存在,请更换块名!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
General.SetEntityToLayer(listObjectId, SelectedLayerName.Value, layerColor, BlockName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
General.SetEntityToLayer(listObjectId, SelectedLayerName.Value, layerColor);
|
||||||
|
}
|
||||||
|
MessageBox.Show("底图设置成功!");
|
||||||
|
//Prism.Dialogs.DialogParameters resPara = new Prism.Dialogs.DialogParameters();
|
||||||
|
//RequestClose.Invoke(resPara, ButtonResult.Yes);
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter as string == "ClickNo")
|
||||||
|
{
|
||||||
|
RequestClose.Invoke(ButtonResult.No);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RequestClose.Invoke(ButtonResult.Cancel);
|
||||||
|
}
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
15
newFront/c#前端/CAD.Extend/app.config
Normal file
15
newFront/c#前端/CAD.Extend/app.config
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Prism.Container.Abstractions" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-9.0.107.57918" newVersion="9.0.107.57918" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
E:\Di-Electrical\c#前端\CAD.Extend\obj\Debug\CAD.Extend.csproj.AssemblyReference.cache
|
Binary file not shown.
20
newFront/c#前端/CAD.Extend/packages.config
Normal file
20
newFront/c#前端/CAD.Extend/packages.config
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="DryIoc.dll" version="5.4.3" targetFramework="net48" />
|
||||||
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
|
||||||
|
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.1" targetFramework="net48" />
|
||||||
|
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.122" targetFramework="net48" />
|
||||||
|
<package id="Prism.Container.Abstractions" version="9.0.106" targetFramework="net48" />
|
||||||
|
<package id="Prism.Container.DryIoc" version="9.0.106" targetFramework="net48" />
|
||||||
|
<package id="Prism.Container.Unity" version="9.0.106" targetFramework="net48" />
|
||||||
|
<package id="Prism.Core" version="9.0.537" targetFramework="net48" />
|
||||||
|
<package id="Prism.DryIoc" version="9.0.537" targetFramework="net48" />
|
||||||
|
<package id="Prism.Events" version="9.0.537" targetFramework="net48" />
|
||||||
|
<package id="Prism.Unity" version="9.0.537" targetFramework="net48" />
|
||||||
|
<package id="Prism.Wpf" version="9.0.537" targetFramework="net48" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
|
||||||
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
|
||||||
|
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
|
||||||
|
<package id="Unity.Abstractions" version="5.11.7" targetFramework="net48" />
|
||||||
|
<package id="Unity.Container" version="5.11.11" targetFramework="net48" />
|
||||||
|
</packages>
|
File diff suppressed because one or more lines are too long
18
newFront/c#前端/DI-Electrical/App.config
Normal file
18
newFront/c#前端/DI-Electrical/App.config
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Prism.Container.Abstractions" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-9.0.107.57918" newVersion="9.0.107.57918" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
16
newFront/c#前端/DI-Electrical/App.xaml
Normal file
16
newFront/c#前端/DI-Electrical/App.xaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<p:PrismApplication
|
||||||
|
x:Class="DI_Electrical.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical"
|
||||||
|
xmlns:p="http://prismlibrary.com/">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/DI-Electrical;component/Style/CustomStyles.xaml" />
|
||||||
|
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</p:PrismApplication>
|
71
newFront/c#前端/DI-Electrical/App.xaml.cs
Normal file
71
newFront/c#前端/DI-Electrical/App.xaml.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using DI_Electrical.Helper;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
using DI_Electrical.Views;
|
||||||
|
using DI_Electrical.Views.Dialog;
|
||||||
|
using DI_Electrical.Views.Dialog.DialogSignalManagements;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Prism.Unity;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace DI_Electrical
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// App.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : PrismApplication
|
||||||
|
{
|
||||||
|
protected override Window CreateShell()
|
||||||
|
{
|
||||||
|
return Container.Resolve<MainWindow>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InitializeShell(Window shell)
|
||||||
|
{
|
||||||
|
var login = Container.Resolve<Login>();
|
||||||
|
login.ShowDialog();
|
||||||
|
if (GlobalObject.userInfo == null)
|
||||||
|
{
|
||||||
|
Application.Current?.Shutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var project = Container.Resolve<Project>();
|
||||||
|
project.ShowDialog();
|
||||||
|
if (GlobalObject.curProject == null)
|
||||||
|
{
|
||||||
|
Application.Current?.Shutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
base.InitializeShell(shell);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
|
{
|
||||||
|
containerRegistry.RegisterForNavigation<MainWindow, MainWindowViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<Login, LoginViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<Config, ConfigViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<Project, ProjectViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogTest, DialogTestViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogSignalManagement, DialogSignalManagementViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogSignalNotice, DialogSignalNoticeViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogSignalPropertyhisAndLogs, DialogSignalPropertyhisAndLogsViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogSignalSelect, DialogSignalSelectViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogInput, DialogInputViewModel>();
|
||||||
|
|
||||||
|
containerRegistry.Register<IDialogService, DialogService>();
|
||||||
|
|
||||||
|
containerRegistry.RegisterSingleton<IEventAggregator, EventAggregator>();
|
||||||
|
containerRegistry.RegisterSingleton<HttpService>();
|
||||||
|
containerRegistry.RegisterSingleton<ConfigService>();
|
||||||
|
containerRegistry.RegisterSingleton<LoginService>();
|
||||||
|
containerRegistry.RegisterSingleton<UserService>();
|
||||||
|
containerRegistry.RegisterSingleton<DataItemService>();
|
||||||
|
containerRegistry.RegisterSingleton<WireGroupService>();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
308
newFront/c#前端/DI-Electrical/DI-Electrical.csproj
Normal file
308
newFront/c#前端/DI-Electrical/DI-Electrical.csproj
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{924A2824-BE62-42A7-81A8-49BEFCB3801F}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>DI_Electrical</RootNamespace>
|
||||||
|
<AssemblyName>DI-Electrical</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<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>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EasyEncryption">
|
||||||
|
<HintPath>..\packages\EasyEncryption.1.0.2\lib\EasyEncryption.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="INIFileParser">
|
||||||
|
<HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="log4net, Version=3.1.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\log4net.3.1.0\lib\net462\log4net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.122\lib\net462\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Unity.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Unity.8.1.97\lib\net47\Prism.Unity.Wpf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Prism.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Data, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.FileDialogs, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.FileDialogs.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.GridView, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.GridView.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Input, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Input.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Controls.Navigation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Telerik.Windows.Data, Version=2024.1.130.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\SWS.CAD\RefDLL\WPF45\Telerik.Windows.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Unity.Abstractions.5.11.7\lib\net48\Unity.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.Container, Version=5.11.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Unity.Container.5.11.11\lib\net48\Unity.Container.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Event\loginEvent.cs" />
|
||||||
|
<Compile Include="GlobalObject.cs" />
|
||||||
|
<Compile Include="Helper\ConfigService.cs" />
|
||||||
|
<Compile Include="Helper\Converter\CollectionToStringConverter.cs" />
|
||||||
|
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
|
||||||
|
<Compile Include="Helper\Converter\StatusToColourConverter.cs" />
|
||||||
|
<Compile Include="Helper\FileHelper.cs" />
|
||||||
|
<Compile Include="Helper\LoggerHelper.cs" />
|
||||||
|
<Compile Include="Model\ec_dataitemdetail.cs" />
|
||||||
|
<Compile Include="Model\ec_project.cs" />
|
||||||
|
<Compile Include="Model\ec_Wire_Group.cs" />
|
||||||
|
<Compile Include="Model\ec_wire_group_log.cs" />
|
||||||
|
<Compile Include="Model\ec_wire_group_notice.cs" />
|
||||||
|
<Compile Include="Model\ec_wire_group_propertyhis.cs" />
|
||||||
|
<Compile Include="Model\NoEntity\ConfigIni.cs" />
|
||||||
|
<Compile Include="Model\NoEntity\learunHttpRes.cs" />
|
||||||
|
<Compile Include="Model\NoEntity\loginRes.cs" />
|
||||||
|
<Compile Include="Model\NoEntity\PageModel.cs" />
|
||||||
|
<Compile Include="Model\user.cs" />
|
||||||
|
<Compile Include="Services\DataItemService.cs" />
|
||||||
|
<Compile Include="Services\HttpService.cs" />
|
||||||
|
<Compile Include="Services\LoginService.cs" />
|
||||||
|
<Compile Include="Services\ProjectService.cs" />
|
||||||
|
<Compile Include="Services\UserService.cs" />
|
||||||
|
<Compile Include="Services\WireGroupService.cs" />
|
||||||
|
<Compile Include="Style\StyleSelectors\ConditionalStyleSelector.cs" />
|
||||||
|
<Compile Include="Style\StyleSelectors\SignalNoticeStyleSelector.cs" />
|
||||||
|
<Compile Include="ViewModels\ConfigViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogInputViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalManagementViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalNoticeViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalPropertyhisAndLogsViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalSelectViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\LoginViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogTestViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\myViewModelBase\DialogBase.cs" />
|
||||||
|
<Compile Include="ViewModels\ProjectViewModel.cs" />
|
||||||
|
<Compile Include="Views\Config.xaml.cs">
|
||||||
|
<DependentUpon>Config.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\CustomControl\customWindowTitleBar.xaml.cs">
|
||||||
|
<DependentUpon>customWindowTitleBar.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Helper\PasswordHelper.cs" />
|
||||||
|
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\IconButton\IconButton.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\CollectionToStringConverter.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\DoubleUtil.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\ElementHelper.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\GeometryHelper.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\MultiSelectComboBoxItem.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\MultiSelectListBox.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\MultiSelectSearchComboBox.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\SmallPanel.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\WDBorder.cs" />
|
||||||
|
<Compile Include="Views\CustomControl\MultiSelectSearchComboBox\Win32.cs" />
|
||||||
|
<Compile Include="Views\Dialog\DialogInput.xaml.cs">
|
||||||
|
<DependentUpon>DialogInput.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogSignalManagements\DialogSignalManagement.xaml.cs">
|
||||||
|
<DependentUpon>DialogSignalManagement.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogSignalManagements\DialogSignalNotice.xaml.cs">
|
||||||
|
<DependentUpon>DialogSignalNotice.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogSignalManagements\DialogSignalPropertyhisAndLogs.xaml.cs">
|
||||||
|
<DependentUpon>DialogSignalPropertyhisAndLogs.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogSignalManagements\DialogSignalSelect.xaml.cs">
|
||||||
|
<DependentUpon>DialogSignalSelect.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogTest.xaml.cs">
|
||||||
|
<DependentUpon>DialogTest.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Login.xaml.cs">
|
||||||
|
<DependentUpon>Login.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\Project.xaml.cs">
|
||||||
|
<DependentUpon>Project.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="log4net.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Views\Config.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\CustomControl\customWindowTitleBar.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Style\CustomStyles.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogInput.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogSignalManagements\DialogSignalManagement.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogSignalManagements\DialogSignalNotice.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogSignalManagements\DialogSignalPropertyhisAndLogs.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogSignalManagements\DialogSignalSelect.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogTest.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Login.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\MainWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\Project.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
6
newFront/c#前端/DI-Electrical/DI-Electrical.csproj.user
Normal file
6
newFront/c#前端/DI-Electrical/DI-Electrical.csproj.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
14
newFront/c#前端/DI-Electrical/Event/loginEvent.cs
Normal file
14
newFront/c#前端/DI-Electrical/Event/loginEvent.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Prism.Events;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Event
|
||||||
|
{
|
||||||
|
public class loginEvent: PubSubEvent<JToken>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
107
newFront/c#前端/DI-Electrical/Helper/ConfigService.cs
Normal file
107
newFront/c#前端/DI-Electrical/Helper/ConfigService.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using IniParser;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper
|
||||||
|
{
|
||||||
|
public class ConfigService
|
||||||
|
{
|
||||||
|
//public string path = Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Config.ini");
|
||||||
|
public string path = GlobalObject.ConfigPath;// Path.Combine(AppDomain.CurrentDomain.BaseDirectory,@"\Config.ini");
|
||||||
|
public FileIniDataParser parser = new FileIniDataParser();
|
||||||
|
public HttpService _httpService;
|
||||||
|
/// <summary>
|
||||||
|
/// config.ini 给默认值,且创建出来
|
||||||
|
/// </summary>
|
||||||
|
void SetDefaultConfigValue()
|
||||||
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
//默认值
|
||||||
|
var data = parser.Parser.Parse("");
|
||||||
|
data["Profile"]["Address"] = "1.117.161.11";
|
||||||
|
data["Profile"]["Port"] = "8080";
|
||||||
|
string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
|
||||||
|
data["Profile"]["Directory"] = $"{userProfilePath}\\AppData\\Roaming\\SWS";
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
parser.WriteFile(path, data);
|
||||||
|
GlobalObject.isConfigIniCreateBySys = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GlobalObject.isConfigIniCreateBySys = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ConfigService(HttpService httpService)
|
||||||
|
{
|
||||||
|
_httpService = httpService;
|
||||||
|
SetDefaultConfigValue();
|
||||||
|
string address;
|
||||||
|
int port;
|
||||||
|
string locDrawingPath;
|
||||||
|
Read(out address, out port,out locDrawingPath);
|
||||||
|
_httpService.Init(address, port);
|
||||||
|
}
|
||||||
|
public void Read(out string address, out int port, out string directory)
|
||||||
|
{
|
||||||
|
var data = parser.ReadFile(path);
|
||||||
|
address = data["Profile"]["Address"];
|
||||||
|
port = int.Parse(data["Profile"]["Port"]);
|
||||||
|
directory = data["Profile"]["Directory"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询某个
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Read(string keyName)
|
||||||
|
{
|
||||||
|
var data = parser.ReadFile(path);
|
||||||
|
return data["Profile"][keyName];
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 查询某个
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session">节点</param>
|
||||||
|
/// <param name="keyName">key名称</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Read(string session,string keyName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = parser.ReadFile(path);
|
||||||
|
return data[session][keyName];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 保存某个
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyName"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public void Save(string keyName, string value)
|
||||||
|
{
|
||||||
|
var data = parser.ReadFile(path);
|
||||||
|
data["Profile"][keyName] = value;
|
||||||
|
parser.WriteFile(path, data);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 保存某个值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session">节点</param>
|
||||||
|
/// <param name="keyName">key名称</param>
|
||||||
|
/// <param name="value">值</param>
|
||||||
|
public void Save(string session, string keyName, string value)
|
||||||
|
{
|
||||||
|
var data = parser.ReadFile(path);
|
||||||
|
data[session][keyName] = value;
|
||||||
|
parser.WriteFile(path, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper.Converter
|
||||||
|
{
|
||||||
|
public class CollectionToStringConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
ObservableCollection<ec_dataitemdetail> WHCPUs = value as ObservableCollection<ec_dataitemdetail>;
|
||||||
|
if (WHCPUs != null)
|
||||||
|
{
|
||||||
|
string sWHCPU = "";
|
||||||
|
for (int i = 0; i < WHCPUs.Count; i++)
|
||||||
|
{
|
||||||
|
if (i!= WHCPUs.Count-1)
|
||||||
|
{
|
||||||
|
if (WHCPUs[i] != null)
|
||||||
|
{
|
||||||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode + "|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (WHCPUs[i] != null)
|
||||||
|
{
|
||||||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sWHCPU;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper.Converter
|
||||||
|
{
|
||||||
|
public class RadGridViewRowToBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
SignalManagementInfo smif = value as SignalManagementInfo;
|
||||||
|
if (smif != null)
|
||||||
|
{
|
||||||
|
if (smif.Status.Equals("deleted") || smif.Status.Equals("Confirmed"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (smif.type.Equals("信号"))
|
||||||
|
{
|
||||||
|
switch (parameter.ToString())
|
||||||
|
{
|
||||||
|
case "关联的电缆信息":
|
||||||
|
case "关联的通道信息":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (parameter.ToString())
|
||||||
|
{
|
||||||
|
case "组别":
|
||||||
|
case "编码":
|
||||||
|
case "信号类型":
|
||||||
|
case "Min":
|
||||||
|
case "Max":
|
||||||
|
case "单位":
|
||||||
|
case "CODE":
|
||||||
|
case "设备名":
|
||||||
|
case "关联的电缆信息":
|
||||||
|
case "关联的通道信息":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper.Converter
|
||||||
|
{
|
||||||
|
internal class StatusToColourConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
SignalManagementInfo smif = value as SignalManagementInfo;
|
||||||
|
if (smif != null)
|
||||||
|
{
|
||||||
|
return smif.Status;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
118
newFront/c#前端/DI-Electrical/Helper/FileHelper.cs
Normal file
118
newFront/c#前端/DI-Electrical/Helper/FileHelper.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
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 Dl_Electrical.Helper
|
||||||
|
{
|
||||||
|
public static class FileHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// dwg等文件名是否合法。不带后缀
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValidFileName(string fileName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fileName))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 Windows 文件系统中不允许出现在文件名中的字符数组
|
||||||
|
char[] invalidChars = Path.GetInvalidFileNameChars();
|
||||||
|
|
||||||
|
// 检查文件名中是否包含非法字符
|
||||||
|
foreach (char c in invalidChars)
|
||||||
|
{
|
||||||
|
if (fileName.IndexOf(c) >= 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否为保留文件名
|
||||||
|
string[] reservedNames = { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
|
||||||
|
string trimmedFileName = Path.GetFileNameWithoutExtension(fileName).Trim().ToUpper();
|
||||||
|
foreach (string reservedName in reservedNames)
|
||||||
|
{
|
||||||
|
if (trimmedFileName == reservedName)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件名是否以空格或句点结尾
|
||||||
|
if (fileName.TrimEnd().Length != fileName.Length || fileName.TrimEnd('.').Length != fileName.Length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string GetFileMD5(string filePath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("文件路径无效或文件不存在", nameof(filePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var md5 = MD5.Create()) // 创建 MD5 哈希算法实例
|
||||||
|
using (var stream = File.OpenRead(filePath)) // 打开文件流
|
||||||
|
{
|
||||||
|
// 计算文件的 MD5 值
|
||||||
|
byte[] hashBytes = md5.ComputeHash(stream);
|
||||||
|
|
||||||
|
// 将字节数组转换为十六进制字符串
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (var b in hashBytes)
|
||||||
|
{
|
||||||
|
sb.Append(b.ToString("x2")); // x2 格式化为两位小写十六进制数
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString(); // 返回 MD5 值的字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 检查文件是否被其他进程占用
|
||||||
|
/// <summary>
|
||||||
|
/// 检查文件是否被其他进程占用
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsFileLocked(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 尝试以独占模式打开文件
|
||||||
|
using (FileStream fs = File.Open(
|
||||||
|
filePath,
|
||||||
|
FileMode.Open,
|
||||||
|
FileAccess.ReadWrite,
|
||||||
|
FileShare.None)) // FileShare.None 表示禁止共享
|
||||||
|
{
|
||||||
|
return false; // 成功打开则未被占用
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
// 检查特定错误码
|
||||||
|
int errorCode = Marshal.GetHRForException(ex) & 0xFFFF;
|
||||||
|
return errorCode == 32 || errorCode == 33; // 32: 共享冲突, 33: 进程锁定
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
return true; // 无权限访问(可能被占用)
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false; // 其他异常视为未被占用
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
145
newFront/c#前端/DI-Electrical/Helper/LoggerHelper.cs
Normal file
145
newFront/c#前端/DI-Electrical/Helper/LoggerHelper.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using Dl_Electrical.Helper;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// nLog使用帮助类
|
||||||
|
/// </summary>
|
||||||
|
public class LoggerHelper
|
||||||
|
{
|
||||||
|
private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
|
||||||
|
private static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
|
||||||
|
private static readonly log4net.ILog logdebug = log4net.LogManager.GetLogger("logdebug");
|
||||||
|
private static readonly log4net.ILog logwarn = log4net.LogManager.GetLogger("logwarn");
|
||||||
|
private static readonly log4net.ILog logfatal = log4net.LogManager.GetLogger("logfatal");
|
||||||
|
|
||||||
|
private static LoggerHelper _obj = null;
|
||||||
|
private static string logPath = string.Empty;
|
||||||
|
private LoggerHelper()
|
||||||
|
{
|
||||||
|
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
|
||||||
|
string dllPath = codeBase.Replace("file:///", "");
|
||||||
|
dllPath = Path.GetDirectoryName(dllPath);
|
||||||
|
logPath = Path.Combine(dllPath, "Logs\\");
|
||||||
|
var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config"));
|
||||||
|
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前的日志记录<see cref="LoggerHelper"/>对象。
|
||||||
|
/// </summary>
|
||||||
|
public static LoggerHelper Current
|
||||||
|
{
|
||||||
|
get => _obj ?? (new LoggerHelper());
|
||||||
|
set => _obj = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Debug,调试
|
||||||
|
/// <summary>
|
||||||
|
/// 调试信息输出。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">需要记录的信息。</param>
|
||||||
|
public void Debug(string msg)
|
||||||
|
{
|
||||||
|
logdebug.Debug(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Info,信息
|
||||||
|
/// <summary>
|
||||||
|
/// 普通信息输出。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">需要记录的信息。</param>
|
||||||
|
public void Info(string msg)
|
||||||
|
{
|
||||||
|
loginfo.Info(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Warn,警告
|
||||||
|
/// <summary>
|
||||||
|
/// 警告级别信息输出。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">需要记录的信息。</param>
|
||||||
|
public void Warn(string msg)
|
||||||
|
{
|
||||||
|
logwarn.Warn(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Error,错误
|
||||||
|
/// <summary>
|
||||||
|
/// 错误级别信息输出。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">需要记录的信息。</param>
|
||||||
|
public void Error(string msg)
|
||||||
|
{
|
||||||
|
logerror.Error("----------------------------Error BEGIN------------------------------");
|
||||||
|
logerror.Error(msg);
|
||||||
|
logerror.Error("-----------------------------Error END-------------------------------");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Fatal,致命错误
|
||||||
|
/// <summary>
|
||||||
|
/// 致命错误级别信息输出。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg">需要记录的信息。</param>
|
||||||
|
/// <param name="err">需要记录的系统异常。</param>
|
||||||
|
public void Fatal(string msg)
|
||||||
|
{
|
||||||
|
logfatal.Fatal("----------------------------Fatal BEGIN------------------------------");
|
||||||
|
logerror.Fatal(msg);
|
||||||
|
logerror.Fatal("-----------------------------Fatal END-------------------------------");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 输出json日志
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 输出json日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="funName">json方法名</param>
|
||||||
|
/// <param name="json">json数据</param>
|
||||||
|
public void WriteJson(string funName, string json)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//json路径文件名 Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Logs\"
|
||||||
|
string filename = Path.Combine(logPath, funName + ".json");
|
||||||
|
//判断文件是否被打开占用
|
||||||
|
if (!FileHelper.IsFileLocked(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
string strJson = string.Empty;
|
||||||
|
if (json.StartsWith("["))
|
||||||
|
{
|
||||||
|
//格式化json数据 当前为组类型
|
||||||
|
JArray jobj = JArray.Parse(json);
|
||||||
|
strJson = jobj.ToString();
|
||||||
|
}
|
||||||
|
else if (json.StartsWith("{"))
|
||||||
|
{
|
||||||
|
//格式化json数据 当前为类类型
|
||||||
|
JObject jobj = JObject.Parse(json);
|
||||||
|
strJson = jobj.ToString();
|
||||||
|
}
|
||||||
|
//创建json文件,并输出数据
|
||||||
|
FileStream fs = new FileStream(filename, FileMode.Append);
|
||||||
|
StreamWriter wr = null;
|
||||||
|
wr = new StreamWriter(fs);
|
||||||
|
wr.WriteLine(strJson);
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
51
newFront/c#前端/DI-Electrical/Helper/PasswordHelper.cs
Normal file
51
newFront/c#前端/DI-Electrical/Helper/PasswordHelper.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.Xaml.Behaviors;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Helper
|
||||||
|
{
|
||||||
|
public class PasswordBoxBehavior : Behavior<RadPasswordBox>
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty PasswordProperty =
|
||||||
|
DependencyProperty.Register(nameof(Password), typeof(string), typeof(PasswordBoxBehavior),
|
||||||
|
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnPasswordChanged));
|
||||||
|
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(PasswordProperty); }
|
||||||
|
set { SetValue(PasswordProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAttached()
|
||||||
|
{
|
||||||
|
base.OnAttached();
|
||||||
|
AssociatedObject.PasswordChanged += OnPasswordChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDetaching()
|
||||||
|
{
|
||||||
|
base.OnDetaching();
|
||||||
|
AssociatedObject.PasswordChanged -= OnPasswordChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPasswordChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Password = AssociatedObject.Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is PasswordBoxBehavior behavior)
|
||||||
|
{
|
||||||
|
behavior.AssociatedObject.Password = e.NewValue as string ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
32
newFront/c#前端/DI-Electrical/Model/NoEntity/ConfigIni.cs
Normal file
32
newFront/c#前端/DI-Electrical/Model/NoEntity/ConfigIni.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
public class ConfigIni
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户名
|
||||||
|
/// </summary>
|
||||||
|
public string UserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 用户密码
|
||||||
|
/// </summary>
|
||||||
|
public string UserPs { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 项目id
|
||||||
|
/// </summary>
|
||||||
|
public string ProjectID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 服务器ip
|
||||||
|
/// </summary>
|
||||||
|
public string Address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 端口
|
||||||
|
/// </summary>
|
||||||
|
public string Port { get; set; }
|
||||||
|
}
|
||||||
|
}
|
11
newFront/c#前端/DI-Electrical/Model/NoEntity/PageModel.cs
Normal file
11
newFront/c#前端/DI-Electrical/Model/NoEntity/PageModel.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
public class PageModel<T>
|
||||||
|
{
|
||||||
|
public List<T> Rows { get; set; }
|
||||||
|
public int Total { get; set; }
|
||||||
|
public int Records { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
newFront/c#前端/DI-Electrical/Model/NoEntity/learunHttpRes.cs
Normal file
13
newFront/c#前端/DI-Electrical/Model/NoEntity/learunHttpRes.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// learun mvc标准的http返回结果
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class learunHttpRes<T>
|
||||||
|
{
|
||||||
|
public int code { get; set; }
|
||||||
|
public string info { get; set; }
|
||||||
|
public T data { get; set; }
|
||||||
|
}
|
||||||
|
}
|
22
newFront/c#前端/DI-Electrical/Model/NoEntity/loginRes.cs
Normal file
22
newFront/c#前端/DI-Electrical/Model/NoEntity/loginRes.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
public class loginRes
|
||||||
|
{
|
||||||
|
public string token { get; set; }
|
||||||
|
public string loginMark { get; set; }
|
||||||
|
public string account { get; set; }
|
||||||
|
public string userId { get; set; }
|
||||||
|
public string RealName { get; set; }
|
||||||
|
|
||||||
|
public string userPs { get; set; }
|
||||||
|
public string IsIOModuleAdmin { get; set; }
|
||||||
|
public string isFirstLogin { get; set; }
|
||||||
|
public string Department { get; set; }
|
||||||
|
}
|
||||||
|
}
|
438
newFront/c#前端/DI-Electrical/Model/ec_Wire_Group.cs
Normal file
438
newFront/c#前端/DI-Electrical/Model/ec_Wire_Group.cs
Normal file
@ -0,0 +1,438 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Models
|
||||||
|
{
|
||||||
|
public class ec_Wire_Group
|
||||||
|
{
|
||||||
|
public ec_Wire_Group()
|
||||||
|
{
|
||||||
|
//SoftTags = new List<ec_SofttagEntity>();
|
||||||
|
NewSoftTags = new List<ec_Wire_Group>();
|
||||||
|
//Status = WireGroupStatusEnum.New;
|
||||||
|
}
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 状态。比如“待删除的”。默认为New
|
||||||
|
/// 去找lr base dataitem数据字典的be_signalstate
|
||||||
|
/// </summary>
|
||||||
|
//[JsonConverter(typeof(SignalStatusConverter))]
|
||||||
|
public WireGroupStatusEnum Status { get; set; } = WireGroupStatusEnum.New;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 某一个输出的信号,可以关联多个输入的信号。关联的是<see cref="Wire_Group_ID"/>
|
||||||
|
/// </summary>
|
||||||
|
public string LinkedID { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string Wire_Group_ID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号名称(CH. No.)。
|
||||||
|
/// 1462,C列。
|
||||||
|
/// 8600,A列。
|
||||||
|
/// 如果是虚拟点。就是主信号+<see cref="Code"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Group_Name { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// ChannelID。ec_panel_channel里。
|
||||||
|
/// 如果为空,说明这个信号是关联前的状态(或者说未关联的状态)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ChannelID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 英文描述(Description)。
|
||||||
|
/// 1462,D列。
|
||||||
|
/// 8600,B列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Group_Desc_EN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 中文描述。
|
||||||
|
/// 8600,B列(第二行)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Group_Desc { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// (Signal_Type)信号类型,如4-20mA。
|
||||||
|
/// 1462,I列。
|
||||||
|
/// 8600,E列(模拟量)或F列(开关量)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string IO_Type { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号的分组(组成Group Name的第一部分)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Signal_Group { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 信号的序号(组成Group Name的第二部分)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Signal_SeqNo { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 信号组模板ID(平台上,savesignal时,不会带出这个)。
|
||||||
|
/// 只是公司级上才有意义。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string WireGroupTemplateID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 代码。
|
||||||
|
/// 1462,H列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Code { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Range_Min。
|
||||||
|
/// 1462,J列。
|
||||||
|
/// 8600,G列(111~222)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Range_Min { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Range_Max.
|
||||||
|
/// 1462,k列。
|
||||||
|
/// 8600,G列(111~222)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Range_Max { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Range_Min和Range_Max的单位。
|
||||||
|
/// 1462,L列。
|
||||||
|
/// 8600,H列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Unit { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Alarm_LL。
|
||||||
|
/// 1462,m列。
|
||||||
|
/// 8600,J列(第一行或第二行不确定)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Alarm_LL { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Alarm_L。
|
||||||
|
/// 1462,n列。
|
||||||
|
/// 8600,I列(第一行或第二行不确定)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Alarm_L { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Alarm_H。
|
||||||
|
/// 1462,o列。
|
||||||
|
/// 8600,I列(第一行或第二行不确定)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Alarm_H { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// Alarm_HH。
|
||||||
|
/// 1462,p列。
|
||||||
|
/// 8600,J列(第一行或第二行不确定)。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Alarm_HH { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// AL_GRP 延申报警组。
|
||||||
|
/// 1462,S列。
|
||||||
|
/// 8600,U列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string AL_GRP { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// BL_GRP 抑制报警。
|
||||||
|
/// 1462,T列。
|
||||||
|
/// 8600,T列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string BL_GRP { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 延时。
|
||||||
|
/// 1462,U列。
|
||||||
|
/// 8600,S列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Time_Delay { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 供应商。
|
||||||
|
/// 1463,V列。
|
||||||
|
/// 8600,L列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Supplier { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string EquipName { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 传感器代码。
|
||||||
|
/// 1462,W列。
|
||||||
|
/// 8600,K列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string SENSOR_CODE { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// VDR_Record。
|
||||||
|
/// 1462,X列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool VDR_Record { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为slow down信号。
|
||||||
|
/// 1462,Q列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool SLD { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为shut down信号。
|
||||||
|
/// 1462,R列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool SHD { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// Remarks。
|
||||||
|
/// 1462,Y列。
|
||||||
|
/// 8600,X列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Remarks { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号归属
|
||||||
|
/// true,代表该信号是电气进行最终审核确认;
|
||||||
|
/// false,代表该信号是轮机进行最终审核确认;
|
||||||
|
/// </summary>
|
||||||
|
public bool ElecOnly { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为通讯点。
|
||||||
|
/// 1462,通过<see cref="ec_Wire_GroupEntity.Remarks"/>里的文字判断
|
||||||
|
/// 8600,通过K列里的文字判断
|
||||||
|
/// </summary>
|
||||||
|
public bool CommunicationPoint { get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// ECC 。Bool类型数据库要么是int要么是bool
|
||||||
|
///// </summary>
|
||||||
|
//public bool ECC { get; set; } = false;
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// WCC
|
||||||
|
///// </summary>
|
||||||
|
//public bool WCC { get; set; } = false;
|
||||||
|
///// <summary>
|
||||||
|
///// BCC
|
||||||
|
///// </summary>
|
||||||
|
//public bool BCC { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// IO类型,AI AO DI DO
|
||||||
|
/// </summary>
|
||||||
|
public string InOrOut { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 驾驶室(控制台)。
|
||||||
|
/// 8600,M列。导入时,如果2行都有值,中间会|分开
|
||||||
|
/// </summary>
|
||||||
|
public string WHConsole { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 驾驶室(计算机)。
|
||||||
|
/// 8600,N列。导入时,如果2行都有值,中间会|分开
|
||||||
|
/// </summary>
|
||||||
|
public string WHCPU { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 集控室(控制台)。
|
||||||
|
/// 8600,O列。导入时,如果2行都有值,中间会|分开
|
||||||
|
/// </summary>
|
||||||
|
public string ECRConsole { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 集控室(计算机)。
|
||||||
|
/// 8600,P列(excel中,两行均有值时,以|分开)
|
||||||
|
/// </summary>
|
||||||
|
public string ECRCPU { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船舶办公室(控制台)。
|
||||||
|
/// 8600,Q列。导入时,如果2行都有值,中间会|分开
|
||||||
|
/// </summary>
|
||||||
|
public string ShipOfficeConsole { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船舶办公室(计算机)。
|
||||||
|
/// 8600,R列。导入时,如果2行都有值,中间会|分开
|
||||||
|
/// </summary>
|
||||||
|
public string ShipOfficeCPU { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 安全保护。(和<see cref="SLD"/> <see cref="SHD"/>列有关系)
|
||||||
|
/// 8600,V列。
|
||||||
|
/// </summary>
|
||||||
|
public string SafetyProt { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 安全保护延时。
|
||||||
|
/// 8600,V列下。
|
||||||
|
/// </summary>
|
||||||
|
public string SafetyDelay { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SeriousType
|
||||||
|
/// 1462,AG列。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string SeriousType { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动控制。
|
||||||
|
/// 8600,W列。
|
||||||
|
/// </summary>
|
||||||
|
public string AutoCtrl { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 爸爸。如果有值,则代表其为虚拟点的概念
|
||||||
|
/// <see cref="Wire_Group_ID"/>
|
||||||
|
/// </summary>
|
||||||
|
public string ParentID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 删除标记。因为哪怕是删除了,也要保留数据,以便日后查看。
|
||||||
|
/// </summary>
|
||||||
|
public bool DeleteFlg { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电缆位号(某些项目的<see cref="ec_projectSettingsEntity"/>里,是允许编辑的IO_allowManualAssign)
|
||||||
|
/// </summary>
|
||||||
|
public string CableName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯类信号<see cref="ec_CableEntity.CableClass"/>的母线ID<see cref="ec_CableEntity.CableID"/>
|
||||||
|
/// </summary>
|
||||||
|
public string CableId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
///// <summary>
|
||||||
|
///// 虚拟点 集合
|
||||||
|
///// </summary>
|
||||||
|
////[SugarColumn(IsIgnore = true)]
|
||||||
|
//[Obsolete]
|
||||||
|
//[Navigate(NavigateType.OneToMany, nameof(ec_SofttagEntity.Wire_Group_ID))] //配置了导航,方便DeleteNav,ec_softtag表中的wiregroupid
|
||||||
|
//public List<ec_SofttagEntity> SoftTags { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<ec_Wire_Group> NewSoftTags { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 柜子
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string PanelName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 通道号
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string ChannelName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 端子排
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string StripName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电缆对
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string CableSetName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// status的具体文字描述
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string StatusValue { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作历史(因为现在插件端的保存是一次性的。哪怕有多个动作,也只是一次提交)
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public List<ActionHistory> ActionHistorys { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号属性变更历史
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public List<ec_wire_group_propertyhis> Propertyhis { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号日志
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public List<ec_wire_group_log> Logs { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
public enum WireGroupStatusEnum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 待删除
|
||||||
|
/// </summary>
|
||||||
|
[Description("待删除")]
|
||||||
|
ToDelete = 01,
|
||||||
|
/// <summary>
|
||||||
|
/// 新增的
|
||||||
|
/// </summary>
|
||||||
|
[Description("新增的")]
|
||||||
|
New = 02,
|
||||||
|
/// <summary>
|
||||||
|
/// 已关联
|
||||||
|
/// </summary>
|
||||||
|
[Description("已使用(关联)")]
|
||||||
|
Used = 03,
|
||||||
|
/// <summary>
|
||||||
|
/// 已审核
|
||||||
|
/// </summary>
|
||||||
|
[Description("已确认(审核)")]
|
||||||
|
Confirmed = 04,
|
||||||
|
/// <summary>
|
||||||
|
/// 重新打开
|
||||||
|
/// </summary>
|
||||||
|
[Description("重新打开")]
|
||||||
|
Reopen = 05,
|
||||||
|
/// <summary>
|
||||||
|
/// 彻底删除
|
||||||
|
/// </summary>
|
||||||
|
[Description("彻底删除")]
|
||||||
|
deleted = 06
|
||||||
|
}
|
||||||
|
public class ActionHistory
|
||||||
|
{
|
||||||
|
public DateTime? ActionTime { get; set; }
|
||||||
|
public Action ActionType { get; set; }
|
||||||
|
public string reason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
81
newFront/c#前端/DI-Electrical/Model/ec_dataitemdetail.cs
Normal file
81
newFront/c#前端/DI-Electrical/Model/ec_dataitemdetail.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using DryIoc.ImTools;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Models
|
||||||
|
{
|
||||||
|
public class ec_dataitemdetail
|
||||||
|
{
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 字典明细ID
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string DataItemDetailID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 字典分类ID(存的是<see cref="ec_dataitemEntity.DataItemID"/>
|
||||||
|
/// </summary>
|
||||||
|
public string DataItemID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 上级字典明细ID。<see cref="DataItemDetailID"/>
|
||||||
|
/// </summary>
|
||||||
|
public string UpDataItemDetailID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 字典明细名称
|
||||||
|
/// </summary>
|
||||||
|
public string DataItemName { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 字典明细名称(英文)
|
||||||
|
/// </summary>
|
||||||
|
public string DataItemNameEN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 字典明细编号
|
||||||
|
/// </summary>
|
||||||
|
public string DataItemCode { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int? OrderID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否有效
|
||||||
|
/// </summary>
|
||||||
|
public int? IsEnabled { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string Remark { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
/// <summary>
|
||||||
|
/// 字典编号<see cref="ec_dataitemEntity.DataItemCode"/>。如Be_signal_group
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string ItemCode { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 信号
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public List<ec_Wire_Group> Signals { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
123
newFront/c#前端/DI-Electrical/Model/ec_project.cs
Normal file
123
newFront/c#前端/DI-Electrical/Model/ec_project.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 项目
|
||||||
|
/// </summary>
|
||||||
|
public class ec_project
|
||||||
|
{
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 项目ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ProjectId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 项目名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ProjectName { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目代号
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ProjectCode { get; set; } = "";
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 船检
|
||||||
|
///// </summary>
|
||||||
|
//public string ShipCheck { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船名(中文)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipNameCN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船名(英文)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipNameEN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船型(中文)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipTypeCN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船型(英文)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipTypeEN { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船级社(id)。和船检的概念有些冲突
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipSociety { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 船东
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ShipOwner { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 挂旗国(船籍国)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string FlagState { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// IMO编号
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string IMONumber { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目更多描述一
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Describe1 { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目更多描述二
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Describe2 { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目更多描述三
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Describe3 { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目更多描述四
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Describe4 { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目更多描述五
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Describe5 { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 项目序号
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int? ProjectIndex { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
95
newFront/c#前端/DI-Electrical/Model/ec_wire_group_log.cs
Normal file
95
newFront/c#前端/DI-Electrical/Model/ec_wire_group_log.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Models
|
||||||
|
{
|
||||||
|
public class ec_wire_group_log
|
||||||
|
{
|
||||||
|
public ec_wire_group_log()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public ec_wire_group_log(Action OperateType, string WireGroupID)
|
||||||
|
{
|
||||||
|
this.OperateType = OperateType;
|
||||||
|
this.WireGroupID = WireGroupID;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="OperateType"></param>
|
||||||
|
/// <param name="WireGroupID"></param>
|
||||||
|
/// <param name="createtime">因为<see cref="ec_Wire_GroupEntity.ActionHistorys"/>的关系,所以时间是有值的</param>
|
||||||
|
public ec_wire_group_log(Action OperateType, string WireGroupID, DateTime? createtime)
|
||||||
|
{
|
||||||
|
this.OperateType = OperateType;
|
||||||
|
this.WireGroupID = WireGroupID;
|
||||||
|
|
||||||
|
if (createtime != null)
|
||||||
|
{
|
||||||
|
this.CreateTime = createtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 操作日志ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string WireGroupLogID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 信号ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string WireGroupID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 操作类型
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public Action OperateType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ExtraMsg { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string CreateUserName { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
130
newFront/c#前端/DI-Electrical/Model/ec_wire_group_notice.cs
Normal file
130
newFront/c#前端/DI-Electrical/Model/ec_wire_group_notice.cs
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Models
|
||||||
|
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 动作。和状态是两码事情。
|
||||||
|
/// </summary>
|
||||||
|
public enum Action
|
||||||
|
{
|
||||||
|
|
||||||
|
新增 = 0,
|
||||||
|
修改 = 1,
|
||||||
|
准备删除 = 2,
|
||||||
|
撤销删除 = 3,
|
||||||
|
删除 = 4,
|
||||||
|
关联通道 = 5,
|
||||||
|
审核 = 6,
|
||||||
|
重新打开 = 7,
|
||||||
|
关联解除 = 8,
|
||||||
|
回收站恢复 = 9
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Department
|
||||||
|
{
|
||||||
|
轮机 = 0,
|
||||||
|
电气 = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ec_wire_group_notice
|
||||||
|
{
|
||||||
|
public ec_wire_group_notice()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action"></param>
|
||||||
|
/// <param name="departmentRetrieveNotice">接收方</param>
|
||||||
|
/// <param name="WireGroupID"></param>
|
||||||
|
public ec_wire_group_notice(Action action, Department departmentRetrieveNotice, string WireGroupID)
|
||||||
|
{
|
||||||
|
ActionID = action;
|
||||||
|
CompanyID = departmentRetrieveNotice;
|
||||||
|
this.WireGroupID = WireGroupID;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 信号表通知ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string WireGroupNoticeID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 信号ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string WireGroupID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 动作
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Action ActionID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 额外的消息(如删除时,必须要给一个删除理由)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Message { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 是否被确认。false未读。true已读。
|
||||||
|
/// </summary>
|
||||||
|
public bool CheckFLG { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 接收者的部门
|
||||||
|
/// </summary>
|
||||||
|
public Department CompanyID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人(也就是发起通知的人)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人(也就是确认这个消息已阅的人)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动作(描述)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Action { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批准人名字
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserName { get; set; }
|
||||||
|
#region 用于前端UI渲染,对应的信号的内容
|
||||||
|
public string Group_Name { get; set; }
|
||||||
|
public string Group_Desc { get; set; }
|
||||||
|
public string Group_Desc_EN { get; set; }
|
||||||
|
public string IO_Type { get; set; }
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Models
|
||||||
|
{
|
||||||
|
public class ec_wire_group_propertyhis
|
||||||
|
{
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 信号属性历史ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string WireGroupPropertyhisID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 信号ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string WireGroupID { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 属性名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string PropertyName { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 旧属性值
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string OldPropertyValue { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 新属性值
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string NewPropertyValue { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string CreateUserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 属性名称描述
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public string PropertyNameDec { get; set; } = "";
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
199
newFront/c#前端/DI-Electrical/Model/user.cs
Normal file
199
newFront/c#前端/DI-Electrical/Model/user.cs
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Model
|
||||||
|
{
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 用户主键
|
||||||
|
/// </summary>
|
||||||
|
public string F_UserId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工号
|
||||||
|
/// </summary>
|
||||||
|
public string F_EnCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 账户
|
||||||
|
/// </summary>
|
||||||
|
public string F_Account { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 登录密码
|
||||||
|
/// </summary>
|
||||||
|
public string F_Password { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 密码秘钥
|
||||||
|
/// </summary>
|
||||||
|
public string F_Secretkey { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 真实姓名
|
||||||
|
/// </summary>
|
||||||
|
public string F_RealName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 呢称
|
||||||
|
/// </summary>
|
||||||
|
public string F_NickName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
public string F_HeadIcon { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 快速查询
|
||||||
|
/// </summary>
|
||||||
|
public string F_QuickQuery { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 简拼
|
||||||
|
/// </summary>
|
||||||
|
public string F_SimpleSpelling { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 性别
|
||||||
|
/// </summary>
|
||||||
|
public int? F_Gender { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 生日
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_Birthday { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 手机
|
||||||
|
/// </summary>
|
||||||
|
public string F_Mobile { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
public string F_Telephone { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 电子邮件
|
||||||
|
/// </summary>
|
||||||
|
public string F_Email { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// QQ号
|
||||||
|
/// </summary>
|
||||||
|
public string F_OICQ { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 微信号
|
||||||
|
/// </summary>
|
||||||
|
public string F_WeChat { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// MSN
|
||||||
|
/// </summary>
|
||||||
|
public string F_MSN { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 公司或部门的主键<see cref="CompanyEntity.F_CompanyId"/>
|
||||||
|
/// </summary>
|
||||||
|
public string F_CompanyId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 部门主键
|
||||||
|
/// </summary>
|
||||||
|
public string F_DepartmentId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 安全级别
|
||||||
|
/// </summary>
|
||||||
|
public int? F_SecurityLevel { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单点登录标识
|
||||||
|
/// </summary>
|
||||||
|
public int? F_OpenId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 密码提示问题
|
||||||
|
/// </summary>
|
||||||
|
public string F_Question { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 密码提示答案
|
||||||
|
/// </summary>
|
||||||
|
public string F_AnswerQuestion { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 允许多用户同时登录
|
||||||
|
/// </summary>
|
||||||
|
public int? F_CheckOnLine { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 允许登录时间开始
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_AllowStartTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 允许登录时间结束
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_AllowEndTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 暂停用户开始日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_LockStartDate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 暂停用户结束日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_LockEndDate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 排序码
|
||||||
|
/// </summary>
|
||||||
|
public int? F_SortCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 删除标记
|
||||||
|
/// </summary>
|
||||||
|
public int? F_DeleteMark { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 有效标志
|
||||||
|
/// </summary>
|
||||||
|
public int? F_EnabledMark { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string F_Description { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_CreateDate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户主键
|
||||||
|
/// </summary>
|
||||||
|
public string F_CreateUserId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string F_CreateUserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? F_ModifyDate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户主键
|
||||||
|
/// </summary>
|
||||||
|
public string F_ModifyUserId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string F_ModifyUserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 密码更新时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? PasswordUpdateTime { get; set; }//add by chenkai 20210322
|
||||||
|
/// <summary>
|
||||||
|
/// 微信OpenId
|
||||||
|
/// </summary>
|
||||||
|
public string WX_OpenId { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 扩展属性
|
||||||
|
/// <summary>
|
||||||
|
/// 登录信息
|
||||||
|
/// </summary>
|
||||||
|
public string LoginMsg { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 登录状态
|
||||||
|
/// </summary>
|
||||||
|
public bool LoginOk { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 公司名称
|
||||||
|
/// </summary>
|
||||||
|
public string F_FullName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 岗位名称
|
||||||
|
/// </summary>
|
||||||
|
public string F_PostName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单位名称
|
||||||
|
/// </summary>
|
||||||
|
public string F_CompanyName { get { return F_FullName; } }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
52
newFront/c#前端/DI-Electrical/Properties/AssemblyInfo.cs
Normal file
52
newFront/c#前端/DI-Electrical/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("DI-Electrical")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("DI-Electrical")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//若要开始生成可本地化的应用程序,请设置
|
||||||
|
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
|
||||||
|
//在 <PropertyGroup> 中。例如,如果你使用的是美国英语。
|
||||||
|
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
|
||||||
|
//对以下 NeutralResourceLanguage 特性的注释。 更新
|
||||||
|
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||||
|
//(未在页面中找到资源时使用,
|
||||||
|
//或应用程序资源字典中找到时使用)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||||
|
//(未在页面中找到资源时使用,
|
||||||
|
//、应用程序或任何主题专用资源字典中找到时使用)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
newFront/c#前端/DI-Electrical/Properties/Resources.Designer.cs
generated
Normal file
71
newFront/c#前端/DI-Electrical/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本: 4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能导致不正确的行为,如果
|
||||||
|
// 重新生成代码,则所做更改将丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace DI_Electrical.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 强类型资源类,用于查找本地化字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DI_Electrical.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
newFront/c#前端/DI-Electrical/Properties/Resources.resx
Normal file
117
newFront/c#前端/DI-Electrical/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
newFront/c#前端/DI-Electrical/Properties/Settings.Designer.cs
generated
Normal file
30
newFront/c#前端/DI-Electrical/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace DI_Electrical.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
newFront/c#前端/DI-Electrical/Properties/Settings.settings
Normal file
7
newFront/c#前端/DI-Electrical/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
31
newFront/c#前端/DI-Electrical/Services/DataItemService.cs
Normal file
31
newFront/c#前端/DI-Electrical/Services/DataItemService.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class DataItemService : HttpService
|
||||||
|
{
|
||||||
|
public DataItemService( ) : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<ec_dataitemdetail>> GetDetails(string itemCode)
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<List<ec_dataitemdetail>>($"DataItemApi/GetDetails?projectId={GlobalObject.curProject.ProjectId}&itemCode={itemCode}");
|
||||||
|
//OnRefresh();
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;//ERROR INFO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
263
newFront/c#前端/DI-Electrical/Services/HttpService.cs
Normal file
263
newFront/c#前端/DI-Electrical/Services/HttpService.cs
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Helper;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class HttpService
|
||||||
|
{
|
||||||
|
public HttpService()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public void Init(string address, int port)
|
||||||
|
{
|
||||||
|
// 如果 GlobalObject.client 已经是 null,初始化一个新的 HttpClient 实例
|
||||||
|
//if (GlobalObject.client == null)
|
||||||
|
//{
|
||||||
|
GlobalObject.client = new HttpClient()
|
||||||
|
{
|
||||||
|
BaseAddress = new Uri($"http://{address}:{port}/api/"),
|
||||||
|
Timeout = TimeSpan.FromSeconds(120)
|
||||||
|
};
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// // 如果已经有 client 实例,则更新它的 BaseAddress
|
||||||
|
// GlobalObject.client.BaseAddress = new Uri($"http://{address}:{port}/api/");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 带入授权码。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClient"></param>
|
||||||
|
protected virtual void OnInitAuthorizationCode()
|
||||||
|
{
|
||||||
|
//httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows 10.0.22621.1265; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/110.0.835.163 Safari/535.1");
|
||||||
|
|
||||||
|
//if (AuthorizationCode.IsNullOrEmpty() || httpClient == null) return;
|
||||||
|
//httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + AuthorizationCode);
|
||||||
|
}
|
||||||
|
protected virtual void OnInitRequestHeader(HttpClient httpClient, string mediaType)
|
||||||
|
{
|
||||||
|
//httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(mediaType));
|
||||||
|
httpClient.DefaultRequestHeaders.Add("Accept", mediaType);
|
||||||
|
httpClient.DefaultRequestHeaders.Add("ContentType", mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteLog(string requestUri, string strJson)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var uri = new Uri(GlobalObject.client.BaseAddress + requestUri);
|
||||||
|
var funName = uri.Segments.Last();
|
||||||
|
LoggerHelper.Current.WriteJson(funName, strJson);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<learunHttpRes<T>> GetAsync<T>(string requestUri)
|
||||||
|
{
|
||||||
|
//httpClient.Timeout = TimeSpan.FromSeconds(3000);
|
||||||
|
OnInitAuthorizationCode();
|
||||||
|
string result = string.Empty;
|
||||||
|
learunHttpRes<T> resultObj = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await GlobalObject.client.GetAsync(requestUri);
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 获取数据失败, 返回HTTP代码:" + response.StatusCode;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
result = await response.Content.ReadAsStringAsync();
|
||||||
|
WriteLog(requestUri, result);
|
||||||
|
resultObj = JsonConvert.DeserializeObject<learunHttpRes<T>>(result);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
resultObj = new learunHttpRes<T>() { code = -100, info = errorMsg };
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string errorMsg = $"接口:{requestUri}失败,异常:{ex.Message} ";
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
resultObj = new learunHttpRes<T>() { code = -100, info=errorMsg };
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultObj.code != 200)
|
||||||
|
{
|
||||||
|
switch (resultObj.code)
|
||||||
|
{
|
||||||
|
case 400:
|
||||||
|
case 500:
|
||||||
|
break;
|
||||||
|
//业务错误,不是http本质错误
|
||||||
|
default:
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] Get失败, 返回自定义代码:" + resultObj.code;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
LoggerHelper.Current.Info($"Get成功:{requestUri}");
|
||||||
|
return resultObj;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task<T> GetAsyncByOnlyData<T>(string requestUri)
|
||||||
|
{
|
||||||
|
//httpClient.Timeout = TimeSpan.FromSeconds(3000);
|
||||||
|
OnInitAuthorizationCode();
|
||||||
|
string result = string.Empty;
|
||||||
|
T resultObj;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await GlobalObject.client.GetAsync(requestUri);
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 获取数据失败, 返回HTTP代码:" + response.StatusCode;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
result = await response.Content.ReadAsStringAsync();
|
||||||
|
WriteLog(requestUri, result);
|
||||||
|
resultObj = JsonConvert.DeserializeObject<T>(result);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new JsonException(errorMsg);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string errorMsg = $"接口:{requestUri}失败,异常:{ex.Message} ";
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new JsonException(errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoggerHelper.Current.Info($"Get成功:{requestUri}");
|
||||||
|
return resultObj;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">响应后的返回数据的类型</typeparam>
|
||||||
|
/// <typeparam name="T1">POST数据对象的类型</typeparam>
|
||||||
|
/// <param name="requestUri"></param>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="HttpRequestException"></exception>
|
||||||
|
/// <exception cref="JsonException"></exception>
|
||||||
|
public async Task<learunHttpRes<T>> PostBodyAsync<T, T1>(string requestUri, T1 postObj)
|
||||||
|
{
|
||||||
|
OnInitAuthorizationCode();
|
||||||
|
|
||||||
|
string contentType = "application/json";
|
||||||
|
string strContent = postObj != null ? JsonConvert.SerializeObject(postObj) : "";
|
||||||
|
var content = new StringContent(strContent, Encoding.UTF8, contentType);
|
||||||
|
OnInitRequestHeader(GlobalObject.client, contentType);
|
||||||
|
learunHttpRes<T> resultObj = null;
|
||||||
|
string result = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await GlobalObject.client.PostAsync(requestUri, content);
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] Post数据失败, 返回HTTP代码:" + response.StatusCode;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
result = await response.Content.ReadAsStringAsync();
|
||||||
|
WriteLog(requestUri, result);
|
||||||
|
resultObj = JsonConvert.DeserializeObject<learunHttpRes<T>>(result);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
resultObj = new learunHttpRes<T>() { code = -100, info = errorMsg };
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string errorMsg = $"接口:{requestUri}失败,参数数据为:{strContent},异常:{ex.Message} ";
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
resultObj = new learunHttpRes<T>() { code = -100, info = errorMsg };
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultObj.code != 200)
|
||||||
|
{
|
||||||
|
switch (resultObj.code)
|
||||||
|
{
|
||||||
|
case 400:
|
||||||
|
case 500:
|
||||||
|
break;
|
||||||
|
//业务错误,不是http本质错误
|
||||||
|
default:
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] Post失败, 返回自定义代码:" + resultObj.code;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
LoggerHelper.Current.Info($"Post成功:{requestUri}");
|
||||||
|
return resultObj;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<T> PostFileAsync<T>(string requestUri, Stream stream, string fileName)
|
||||||
|
{
|
||||||
|
OnInitAuthorizationCode();
|
||||||
|
|
||||||
|
string contentType = "multipart/form-data";
|
||||||
|
var streamContent = new StreamContent(stream, (int)stream.Length);
|
||||||
|
streamContent.Headers.Add("Content-Type", "application/octet-stream");
|
||||||
|
var content = new MultipartFormDataContent
|
||||||
|
{
|
||||||
|
{ streamContent, "file", fileName }
|
||||||
|
};
|
||||||
|
OnInitRequestHeader(GlobalObject.client, contentType);
|
||||||
|
var response = await GlobalObject.client.PostAsync(requestUri, content);
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] Post数据失败, 返回HTTP代码:" + response.StatusCode;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
|
T resultObj;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resultObj = JsonConvert.DeserializeObject<T>(result);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{requestUri}] 解析为 string 失败,原始返回数据为: " + result;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new JsonException(errorMsg);
|
||||||
|
}
|
||||||
|
LoggerHelper.Current.Info($"Post上传文件成功:{requestUri}");
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
50
newFront/c#前端/DI-Electrical/Services/LoginService.cs
Normal file
50
newFront/c#前端/DI-Electrical/Services/LoginService.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
using EasyEncryption;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class LoginService : HttpService
|
||||||
|
{
|
||||||
|
public LoginService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> Login(string userName, string passwordOrigin)
|
||||||
|
{
|
||||||
|
|
||||||
|
var password = MD5.ComputeMD5Hash(passwordOrigin); //B156525AFDB610B9D6830A1E9D0A1024
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<object>($"LoginApi/CheckLogin?username={userName}&password={password}");
|
||||||
|
//OnRefresh();
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
GlobalObject.userInfo = JsonConvert.DeserializeObject<loginRes>(res.data.ToString());// as loginRes;
|
||||||
|
GlobalObject.userInfo.userPs = passwordOrigin;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return res.info;//ERROR INFO
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (HttpRequestException EX)
|
||||||
|
{
|
||||||
|
return "http错误。无法连接上服务器。请检查服务器 和 端口。" + EX.Message;
|
||||||
|
}
|
||||||
|
catch (Exception E)
|
||||||
|
{
|
||||||
|
return E.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
50
newFront/c#前端/DI-Electrical/Services/ProjectService.cs
Normal file
50
newFront/c#前端/DI-Electrical/Services/ProjectService.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class ProjectService : HttpService
|
||||||
|
{
|
||||||
|
public ProjectService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PageModel<ec_project>> GetProjects(int pageNo, int pageSize)
|
||||||
|
{
|
||||||
|
|
||||||
|
var res = await this.GetAsync<PageModel<ec_project>>($"ProjectApi/GetProjectSelectPageList?pageNo={pageNo}&pageSize={pageSize}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件端选择项目后,统一、整合加载左侧面板里的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projectId"></param>
|
||||||
|
/// <param name="userName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<JToken> InitProjInfo(string projectId, string userName)
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<object>($"ProjectApi/InitProjInfo?ProjId={projectId}&User={userName}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
var o = res.data as JToken;
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
newFront/c#前端/DI-Electrical/Services/UserService.cs
Normal file
26
newFront/c#前端/DI-Electrical/Services/UserService.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class UserService : HttpService
|
||||||
|
{
|
||||||
|
public UserService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public async Task GetList()
|
||||||
|
{
|
||||||
|
|
||||||
|
var res = await this.GetAsync<List<User>>($"UserApi/GetList");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
GlobalObject.Users = res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
170
newFront/c#前端/DI-Electrical/Services/WireGroupService.cs
Normal file
170
newFront/c#前端/DI-Electrical/Services/WireGroupService.cs
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Services
|
||||||
|
{
|
||||||
|
public class WireGroupService : HttpService
|
||||||
|
{
|
||||||
|
#region 辅助类
|
||||||
|
/// <summary>
|
||||||
|
/// SaveSignals 专用
|
||||||
|
/// </summary>
|
||||||
|
public class WireGroups
|
||||||
|
{
|
||||||
|
public string ID { get; set; }
|
||||||
|
public List<ec_Wire_Group> Signals { get; set; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
public WireGroupService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有的信号
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <param name="Assigned"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_Wire_Group>> GetSignals(string projId, bool Assigned)
|
||||||
|
{
|
||||||
|
|
||||||
|
var res = await this.GetAsync<List<ec_Wire_Group>>($"WireGroupApi/GetSignals?projId={projId}&Assigned={Assigned}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前组可用的编码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="group"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> GetNextAvailableSeq(string group)
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<object>($"WireGroupApi/GetNextAvailableSeq?projId={GlobalObject.curProject?.ProjectId}&group={group}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.info;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证是否可以保存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> CanSaveSignals(WireGroups entity ,Models.Action ActionType)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<List<ec_Wire_Group>, WireGroups>($"WireGroupApi/CanSaveSignals?projId={GlobalObject.curProject?.ProjectId}&ActionType={ActionType}", entity);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return res.info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 保存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_Wire_Group>> SaveSignals(WireGroups entity)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<List<ec_Wire_Group>, WireGroups>($"WireGroupApi/SaveSignals?projId={GlobalObject.curProject?.ProjectId}&mode=0", entity);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询信号信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_wire_group_notice>> GetNotification()
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<List<ec_wire_group_notice>>($"WireGroupApi/GetNotification?projId={GlobalObject.curProject?.ProjectId}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询信号历史
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId">项目ID</param>
|
||||||
|
/// <param name="wireGroupIds">信号ID,多个用都逗号隔开</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_wire_group_propertyhis>> GetSignalPropertyhis(string wireGroupIds)
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<List<ec_wire_group_propertyhis>>($"WireGroupApi/GetSignalPropertyhis?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询信号日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId">项目ID</param>
|
||||||
|
/// <param name="wireGroupIds">信号ID,多个用都逗号隔开</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_wire_group_log>> GetSignalLogs(string wireGroupIds)
|
||||||
|
{
|
||||||
|
var res = await this.GetAsync<List<ec_wire_group_log>>($"WireGroupApi/GetSignalLogs?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读信号通知
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="NoticeIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_wire_group_notice>> ReadNotification(List<string> NoticeIds)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<List<ec_wire_group_notice>,List<string>>($"WireGroupApi/ReadNotification?projId={GlobalObject.curProject?.ProjectId}", NoticeIds);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
552
newFront/c#前端/DI-Electrical/Style/CustomStyles.xaml
Normal file
552
newFront/c#前端/DI-Electrical/Style/CustomStyles.xaml
Normal file
@ -0,0 +1,552 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.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>
|
||||||
|
|
||||||
|
<!-- 系统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="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 TargetType="{x:Type local:IconButton}">
|
||||||
|
<Setter Property="Padding" Value="5" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type local:IconButton}">
|
||||||
|
<Grid>
|
||||||
|
<!-- 背景层 -->
|
||||||
|
<Border
|
||||||
|
x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="3" />
|
||||||
|
|
||||||
|
<DockPanel>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 图标层 -->
|
||||||
|
<Path
|
||||||
|
x:Name="PART_Icon"
|
||||||
|
Width="{TemplateBinding IconSize}"
|
||||||
|
Height="{TemplateBinding IconSize}"
|
||||||
|
Margin="{TemplateBinding IconMargin}"
|
||||||
|
Data="{TemplateBinding IconData}"
|
||||||
|
DockPanel.Dock="{TemplateBinding IconPlacement}"
|
||||||
|
Fill="{TemplateBinding Foreground}"
|
||||||
|
Stretch="Uniform" />
|
||||||
|
<!-- 内容层 -->
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_Content"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
RecognizesAccessKey="True" />
|
||||||
|
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<!-- 鼠标悬停效果 -->
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" />
|
||||||
|
</Trigger>
|
||||||
|
|
||||||
|
<!-- 按下效果 -->
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 多选搜索 Combox Start -->
|
||||||
|
<ExponentialEase x:Key="ExponentialEaseOut" EasingMode="EaseOut" />
|
||||||
|
<DropShadowEffect
|
||||||
|
x:Key="PopupShadowDepth"
|
||||||
|
BlurRadius="12"
|
||||||
|
Opacity="0.1"
|
||||||
|
ShadowDepth="2"
|
||||||
|
Color="Transparent" />
|
||||||
|
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
|
||||||
|
<Border Background="{TemplateBinding Background}" Focusable="False">
|
||||||
|
<ScrollViewer
|
||||||
|
x:Name="PART_ContentHost"
|
||||||
|
Background="Transparent"
|
||||||
|
Focusable="False"
|
||||||
|
HorizontalScrollBarVisibility="Hidden"
|
||||||
|
VerticalScrollBarVisibility="Hidden" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
<Color x:Key="PlaceholderTextColor" po:Freeze="True">#C0C4CC</Color>
|
||||||
|
<Geometry x:Key="ChevronDownGeometry" po:Freeze="True">M998 352c0 -8 -4 -17 -10 -23l-50 -50c-6 -6 -14 -10 -23 -10c-8 0 -17 4 -23 10l-393 393l-393 -393c-6 -6 -15 -10 -23 -10s-17 4 -23 10l-50 50c-6 6 -10 15 -10 23s4 17 10 23l466 466c6 6 15 10 23 10s17 -4 23 -10l466 -466c6 -6 10 -15 10 -23z</Geometry>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="ComboBoxToggleButton1" TargetType="{x:Type ToggleButton}">
|
||||||
|
<Border
|
||||||
|
x:Name="PART_Border"
|
||||||
|
Padding="6,1.2"
|
||||||
|
BorderThickness="0"
|
||||||
|
SnapsToDevicePixels="true">
|
||||||
|
<Grid Background="Transparent">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="30" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="30"
|
||||||
|
Height="Auto"
|
||||||
|
Margin="0,1"
|
||||||
|
Fill="{TemplateBinding Background}" />
|
||||||
|
<Path
|
||||||
|
x:Name="PART_Arrow"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="10"
|
||||||
|
Height="6"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Data="{StaticResource ChevronDownGeometry}"
|
||||||
|
RenderTransformOrigin=".5,.5"
|
||||||
|
Stretch="Fill">
|
||||||
|
<Path.Fill>
|
||||||
|
<SolidColorBrush Color="{DynamicResource PlaceholderTextColor}" />
|
||||||
|
</Path.Fill>
|
||||||
|
<Path.RenderTransform>
|
||||||
|
<RotateTransform Angle="0" />
|
||||||
|
</Path.RenderTransform>
|
||||||
|
</Path>
|
||||||
|
</Grid>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="MouseOver" />
|
||||||
|
<VisualState x:Name="Pressed" />
|
||||||
|
<VisualState x:Name="Disabled" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="CheckStates">
|
||||||
|
<VisualState x:Name="Checked">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||||||
|
Storyboard.TargetName="PART_Arrow"
|
||||||
|
Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
|
||||||
|
To="-180"
|
||||||
|
Duration="00:00:.3" />
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Unchecked">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||||||
|
Storyboard.TargetName="PART_Arrow"
|
||||||
|
Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
|
||||||
|
To="0"
|
||||||
|
Duration="00:00:.3" />
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Indeterminate" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
<Style x:Key="DefaultListBox" TargetType="{x:Type ListBox}">
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type ListBox}">
|
||||||
|
<Border
|
||||||
|
x:Name="Border"
|
||||||
|
Margin="{TemplateBinding Margin}"
|
||||||
|
Padding="0,0,0,.1"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
SnapsToDevicePixels="True">
|
||||||
|
<ScrollViewer Clip="{Binding RelativeSource={RelativeSource AncestorType=local:WDBorder}, Path=ContentClip}" Focusable="False">
|
||||||
|
<VirtualizingStackPanel IsItemsHost="True" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsGrouping" Value="True">
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="DefaultMultiSelectComboBoxItem" TargetType="{x:Type local:MultiSelectComboBoxItem}">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource RegularTextSolidColorBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<Setter Property="Height" Value="34" />
|
||||||
|
<Setter Property="Margin" Value="1,0" />
|
||||||
|
<Setter Property="Padding" Value="6,0" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBoxItem}">
|
||||||
|
|
||||||
|
<Border
|
||||||
|
x:Name="PART_Border"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
SnapsToDevicePixels="true">
|
||||||
|
<CheckBox
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="PART_ContentPresenter"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||||
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||||
|
</CheckBox>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DefaultBackgroundSolidColorBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type local:MultiSelectSearchComboBox}">
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BaseSolidColorBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource BackgroundSolidColorBrush}" />
|
||||||
|
<Setter Property="Padding" Value="14.5,3,30,3" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type local:MultiSelectSearchComboBox}">
|
||||||
|
<ControlTemplate.Resources>
|
||||||
|
<Storyboard x:Key="OpenStoryboard">
|
||||||
|
<DoubleAnimation
|
||||||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||||||
|
Storyboard.TargetName="PART_DropDown"
|
||||||
|
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
|
||||||
|
To="1"
|
||||||
|
Duration="00:00:.2" />
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="CloseStoryboard">
|
||||||
|
<DoubleAnimation
|
||||||
|
EasingFunction="{StaticResource ExponentialEaseOut}"
|
||||||
|
Storyboard.TargetName="PART_DropDown"
|
||||||
|
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
|
||||||
|
To="0"
|
||||||
|
Duration="00:00:.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</ControlTemplate.Resources>
|
||||||
|
<Border
|
||||||
|
Name="PART_Border"
|
||||||
|
Width="{TemplateBinding Width}"
|
||||||
|
Height="{TemplateBinding Height}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
SnapsToDevicePixels="True">
|
||||||
|
<Grid Grid.IsSharedSizeScope="true">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox
|
||||||
|
Name="PART_EditableTextBox"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Panel.ZIndex="1"
|
||||||
|
Background="Transparent"
|
||||||
|
Focusable="True"
|
||||||
|
Foreground="{DynamicResource PrimaryTextSolidColorBrush}"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SelectionBrush="{DynamicResource WindowBorderBrushSolidColorBrush}"
|
||||||
|
Style="{x:Null}"
|
||||||
|
Template="{StaticResource ComboBoxTextBox}"
|
||||||
|
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
|
||||||
|
<TextBlock
|
||||||
|
x:Name="PART_Watermark"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Background="Transparent"
|
||||||
|
FontSize="{TemplateBinding FontSize}"
|
||||||
|
Foreground="{DynamicResource RegularTextSolidColorBrush}"
|
||||||
|
IsHitTestVisible="False"
|
||||||
|
Text="{Binding Path=(local:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
Visibility="Collapsed" />
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="PART_ToggleButton"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Panel.ZIndex="2"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
ClickMode="Release"
|
||||||
|
Focusable="False"
|
||||||
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
Style="{x:Null}"
|
||||||
|
Template="{StaticResource ComboBoxToggleButton1}" />
|
||||||
|
<Popup
|
||||||
|
x:Name="PART_Popup"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||||
|
Placement="Bottom"
|
||||||
|
PlacementTarget="{Binding ElementName=PART_Border}"
|
||||||
|
StaysOpen="False">
|
||||||
|
<local:SmallPanel
|
||||||
|
x:Name="PART_DropDown"
|
||||||
|
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
|
||||||
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
|
Margin="24,2,24,24"
|
||||||
|
RenderTransformOrigin=".5,0"
|
||||||
|
SnapsToDevicePixels="True">
|
||||||
|
<local:SmallPanel.RenderTransform>
|
||||||
|
<ScaleTransform ScaleY="0" />
|
||||||
|
</local:SmallPanel.RenderTransform>
|
||||||
|
<Border
|
||||||
|
Name="PART_DropDownBorder"
|
||||||
|
Background="White"
|
||||||
|
BorderBrush="Blue"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
Effect="{StaticResource PopupShadowDepth}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
UseLayoutRounding="True" />
|
||||||
|
<Grid Margin="0,8" ClipToBounds="False">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox
|
||||||
|
x:Name="PART_TextBox"
|
||||||
|
Height="{Binding ElementName=PART_EditableTextBox, Path=Height}"
|
||||||
|
Margin="6,0"
|
||||||
|
local:ElementHelper.CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
local:ElementHelper.IsClear="True"
|
||||||
|
local:ElementHelper.Watermark="{Binding SearchWatermark, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||||
|
FontSize="{Binding ElementName=PART_EditableTextBox, Path=FontSize}" />
|
||||||
|
<CheckBox
|
||||||
|
x:Name="PART_SelectAll"
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="4"
|
||||||
|
local:ElementHelper.CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
Content="{TemplateBinding SelectAllContent}"
|
||||||
|
Visibility="{TemplateBinding IsSelectAllActive}" />
|
||||||
|
<local:MultiSelectListBox
|
||||||
|
x:Name="PART_Selector"
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="1,0"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
local:ElementHelper.CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
|
||||||
|
ItemContainerStyle="{StaticResource DefaultMultiSelectComboBoxItem}"
|
||||||
|
ItemsSource="{TemplateBinding ItemsSource}"
|
||||||
|
ScrollViewer.CanContentScroll="{Binding ScrollViewer.CanContentScroll, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="{Binding ScrollViewer.HorizontalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
SelectedValuePath="{TemplateBinding SelectedValuePath}"
|
||||||
|
SelectionMode="Multiple"
|
||||||
|
Style="{StaticResource DefaultListBox}" />
|
||||||
|
<local:MultiSelectListBox
|
||||||
|
x:Name="PART_SearchSelector"
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="1,0"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
local:ElementHelper.CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
|
||||||
|
ItemContainerStyle="{StaticResource DefaultMultiSelectComboBoxItem}"
|
||||||
|
ItemsSource="{TemplateBinding ItemsSourceSearch}"
|
||||||
|
ScrollViewer.CanContentScroll="{Binding ScrollViewer.CanContentScroll, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="{Binding ScrollViewer.HorizontalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
SelectedValuePath="{TemplateBinding SelectedValuePath}"
|
||||||
|
SelectionMode="Multiple"
|
||||||
|
Style="{StaticResource DefaultListBox}"
|
||||||
|
Visibility="Collapsed" />
|
||||||
|
</Grid>
|
||||||
|
</local:SmallPanel>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard x:Name="BeginStoryboardOpenStoryboard" Storyboard="{StaticResource OpenStoryboard}" />
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<StopStoryboard BeginStoryboardName="BeginStoryboardOpenStoryboard" />
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="False">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard x:Name="BeginStoryboardCloseStoryboard" Storyboard="{StaticResource CloseStoryboard}" />
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<StopStoryboard BeginStoryboardName="BeginStoryboardCloseStoryboard" />
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{DynamicResource PrimaryNormalSolidColorBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger SourceName="PART_Popup" Property="AllowsTransparency" Value="True">
|
||||||
|
<Setter TargetName="PART_DropDownBorder" Property="Margin" Value="0,2,0,0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Text" Value="">
|
||||||
|
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Text" Value="{x:Null}">
|
||||||
|
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelectAllActive" Value="False">
|
||||||
|
<Setter TargetName="PART_TextBox" Property="Margin" Value="6,2" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<!-- 多选搜索 Combox End -->
|
||||||
|
</ResourceDictionary>
|
@ -0,0 +1,82 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Style
|
||||||
|
{
|
||||||
|
internal class ConditionalStyleSelector:StyleSelector
|
||||||
|
{
|
||||||
|
public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container)
|
||||||
|
{
|
||||||
|
//获取到转换器返回的值
|
||||||
|
object conditionValue = this.ConditionConverter.Convert(item, null, null, null);
|
||||||
|
foreach (ConditionalStyleRule rule in this.Rules)
|
||||||
|
{
|
||||||
|
//值相同则返回当前样式
|
||||||
|
if (Equals(rule.Value, conditionValue))
|
||||||
|
{
|
||||||
|
return rule.Style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SelectStyle(item, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ConditionalStyleRule> _Rules;
|
||||||
|
public List<ConditionalStyleRule> Rules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (this._Rules == null)
|
||||||
|
{
|
||||||
|
this._Rules = new List<ConditionalStyleRule>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._Rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IValueConverter _ConditionConverter;
|
||||||
|
public IValueConverter ConditionConverter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this._ConditionConverter;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._ConditionConverter = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ConditionalStyleRule
|
||||||
|
{
|
||||||
|
object _Value;
|
||||||
|
public object Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this._Value;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Windows.Style _Style;
|
||||||
|
public System.Windows.Style Style
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this._Style;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._Style = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Style
|
||||||
|
{
|
||||||
|
internal class SignalNoticeStyleSelector:StyleSelector
|
||||||
|
{
|
||||||
|
public override System.Windows.Style SelectStyle(object item, DependencyObject container)
|
||||||
|
{
|
||||||
|
SignalNotice conditionValue = item as SignalNotice;
|
||||||
|
string value = conditionValue.CheckFLG.ToString();
|
||||||
|
foreach (ConditionalStyleRule rule in this.Rules)
|
||||||
|
{
|
||||||
|
//值相同则返回当前样式
|
||||||
|
if (Equals(rule.Value, value))
|
||||||
|
{
|
||||||
|
return rule.Style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return base.SelectStyle(item, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ConditionalStyleRule> _Rules;
|
||||||
|
public List<ConditionalStyleRule> Rules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (this._Rules == null)
|
||||||
|
{
|
||||||
|
this._Rules = new List<ConditionalStyleRule>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._Rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
98
newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs
Normal file
98
newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using DI_Electrical.Helper;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class ConfigViewModel : DialogBase
|
||||||
|
{
|
||||||
|
private string address;
|
||||||
|
public string Address
|
||||||
|
{
|
||||||
|
get { return this.address; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.address)
|
||||||
|
{
|
||||||
|
this.address = value;
|
||||||
|
RaisePropertyChanged(nameof(Address));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int port;
|
||||||
|
public int Port
|
||||||
|
{
|
||||||
|
get { return this.port; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.port)
|
||||||
|
{
|
||||||
|
this.port = value;
|
||||||
|
RaisePropertyChanged(nameof(Port));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _directory;
|
||||||
|
public string Directory
|
||||||
|
{
|
||||||
|
get { return this._directory; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this._directory)
|
||||||
|
{
|
||||||
|
this._directory = value;
|
||||||
|
RaisePropertyChanged(nameof(Directory));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ConfigService _configService;
|
||||||
|
LoginService _LoginService;
|
||||||
|
public ConfigViewModel(ConfigService configService, LoginService loginService) : base()
|
||||||
|
{
|
||||||
|
title = "设置";
|
||||||
|
_configService = configService;
|
||||||
|
_LoginService = loginService;
|
||||||
|
_configService.Read(out address, out port, out _directory);
|
||||||
|
}
|
||||||
|
public override async void ExecuteOKCommandAsync(object obj)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Directory))
|
||||||
|
{
|
||||||
|
MessageBox.Show("本地文件目录不能为空。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!System.IO.Directory.Exists(Directory))
|
||||||
|
{
|
||||||
|
MessageBox.Show("本地文件目录不存在。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var data = _configService.parser.ReadFile(_configService.path);
|
||||||
|
|
||||||
|
_configService._httpService.Init(address, port);
|
||||||
|
IsBusy = true;
|
||||||
|
BusyContent = "保存中...";
|
||||||
|
var testRes = await _LoginService.Login("1", "11");
|
||||||
|
IsBusy = false;
|
||||||
|
if (testRes.StartsWith("http错误。"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("无法连接上服务器。请检查服务器 和 端口。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (address.StartsWith("http"))
|
||||||
|
{
|
||||||
|
address = address.Replace("https://", "").Replace("http://", "");
|
||||||
|
}
|
||||||
|
data["Profile"]["Address"] = address;
|
||||||
|
data["Profile"]["Port"] = port.ToString();
|
||||||
|
data["Profile"]["Directory"] = _directory;
|
||||||
|
_configService.parser.WriteFile(_configService.path, data);
|
||||||
|
GlobalObject.isConfigIniCreateBySys = false;
|
||||||
|
GlobalObject.SetLocalFileDirectory(_directory);
|
||||||
|
|
||||||
|
CloseWindowAction?.Invoke();//关闭
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogInputViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
|
||||||
|
public DialogInputViewModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _TextInfo;
|
||||||
|
/// <summary>
|
||||||
|
/// 文本内容
|
||||||
|
/// </summary>
|
||||||
|
public string TextInfo
|
||||||
|
{
|
||||||
|
get { return _TextInfo; }
|
||||||
|
set { _TextInfo = value; RaisePropertyChanged(nameof(TextInfo)); }
|
||||||
|
}
|
||||||
|
private string _TextRemark;
|
||||||
|
/// <summary>
|
||||||
|
/// 注释
|
||||||
|
/// </summary>
|
||||||
|
public string TextRemark
|
||||||
|
{
|
||||||
|
get { return _TextRemark; }
|
||||||
|
set { _TextRemark = value; RaisePropertyChanged(nameof(TextRemark)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IDialogAware.Title => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
|
||||||
|
TextRemark = parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
|
||||||
|
}
|
||||||
|
public override void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}");
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
IDialogParameters par = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.No, par);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,423 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
using Prism.Ioc;
|
||||||
|
//using DI_Electrical.Views.Dialog.DialogSignalManagements;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogSignalNoticeViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
#region 属性
|
||||||
|
private ObservableCollection<SignalNotice> _MySignalNotices = new ObservableCollection<SignalNotice>();
|
||||||
|
/// <summary>
|
||||||
|
/// 表格数据源
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<SignalNotice> MySignalNotices
|
||||||
|
{
|
||||||
|
get { return _MySignalNotices; }
|
||||||
|
set { _MySignalNotices = value; RaisePropertyChanged(nameof(MySignalNotices)); }
|
||||||
|
}
|
||||||
|
private SignalNotice _SelectedSignalNotice;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中行
|
||||||
|
/// </summary>
|
||||||
|
public SignalNotice SelectedSignalNotice
|
||||||
|
{
|
||||||
|
get { return _SelectedSignalNotice; }
|
||||||
|
set { _SelectedSignalNotice = value; RaisePropertyChanged(nameof(SelectedSignalNotice)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号接口服务
|
||||||
|
/// </summary>
|
||||||
|
WireGroupService _wireGroupService;
|
||||||
|
|
||||||
|
//public DialogSignalNotice SignalNoticeView { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public DialogSignalNoticeViewModel(IContainerProvider container)
|
||||||
|
{
|
||||||
|
title = "通知信息";
|
||||||
|
_wireGroupService = container.Resolve<WireGroupService>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ec_wire_group_notice> SignalNotices;
|
||||||
|
public async void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
SignalNotices = await _wireGroupService.GetNotification();
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in SignalNotices)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
SignalNotice s= new SignalNotice(item);
|
||||||
|
s.ID = index;
|
||||||
|
MySignalNotices.Add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public override void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
//res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}");
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
//if (parameter as string == "ClickNo")
|
||||||
|
//{
|
||||||
|
// RequestClose.Invoke(ButtonResult.No);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// RequestClose.Invoke(ButtonResult.Cancel);
|
||||||
|
//}
|
||||||
|
//this.Dispose();
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.No, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 状态按钮
|
||||||
|
public ICommand StatusButtonCmd => new DelegateCommand(StatusButton_Click);
|
||||||
|
/// <summary>
|
||||||
|
/// 显示状态按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual async void StatusButton_Click(object parameter)
|
||||||
|
{
|
||||||
|
MySignalNotices = new ObservableCollection<SignalNotice>();
|
||||||
|
|
||||||
|
SignalNotices = await _wireGroupService.GetNotification();
|
||||||
|
if (!parameter.Equals("All"))
|
||||||
|
{
|
||||||
|
SignalNotices = SignalNotices.Where(s => s.CheckFLG.ToString().Equals(parameter)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in SignalNotices)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
SignalNotice s = new SignalNotice(item);
|
||||||
|
s.ID = index;
|
||||||
|
MySignalNotices.Add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 右侧按钮
|
||||||
|
|
||||||
|
public ICommand ButtonCmd => new DelegateCommand(Button_Click);
|
||||||
|
|
||||||
|
string IDialogAware.Title => throw new NotImplementedException();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 页面右侧按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual async void Button_Click(object parameter)
|
||||||
|
{
|
||||||
|
#region 确定
|
||||||
|
if (parameter.Equals("确定"))
|
||||||
|
{
|
||||||
|
List<string> noticeIds = new List<string>();
|
||||||
|
foreach (var item in MySignalNotices)
|
||||||
|
{
|
||||||
|
noticeIds = MySignalNotices.Where(e => e.IsModified == true).Select(e => e.WireGroupNoticeID).ToList();
|
||||||
|
}
|
||||||
|
List<ec_wire_group_notice> ReNotices = await _wireGroupService.ReadNotification(noticeIds);
|
||||||
|
foreach (var item in ReNotices)
|
||||||
|
{
|
||||||
|
var ent = MySignalNotices.FirstOrDefault(x => x.WireGroupNoticeID == item.WireGroupNoticeID);
|
||||||
|
if (ent != null)
|
||||||
|
{
|
||||||
|
ent.UpdateTime = item.UpdateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 取消
|
||||||
|
if (parameter.Equals("取消"))
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Cancel, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 已阅
|
||||||
|
if (parameter.Equals("已阅"))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (SelectedSignalNotice == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!SelectedSignalNotice.CheckFLG)
|
||||||
|
{
|
||||||
|
SelectedSignalNotice.CheckFLG = true;
|
||||||
|
SelectedSignalNotice.IsModified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 全部已阅
|
||||||
|
if (parameter.Equals("全部已阅"))
|
||||||
|
{
|
||||||
|
foreach (var item in MySignalNotices)
|
||||||
|
{
|
||||||
|
if (!item.CheckFLG)
|
||||||
|
{
|
||||||
|
item.CheckFLG = true;
|
||||||
|
item.IsModified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SignalNotice: DialogBase
|
||||||
|
{
|
||||||
|
#region 属性
|
||||||
|
private int _ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get { return _ID; }
|
||||||
|
set { _ID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _WireGroupNoticeID;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号通知ID
|
||||||
|
/// </summary>
|
||||||
|
public string WireGroupNoticeID
|
||||||
|
{
|
||||||
|
get { return _WireGroupNoticeID; }
|
||||||
|
set { _WireGroupNoticeID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _Group_Name;
|
||||||
|
/// <summary>
|
||||||
|
/// CH.NO
|
||||||
|
/// </summary>
|
||||||
|
public string Group_Name
|
||||||
|
{
|
||||||
|
get { return _Group_Name; }
|
||||||
|
set { _Group_Name = value; }
|
||||||
|
}
|
||||||
|
private string _Group_Desc;
|
||||||
|
/// <summary>
|
||||||
|
/// z中文描述
|
||||||
|
/// </summary>
|
||||||
|
public string Group_Desc
|
||||||
|
{
|
||||||
|
get { return _Group_Desc; }
|
||||||
|
set { _Group_Desc = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _Group_Desc_EN;
|
||||||
|
/// <summary>
|
||||||
|
/// 英文描述
|
||||||
|
/// </summary>
|
||||||
|
public string Group_Desc_EN
|
||||||
|
{
|
||||||
|
get { return _Group_Desc_EN; }
|
||||||
|
set { _Group_Desc_EN = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _IO_Type;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号类型
|
||||||
|
/// </summary>
|
||||||
|
public string IO_Type
|
||||||
|
{
|
||||||
|
get { return _IO_Type; }
|
||||||
|
set { _IO_Type = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private Models.Action _ActionID;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作ID
|
||||||
|
/// </summary>
|
||||||
|
public Models.Action ActionID
|
||||||
|
{
|
||||||
|
get { return _ActionID; }
|
||||||
|
set { _ActionID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _Action;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作
|
||||||
|
/// </summary>
|
||||||
|
public string Action
|
||||||
|
{
|
||||||
|
get { return _Action; }
|
||||||
|
set { _Action = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _CreateUserName;
|
||||||
|
/// <summary>
|
||||||
|
/// 发出者
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUserName
|
||||||
|
{
|
||||||
|
get { return _CreateUserName; }
|
||||||
|
set { _CreateUserName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? _CreateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateTime
|
||||||
|
{
|
||||||
|
get { return _CreateTime; }
|
||||||
|
set { _CreateTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _UpdateUserName;
|
||||||
|
/// <summary>
|
||||||
|
/// 已阅人
|
||||||
|
/// </summary>
|
||||||
|
public string UpdateUserName
|
||||||
|
{
|
||||||
|
get { return _UpdateUserName; }
|
||||||
|
set { _UpdateUserName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? _UpdateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 已阅时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? UpdateTime
|
||||||
|
{
|
||||||
|
get { return _UpdateTime; }
|
||||||
|
set { _UpdateTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _Message;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作信息
|
||||||
|
/// </summary>
|
||||||
|
public string Message
|
||||||
|
{
|
||||||
|
get { return _Message; }
|
||||||
|
set { _Message = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _CheckFLG;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否已读
|
||||||
|
/// </summary>
|
||||||
|
public bool CheckFLG
|
||||||
|
{
|
||||||
|
get { return _CheckFLG; }
|
||||||
|
set { _CheckFLG = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _IsModified;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否修改
|
||||||
|
/// </summary>
|
||||||
|
public bool IsModified
|
||||||
|
{
|
||||||
|
get { return _IsModified; }
|
||||||
|
set { _IsModified = value; RaisePropertyChanged(nameof(IsModified)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _IsReadOnly;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否可编辑
|
||||||
|
/// </summary>
|
||||||
|
public bool IsReadOnly
|
||||||
|
{
|
||||||
|
get { return _IsReadOnly; }
|
||||||
|
set { _IsReadOnly = value; RaisePropertyChanged(nameof(IsReadOnly)); }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
public SignalNotice()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public SignalNotice(ec_wire_group_notice ec_Notice)
|
||||||
|
{
|
||||||
|
#region 前端表格对应列
|
||||||
|
this.Group_Name = ec_Notice.Group_Name;
|
||||||
|
this.Group_Desc = ec_Notice.Group_Desc;
|
||||||
|
this.Group_Desc_EN = ec_Notice.Group_Desc_EN;
|
||||||
|
this.IO_Type = ec_Notice.IO_Type;
|
||||||
|
this.Action = ec_Notice.Action;
|
||||||
|
this.CreateUserName = ec_Notice.CreateUserName;
|
||||||
|
this.CreateTime = ec_Notice.CreateTime;
|
||||||
|
this.UpdateUserName = ec_Notice.UpdateUserName;
|
||||||
|
this.UpdateTime = ec_Notice.UpdateTime;
|
||||||
|
this.Message = ec_Notice.Message;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
this.WireGroupNoticeID = ec_Notice.WireGroupNoticeID;
|
||||||
|
this.CheckFLG = ec_Notice.CheckFLG;
|
||||||
|
this.IsReadOnly = ec_Notice.CheckFLG;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置数据
|
||||||
|
/// </summary>
|
||||||
|
public void setData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,380 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
using System;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
using Prism.Ioc;
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogSignalPropertyhisAndLogsViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
#region 属性
|
||||||
|
private SignalManagementInfo _SignalInfo;
|
||||||
|
/// <summary>
|
||||||
|
/// 传入选中的信号对象
|
||||||
|
/// </summary>
|
||||||
|
public SignalManagementInfo SignalInfo
|
||||||
|
{
|
||||||
|
get { return _SignalInfo; }
|
||||||
|
set { _SignalInfo = value; RaisePropertyChanged(nameof(SignalInfo)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ObservableCollection<SignalLog> _MySignalLogs = new ObservableCollection<SignalLog>();
|
||||||
|
/// <summary>
|
||||||
|
/// 表格数据源
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<SignalLog> MySignalLogs
|
||||||
|
{
|
||||||
|
get { return _MySignalLogs; }
|
||||||
|
set { _MySignalLogs = value; RaisePropertyChanged(nameof(MySignalLogs)); }
|
||||||
|
}
|
||||||
|
private SignalLog _SelectedSignalLog;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中行
|
||||||
|
/// </summary>
|
||||||
|
public SignalLog SelectedSignalLog
|
||||||
|
{
|
||||||
|
get { return _SelectedSignalLog; }
|
||||||
|
set { _SelectedSignalLog = value; RaisePropertyChanged(nameof(SelectedSignalLog)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<SingnalPropertyhis> _MySingnalPropertyhis = new ObservableCollection<SingnalPropertyhis>();
|
||||||
|
/// <summary>
|
||||||
|
/// 表格数据源
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<SingnalPropertyhis> MySingnalPropertyhis
|
||||||
|
{
|
||||||
|
get { return _MySingnalPropertyhis; }
|
||||||
|
set { _MySingnalPropertyhis = value; RaisePropertyChanged(nameof(MySingnalPropertyhis)); }
|
||||||
|
}
|
||||||
|
private SingnalPropertyhis _SelectedPropertyhi;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中行
|
||||||
|
/// </summary>
|
||||||
|
public SingnalPropertyhis SelectedPropertyhi
|
||||||
|
{
|
||||||
|
get { return _SelectedPropertyhi; }
|
||||||
|
set { _SelectedPropertyhi = value; RaisePropertyChanged(nameof(SelectedPropertyhi)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信号接口服务
|
||||||
|
/// </summary>
|
||||||
|
WireGroupService _wireGroupService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public DialogSignalPropertyhisAndLogsViewModel(IContainerProvider container)
|
||||||
|
{
|
||||||
|
|
||||||
|
_wireGroupService = container.Resolve<WireGroupService>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ec_wire_group_log> SignalLogs;
|
||||||
|
private List<ec_wire_group_propertyhis> SignalPropertyhis;
|
||||||
|
public async void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
SignalInfo = parameters.GetValue<SignalManagementInfo>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
title = SignalInfo.Group_Name + " 信号属性修改历史和操作记录";
|
||||||
|
|
||||||
|
SignalLogs = await _wireGroupService.GetSignalLogs(SignalInfo.Wire_Group_ID);
|
||||||
|
if(SignalLogs != null)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in SignalLogs)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
SignalLog s = new SignalLog(item);
|
||||||
|
s.ID = index;
|
||||||
|
MySignalLogs.Add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SignalPropertyhis = await _wireGroupService.GetSignalPropertyhis(SignalInfo.Wire_Group_ID);
|
||||||
|
if (SignalPropertyhis != null)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in SignalPropertyhis)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
SingnalPropertyhis s = new SingnalPropertyhis(item);
|
||||||
|
s.ID = index;
|
||||||
|
MySingnalPropertyhis.Add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
//res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}");
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.No, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 右侧按钮
|
||||||
|
|
||||||
|
public ICommand ButtonCmd => new DelegateCommand(Button_Click);
|
||||||
|
|
||||||
|
string IDialogAware.Title => throw new NotImplementedException();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 页面右侧按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual async void Button_Click(object parameter)
|
||||||
|
{
|
||||||
|
#region 确定
|
||||||
|
if (parameter.Equals("确定"))
|
||||||
|
{
|
||||||
|
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 取消
|
||||||
|
if (parameter.Equals("取消"))
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Cancel, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SignalLog: DialogBase
|
||||||
|
{
|
||||||
|
#region 属性
|
||||||
|
private int _ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get { return _ID; }
|
||||||
|
set { _ID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _WireGroupLogID;
|
||||||
|
|
||||||
|
public string WireGroupLogID
|
||||||
|
{
|
||||||
|
get { return _WireGroupLogID; }
|
||||||
|
set { _WireGroupLogID = value; }
|
||||||
|
}
|
||||||
|
private string _WireGroupID;
|
||||||
|
|
||||||
|
public string WireGroupID
|
||||||
|
{
|
||||||
|
get { return _WireGroupID; }
|
||||||
|
set { _WireGroupID = value; }
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
private Models.Action _OperateType;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作
|
||||||
|
/// </summary>
|
||||||
|
public Models.Action OperateType
|
||||||
|
{
|
||||||
|
get { return _OperateType; }
|
||||||
|
set { _OperateType = value; }
|
||||||
|
}
|
||||||
|
private string _ExtraMsg;
|
||||||
|
/// <summary>
|
||||||
|
/// 附加信息
|
||||||
|
/// </summary>
|
||||||
|
public string ExtraMsg
|
||||||
|
{
|
||||||
|
get { return _ExtraMsg; }
|
||||||
|
set { _ExtraMsg = value; }
|
||||||
|
}
|
||||||
|
private string _CreateUserID;
|
||||||
|
|
||||||
|
public string CreateUserID
|
||||||
|
{
|
||||||
|
get { return _CreateUserID; }
|
||||||
|
set { _CreateUserID = value; }
|
||||||
|
}
|
||||||
|
private string _CreateUserName;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作人
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUserName
|
||||||
|
{
|
||||||
|
get { return _CreateUserName; }
|
||||||
|
set { _CreateUserName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? _CreateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 操作时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime
|
||||||
|
{
|
||||||
|
get { return _CreateTime; }
|
||||||
|
set { _CreateTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
public SignalLog()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public SignalLog(ec_wire_group_log ec_Notice)
|
||||||
|
{
|
||||||
|
#region 前端表格对应列
|
||||||
|
this.OperateType = ec_Notice.OperateType;
|
||||||
|
this.ExtraMsg = ec_Notice.ExtraMsg;
|
||||||
|
this.CreateUserName = ec_Notice.CreateUserName;
|
||||||
|
this.CreateTime = ec_Notice.CreateTime;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置数据
|
||||||
|
/// </summary>
|
||||||
|
public void setData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SingnalPropertyhis : DialogBase
|
||||||
|
{
|
||||||
|
#region 属性
|
||||||
|
private int _ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get { return _ID; }
|
||||||
|
set { _ID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _PropertyName;
|
||||||
|
/// <summary>
|
||||||
|
/// 属性
|
||||||
|
/// </summary>
|
||||||
|
public string PropertyName
|
||||||
|
{
|
||||||
|
get { return _PropertyName; }
|
||||||
|
set { _PropertyName = value; }
|
||||||
|
}
|
||||||
|
private string _PropertyNameDec;
|
||||||
|
/// <summary>
|
||||||
|
/// 属性名称描述
|
||||||
|
/// </summary>
|
||||||
|
public string PropertyNameDec
|
||||||
|
{
|
||||||
|
get { return _PropertyNameDec; }
|
||||||
|
set { _PropertyNameDec = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _OldPropertyValue;
|
||||||
|
/// <summary>
|
||||||
|
/// 旧属性值
|
||||||
|
/// </summary>
|
||||||
|
public string OldPropertyValue
|
||||||
|
{
|
||||||
|
get { return _OldPropertyValue; }
|
||||||
|
set { _OldPropertyValue = value; }
|
||||||
|
}
|
||||||
|
private string _NewPropertyValue;
|
||||||
|
/// <summary>
|
||||||
|
/// 新属性值
|
||||||
|
/// </summary>
|
||||||
|
public string NewPropertyValue
|
||||||
|
{
|
||||||
|
get { return _NewPropertyValue; }
|
||||||
|
set { _NewPropertyValue = value; }
|
||||||
|
}
|
||||||
|
private string _CreateUserName;
|
||||||
|
/// <summary>
|
||||||
|
/// 修改人
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUserName
|
||||||
|
{
|
||||||
|
get { return _CreateUserName; }
|
||||||
|
set { _CreateUserName = value; }
|
||||||
|
}
|
||||||
|
private DateTime? _CreateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateTime
|
||||||
|
{
|
||||||
|
get { return _CreateTime; }
|
||||||
|
set { _CreateTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方法
|
||||||
|
public SingnalPropertyhis(ec_wire_group_propertyhis ec_Wire_Group_Propertyhis)
|
||||||
|
{
|
||||||
|
#region 前端渲染
|
||||||
|
this.PropertyName = ec_Wire_Group_Propertyhis.PropertyName;
|
||||||
|
this.PropertyNameDec = ec_Wire_Group_Propertyhis.PropertyNameDec;
|
||||||
|
this.OldPropertyValue = ec_Wire_Group_Propertyhis.OldPropertyValue;
|
||||||
|
this.NewPropertyValue = ec_Wire_Group_Propertyhis.NewPropertyValue;
|
||||||
|
this.CreateUserName = ec_Wire_Group_Propertyhis.CreateUserName;
|
||||||
|
this._CreateTime = ec_Wire_Group_Propertyhis.CreateTime;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogSignalSelectViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
|
||||||
|
public DialogSignalSelectViewModel(IContainerProvider container)
|
||||||
|
{
|
||||||
|
title = "信号选择框";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private ObservableCollection<Signal> _listSignal;
|
||||||
|
/// <summary>
|
||||||
|
/// 单位列表
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<Signal> listSignal
|
||||||
|
{
|
||||||
|
get { return _listSignal; }
|
||||||
|
set { _listSignal = value; RaisePropertyChanged(nameof(listSignal)); }
|
||||||
|
}
|
||||||
|
private Signal _SelectedSignal;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中的单位
|
||||||
|
/// </summary>
|
||||||
|
public Signal SelectedSignal
|
||||||
|
{
|
||||||
|
get { return _SelectedSignal; }
|
||||||
|
set { _SelectedSignal = value; RaisePropertyChanged(nameof(SelectedSignal)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title => "信号选择框";
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
var signals = parameters.GetValue<ObservableCollection<SignalManagementInfo>>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
|
||||||
|
listSignal = new ObservableCollection<Signal>();
|
||||||
|
foreach (var item in signals)
|
||||||
|
{
|
||||||
|
if (item.type.Equals("信号"))
|
||||||
|
{
|
||||||
|
listSignal.Add(new Signal() { SignalId = item.Wire_Group_ID, SignalName = item.Group_Name });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
if (SelectedSignal == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请选择一个信号!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSignal);
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
IDialogParameters res = new DialogParameters();
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.No, res);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class Signal : ViewModelBase
|
||||||
|
{
|
||||||
|
private string _SignalId;
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
public string SignalId
|
||||||
|
{
|
||||||
|
get { return _SignalId; }
|
||||||
|
set { _SignalId = value; RaisePropertyChanged(nameof(SignalId)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _SignalName;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号
|
||||||
|
/// </summary>
|
||||||
|
public string SignalName
|
||||||
|
{
|
||||||
|
get { return _SignalName; }
|
||||||
|
set { _SignalName = value; RaisePropertyChanged(nameof(SignalName)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogTestViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
#region binding
|
||||||
|
private string _parText;
|
||||||
|
/// <summary>
|
||||||
|
/// 参数值
|
||||||
|
/// </summary>
|
||||||
|
public string parText
|
||||||
|
{
|
||||||
|
get { return _parText; }
|
||||||
|
set { _parText = value; OnPropertyChanged(nameof(parText)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 命令事件
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_Close1 { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 命令事件
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_Close2 { get; set; }
|
||||||
|
|
||||||
|
public DialogTestViewModel()
|
||||||
|
{
|
||||||
|
Command_Close1 = new DelegateCommand(onClose1);
|
||||||
|
Command_Close2 = new DelegateCommand(onClose2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title => "弹框测试页面";
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
parText = parameters.GetValue<string>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClose1(object o)
|
||||||
|
{
|
||||||
|
IDialogParameters par = new DialogParameters();
|
||||||
|
par.Add(GlobalObject.dialogPar.para1.ToString(), "xxx");
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.Yes, par);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
public void onClose2(object o)
|
||||||
|
{
|
||||||
|
IDialogParameters par = new DialogParameters();
|
||||||
|
par.Add(GlobalObject.dialogPar.para1.ToString(), "zzz");
|
||||||
|
DialogResult result = new DialogResult(ButtonResult.No, par);
|
||||||
|
RequestClose.Invoke(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
152
newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs
Normal file
152
newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using DI_Electrical.Helper;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using DI_Electrical.Views;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class LoginViewModel : DialogBase
|
||||||
|
{
|
||||||
|
#region BINDING
|
||||||
|
|
||||||
|
private bool _rememberPs;
|
||||||
|
|
||||||
|
public bool rememberPs
|
||||||
|
{
|
||||||
|
get { return _rememberPs; }
|
||||||
|
set { _rememberPs = value; RaisePropertyChanged(nameof(rememberPs)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _UserName;
|
||||||
|
|
||||||
|
public string UserName
|
||||||
|
{
|
||||||
|
get { return _UserName; }
|
||||||
|
set { _UserName = value; RaisePropertyChanged(nameof(UserName)); }
|
||||||
|
}
|
||||||
|
private string _UserPs;
|
||||||
|
|
||||||
|
|
||||||
|
private string _curServer;
|
||||||
|
|
||||||
|
public string curServer
|
||||||
|
{
|
||||||
|
get { return _curServer; }
|
||||||
|
set { _curServer = value; RaisePropertyChanged(nameof(curServer)); }
|
||||||
|
}
|
||||||
|
private string _sPASSWORD;
|
||||||
|
|
||||||
|
public string sPASSWORD
|
||||||
|
{
|
||||||
|
get { return _sPASSWORD; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_sPASSWORD = value;
|
||||||
|
RaisePropertyChanged(nameof(sPASSWORD));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
/// <summary>
|
||||||
|
/// 设置
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_Config { get; set; }
|
||||||
|
LoginService _Service;
|
||||||
|
ConfigService _configService;
|
||||||
|
UserService _UserService;
|
||||||
|
IContainerProvider containerProvider;
|
||||||
|
public LoginViewModel(IContainerProvider container)
|
||||||
|
{
|
||||||
|
title = "系统登录";
|
||||||
|
_UserService = container.Resolve<UserService>();
|
||||||
|
_Service = container.Resolve<LoginService>();
|
||||||
|
_configService = container.Resolve<ConfigService>();
|
||||||
|
Command_Config = new DelegateCommand(onConfig);
|
||||||
|
containerProvider = container;
|
||||||
|
if (GlobalObject.isConfigIniCreateBySys)
|
||||||
|
{
|
||||||
|
var config= container.Resolve<Config>();
|
||||||
|
config.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
UserName = _configService.Read(nameof(ConfigIni.UserName));
|
||||||
|
sPASSWORD = _configService.Read(nameof(ConfigIni.UserPs));
|
||||||
|
if (string.IsNullOrEmpty(sPASSWORD))
|
||||||
|
{
|
||||||
|
rememberPs = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rememberPs = true;
|
||||||
|
}
|
||||||
|
if (GlobalObject.userInfo != null && rememberPs)
|
||||||
|
{
|
||||||
|
sPASSWORD = GlobalObject.userInfo.userPs;
|
||||||
|
}
|
||||||
|
curServer = "当前服务器: " + _configService.Read(nameof(ConfigIni.Address)) + ":" + _configService.Read(nameof(ConfigIni.Port));
|
||||||
|
|
||||||
|
}
|
||||||
|
public void onConfig(object o)
|
||||||
|
{
|
||||||
|
var config = containerProvider.Resolve<Config>();
|
||||||
|
config.ShowDialog();
|
||||||
|
curServer = "当前服务器: " + _configService.Read(nameof(ConfigIni.Address)) + ":" + _configService.Read(nameof(ConfigIni.Port));
|
||||||
|
|
||||||
|
}
|
||||||
|
public override async void ExecuteOKCommandAsync(object obj)
|
||||||
|
{
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
var passBox = obj as RadPasswordBox;
|
||||||
|
var Userpass = passBox.Password;
|
||||||
|
if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Userpass))
|
||||||
|
{
|
||||||
|
MessageBox.Show("用户名和密码不能为空!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsBusy = true; BusyContent = "登录中...";
|
||||||
|
var res = await _Service.Login(UserName, Userpass);
|
||||||
|
IsBusy = false;
|
||||||
|
if (string.IsNullOrEmpty(res))
|
||||||
|
{
|
||||||
|
_configService.Save(nameof(ConfigIni.UserName), UserName);
|
||||||
|
if (rememberPs)
|
||||||
|
{
|
||||||
|
_configService.Save(nameof(ConfigIni.UserPs), Userpass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_configService.Save(nameof(ConfigIni.UserPs), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 拿一些全局的东西
|
||||||
|
await _UserService.GetList();
|
||||||
|
#endregion
|
||||||
|
CloseWindowAction?.Invoke();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using DI_Electrical.Event;
|
||||||
|
using DI_Electrical.Views.Dialog;
|
||||||
|
using DI_Electrical.Views.Dialog.DialogSignalManagements;
|
||||||
|
using DryIoc;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class MainWindowViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region binding
|
||||||
|
private string _ProjectName;
|
||||||
|
/// <summary>
|
||||||
|
///当前项目
|
||||||
|
/// </summary>
|
||||||
|
public string ProjectName
|
||||||
|
{
|
||||||
|
get { return _ProjectName; }
|
||||||
|
set { _ProjectName = value; OnPropertyChanged(nameof(ProjectName)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
/// <summary>
|
||||||
|
/// 命令事件
|
||||||
|
/// </summary>
|
||||||
|
public ICommand Command_ShowDialogTest { get; set; }
|
||||||
|
public ICommand Command_ShowDialogSignalManagement { get; set; }
|
||||||
|
private readonly IDialogService _dialogService;
|
||||||
|
private IEventAggregator _eventAggregator;
|
||||||
|
public MainWindowViewModel(IDialogService dialogService , IEventAggregator eventAggregator)
|
||||||
|
{
|
||||||
|
Command_ShowDialogTest = new DelegateCommand(onShowDialogTest);
|
||||||
|
Command_ShowDialogSignalManagement = new DelegateCommand(onShowDialogSignalManagement);
|
||||||
|
_dialogService = dialogService;
|
||||||
|
_eventAggregator= eventAggregator;
|
||||||
|
_eventAggregator.GetEvent<loginEvent>().Subscribe(onEnterProjOK, ThreadOption.UIThread, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 选中项目
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
private void onEnterProjOK(JToken obj)
|
||||||
|
{
|
||||||
|
ProjectName = GlobalObject.curProject?.ProjectName;
|
||||||
|
}
|
||||||
|
public void onShowDialogTest(object o)
|
||||||
|
{
|
||||||
|
IDialogParameters par = new DialogParameters();
|
||||||
|
par.Add(GlobalObject.dialogPar.para1.ToString(), "abc你我他");
|
||||||
|
_dialogService.ShowDialog(nameof(DialogTest), par, (result) =>
|
||||||
|
{
|
||||||
|
var res = result.Parameters.GetValue<string>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
if (result.Result == ButtonResult.OK || result.Result == ButtonResult.Yes)
|
||||||
|
{
|
||||||
|
MessageBox.Show("窗体Yes关闭,返回:"+res);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageBox.Show("窗体NO关闭,返回:" + res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onShowDialogSignalManagement(object o)
|
||||||
|
{
|
||||||
|
IDialogParameters par = new DialogParameters();
|
||||||
|
_dialogService.ShowDialog(nameof(DialogSignalManagement), par, (result) =>
|
||||||
|
{
|
||||||
|
var res = result.Parameters.GetValue<string>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
if (result.Result == ButtonResult.OK || result.Result == ButtonResult.Yes)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
66
newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs
Normal file
66
newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using DI_Electrical.Event;
|
||||||
|
using DI_Electrical.Helper;
|
||||||
|
using DI_Electrical.Model;
|
||||||
|
using DI_Electrical.Services;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Ioc;
|
||||||
|
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
public class ProjectViewModel : DialogBase
|
||||||
|
{
|
||||||
|
private List<ec_project> projects;
|
||||||
|
public List<ec_project> Projects
|
||||||
|
{
|
||||||
|
get { return this.projects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.projects = value;
|
||||||
|
RaisePropertyChanged(nameof(Projects));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private ec_project _select;
|
||||||
|
|
||||||
|
public ec_project select
|
||||||
|
{
|
||||||
|
get { return _select; }
|
||||||
|
set { _select = value; RaisePropertyChanged(nameof(select)); }
|
||||||
|
}
|
||||||
|
ProjectService _Service;
|
||||||
|
ConfigService _configService;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
public ProjectViewModel(IContainerProvider container) : base()
|
||||||
|
{
|
||||||
|
title = "项目选择";
|
||||||
|
_Service = container.Resolve<ProjectService>();
|
||||||
|
_configService = container.Resolve<ConfigService>();
|
||||||
|
_eventAggregator= container.Resolve<IEventAggregator>();
|
||||||
|
}
|
||||||
|
public async override void onWindow_loaded(object para)
|
||||||
|
{
|
||||||
|
Projects = (await _Service.GetProjects(1, 200)).Rows;
|
||||||
|
base.onWindow_loaded(para);
|
||||||
|
}
|
||||||
|
public override async void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
if (select == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请选择一个项目。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_configService.Save(nameof(ConfigIni.ProjectID), select.ProjectId);
|
||||||
|
GlobalObject.curProject = select;
|
||||||
|
|
||||||
|
IsBusy = true;
|
||||||
|
BusyContent = "项目加载中...";
|
||||||
|
var userName = _configService.Read(nameof(ConfigIni.UserName));
|
||||||
|
var o = await _Service.InitProjInfo(GlobalObject.curProject.ProjectId, userName);
|
||||||
|
IsBusy = false;
|
||||||
|
_eventAggregator.GetEvent<loginEvent>().Publish(o);
|
||||||
|
CloseWindowAction?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
namespace DI_Electrical.ViewModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// abstract 不同于接口,可以实现具体的代码
|
||||||
|
/// </summary>
|
||||||
|
public abstract class DialogBase : ViewModelBase
|
||||||
|
{
|
||||||
|
public DialogBase()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
88
newFront/c#前端/DI-Electrical/Views/Config.xaml
Normal file
88
newFront/c#前端/DI-Electrical/Views/Config.xaml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="DI_Electrical.Views.Config"
|
||||||
|
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:DI_Electrical.Views"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
Width="400"
|
||||||
|
Height="250"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="White"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="None">
|
||||||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local:customWindowTitleBar />
|
||||||
|
<Grid Grid.Row="1" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Style="{StaticResource sysLabel}" Text="服务器的域名或IP:" />
|
||||||
|
<TextBox
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Style="{StaticResource sysTextBox}"
|
||||||
|
Text="{Binding Address}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource sysLabel}"
|
||||||
|
Text="端口号:" />
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Style="{StaticResource sysTextBox}"
|
||||||
|
Text="{Binding Port}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="本地文件目录:" />
|
||||||
|
<telerik:RadFilePathPicker
|
||||||
|
x:Name="filepath"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
DialogType="OpenFolder"
|
||||||
|
FilePath="{Binding Directory}"
|
||||||
|
FilePathChanged="RadFilePathPicker_FilePathChanged"
|
||||||
|
Style="{StaticResource sysFilePathPicker}" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<Border
|
||||||
|
Grid.Row="2"
|
||||||
|
Height="30"
|
||||||
|
Background="{StaticResource ColorPrimary}">
|
||||||
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding CloseCommand}"
|
||||||
|
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Content="取消"
|
||||||
|
Style="{StaticResource sysBtn2}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding OKCommand}"
|
||||||
|
Content="保存"
|
||||||
|
Style="{StaticResource sysBtn}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</telerik:RadBusyIndicator>
|
||||||
|
|
||||||
|
</Window>
|
44
newFront/c#前端/DI-Electrical/Views/Config.xaml.cs
Normal file
44
newFront/c#前端/DI-Electrical/Views/Config.xaml.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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.Shapes;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Config.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Config : Window
|
||||||
|
{
|
||||||
|
public Config(ConfigViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel.CloseWindowAction = this.Close; // 将关闭方法传递给 ViewModel
|
||||||
|
DataContext = viewModel;
|
||||||
|
}
|
||||||
|
private void RadFilePathPicker_FilePathChanged(object sender, Telerik.Windows.Controls.FileDialogs.FilePathChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(e.FilePath))
|
||||||
|
{
|
||||||
|
this.filepath.FilePath = "";
|
||||||
|
var x = DataContext as ConfigViewModel;
|
||||||
|
x.Directory = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var x = DataContext as ConfigViewModel;
|
||||||
|
x.Directory = e.FilePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
[TemplatePart(Name = "PART_Icon", Type = typeof(Path))]
|
||||||
|
[TemplatePart(Name = "PART_Content", Type = typeof(ContentPresenter))]
|
||||||
|
public class IconButton : Button
|
||||||
|
{
|
||||||
|
static IconButton()
|
||||||
|
{
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(
|
||||||
|
typeof(IconButton),
|
||||||
|
new FrameworkPropertyMetadata(typeof(IconButton)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 依赖属性
|
||||||
|
// 矢量路径数据
|
||||||
|
public static readonly DependencyProperty IconDataProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"IconData",
|
||||||
|
typeof(Geometry),
|
||||||
|
typeof(IconButton),
|
||||||
|
new FrameworkPropertyMetadata(null));
|
||||||
|
|
||||||
|
// 图标尺寸
|
||||||
|
public static readonly DependencyProperty IconSizeProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"IconSize",
|
||||||
|
typeof(double),
|
||||||
|
typeof(IconButton),
|
||||||
|
new FrameworkPropertyMetadata(16.0));
|
||||||
|
|
||||||
|
// 图标位置
|
||||||
|
public static readonly DependencyProperty IconPlacementProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"IconPlacement",
|
||||||
|
typeof(Dock),
|
||||||
|
typeof(IconButton),
|
||||||
|
new FrameworkPropertyMetadata(Dock.Left));
|
||||||
|
|
||||||
|
// 图标与文字间距
|
||||||
|
public static readonly DependencyProperty IconMarginProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"IconMargin",
|
||||||
|
typeof(Thickness),
|
||||||
|
typeof(IconButton),
|
||||||
|
new FrameworkPropertyMetadata(new Thickness(0, 0, 5, 0)));
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 属性包装器
|
||||||
|
public Geometry IconData
|
||||||
|
{
|
||||||
|
get => (Geometry)GetValue(IconDataProperty);
|
||||||
|
set => SetValue(IconDataProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double IconSize
|
||||||
|
{
|
||||||
|
get => (double)GetValue(IconSizeProperty);
|
||||||
|
set => SetValue(IconSizeProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dock IconPlacement
|
||||||
|
{
|
||||||
|
get => (Dock)GetValue(IconPlacementProperty);
|
||||||
|
set => SetValue(IconPlacementProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Thickness IconMargin
|
||||||
|
{
|
||||||
|
get => (Thickness)GetValue(IconMarginProperty);
|
||||||
|
set => SetValue(IconMarginProperty, value);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using DI_Electrical.Models;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public class CollectionToStringConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
ObservableCollection<ec_dataitemdetail> WHCPUs = value as ObservableCollection<ec_dataitemdetail>;
|
||||||
|
if (WHCPUs != null)
|
||||||
|
{
|
||||||
|
string sWHCPU = "";
|
||||||
|
for (int i = 0; i < WHCPUs.Count; i++)
|
||||||
|
{
|
||||||
|
if (i!= WHCPUs.Count-1)
|
||||||
|
{
|
||||||
|
if (WHCPUs[i] != null)
|
||||||
|
{
|
||||||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode + "|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (WHCPUs[i] != null)
|
||||||
|
{
|
||||||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sWHCPU;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
|
||||||
|
public static class DoubleUtil
|
||||||
|
{
|
||||||
|
internal const double DBL_EPSILON = 2.2204460492503131e-016; /* smallest such that 1.0+DBL_EPSILON != 1.0 */
|
||||||
|
internal const float FLT_MIN = 1.175494351e-38F; /* Number close to zero, where float.MinValue is -float.MaxValue */
|
||||||
|
|
||||||
|
|
||||||
|
public static bool IsZero(double value) => Math.Abs(value) < 10.0 * DBL_EPSILON;
|
||||||
|
|
||||||
|
public static bool AreClose(double value1, double value2)
|
||||||
|
{
|
||||||
|
if (value1 == value2) return true;
|
||||||
|
double eps = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * DBL_EPSILON;
|
||||||
|
double delta = value1 - value2;
|
||||||
|
return (-eps < delta) && (eps > delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool LessThan(double value1, double value2) => (value1 < value2) && !AreClose(value1, value2);
|
||||||
|
|
||||||
|
public static bool GreaterThan(double value1, double value2) => (value1 > value2) && !AreClose(value1, value2);
|
||||||
|
|
||||||
|
public static bool LessThanOrClose(double value1, double value2) => (value1 < value2) || AreClose(value1, value2);
|
||||||
|
|
||||||
|
public static bool GreaterThanOrClose(double value1, double value2) => (value1 > value2) || AreClose(value1, value2);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
private struct NanUnion
|
||||||
|
{
|
||||||
|
[FieldOffset(0)]
|
||||||
|
internal double DoubleValue;
|
||||||
|
[FieldOffset(0)]
|
||||||
|
internal UInt64 UintValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsNaN(double value)
|
||||||
|
{
|
||||||
|
NanUnion t = new NanUnion();
|
||||||
|
t.DoubleValue = value;
|
||||||
|
|
||||||
|
UInt64 exp = t.UintValue & 0xfff0000000000000;
|
||||||
|
UInt64 man = t.UintValue & 0x000fffffffffffff;
|
||||||
|
|
||||||
|
return (exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsOne(double value)
|
||||||
|
{
|
||||||
|
return Math.Abs(value - 1.0) < 10.0 * DBL_EPSILON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public class ElementHelper : DependencyObject
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty CornerRadiusProperty =
|
||||||
|
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ElementHelper),
|
||||||
|
new PropertyMetadata(new CornerRadius(0)));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty WatermarkProperty =
|
||||||
|
DependencyProperty.RegisterAttached("Watermark", typeof(string), typeof(ElementHelper),
|
||||||
|
new PropertyMetadata(string.Empty));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsStripeProperty =
|
||||||
|
DependencyProperty.RegisterAttached("IsStripe", typeof(bool), typeof(ElementHelper),
|
||||||
|
new PropertyMetadata(false));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsRoundProperty =
|
||||||
|
DependencyProperty.RegisterAttached("IsRound", typeof(bool), typeof(ElementHelper),
|
||||||
|
new PropertyMetadata(false));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsClearProperty =
|
||||||
|
DependencyProperty.RegisterAttached("IsClear", typeof(bool), typeof(ElementHelper),
|
||||||
|
new PropertyMetadata(false, OnIsClearChanged));
|
||||||
|
|
||||||
|
public static CornerRadius GetCornerRadius(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (CornerRadius)obj.GetValue(CornerRadiusProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
|
||||||
|
{
|
||||||
|
obj.SetValue(CornerRadiusProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetWatermark(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (string)obj.GetValue(WatermarkProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetWatermark(DependencyObject obj, string value)
|
||||||
|
{
|
||||||
|
obj.SetValue(WatermarkProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetIsStripe(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (bool)obj.GetValue(IsStripeProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetIsStripe(DependencyObject obj, bool value)
|
||||||
|
{
|
||||||
|
obj.SetValue(IsStripeProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetIsRound(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (bool)obj.GetValue(IsRoundProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetIsRound(DependencyObject obj, bool value)
|
||||||
|
{
|
||||||
|
obj.SetValue(IsRoundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetIsClear(UIElement element, bool value)
|
||||||
|
{
|
||||||
|
element.SetValue(IsClearProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetIsClear(UIElement element)
|
||||||
|
{
|
||||||
|
return (bool)element.GetValue(IsClearProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnIsClearChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = d as Button;
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
button.Click += ButtonClear_Click;
|
||||||
|
else
|
||||||
|
button.Click -= ButtonClear_Click;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ButtonClear_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Button button)
|
||||||
|
{
|
||||||
|
if (button.TemplatedParent is TextBox textBox)
|
||||||
|
textBox.Clear();
|
||||||
|
else if (button.TemplatedParent is PasswordBox passwordBox)
|
||||||
|
passwordBox.Clear();
|
||||||
|
else if (button.TemplatedParent is TabItem tabItem)
|
||||||
|
{
|
||||||
|
var tabControl = tabItem.Parent as TabControl;
|
||||||
|
if (tabControl != null)
|
||||||
|
tabControl.Items.Remove(tabItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,155 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
internal class GeometryHelper
|
||||||
|
{
|
||||||
|
public static void GenerateGeometry(StreamGeometryContext ctx, Rect rect, Radii radii)
|
||||||
|
{
|
||||||
|
var point = new Point(radii.LeftTop, 0.0);
|
||||||
|
var point2 = new Point(rect.Width - radii.RightTop, 0.0);
|
||||||
|
var point3 = new Point(rect.Width, radii.TopRight);
|
||||||
|
var point4 = new Point(rect.Width, rect.Height - radii.BottomRight);
|
||||||
|
var point5 = new Point(rect.Width - radii.RightBottom, rect.Height);
|
||||||
|
var point6 = new Point(radii.LeftBottom, rect.Height);
|
||||||
|
var point7 = new Point(0.0, rect.Height - radii.BottomLeft);
|
||||||
|
var point8 = new Point(0.0, radii.TopLeft);
|
||||||
|
if (point.X > point2.X)
|
||||||
|
{
|
||||||
|
var x = radii.LeftTop / (radii.LeftTop + radii.RightTop) * rect.Width;
|
||||||
|
point.X = x;
|
||||||
|
point2.X = x;
|
||||||
|
}
|
||||||
|
if (point3.Y > point4.Y)
|
||||||
|
{
|
||||||
|
var y = radii.TopRight / (radii.TopRight + radii.BottomRight) * rect.Height;
|
||||||
|
point3.Y = y;
|
||||||
|
point4.Y = y;
|
||||||
|
}
|
||||||
|
if (point5.X < point6.X)
|
||||||
|
{
|
||||||
|
var x2 = radii.LeftBottom / (radii.LeftBottom + radii.RightBottom) * rect.Width;
|
||||||
|
point5.X = x2;
|
||||||
|
point6.X = x2;
|
||||||
|
}
|
||||||
|
if (point7.Y < point8.Y)
|
||||||
|
{
|
||||||
|
var y2 = radii.TopLeft / (radii.TopLeft + radii.BottomLeft) * rect.Height;
|
||||||
|
point7.Y = y2;
|
||||||
|
point8.Y = y2;
|
||||||
|
}
|
||||||
|
var vector = new Vector(rect.TopLeft.X, rect.TopLeft.Y);
|
||||||
|
point += vector;
|
||||||
|
point2 += vector;
|
||||||
|
point3 += vector;
|
||||||
|
point4 += vector;
|
||||||
|
point5 += vector;
|
||||||
|
point6 += vector;
|
||||||
|
point7 += vector;
|
||||||
|
point8 += vector;
|
||||||
|
ctx.BeginFigure(point, true, true);
|
||||||
|
ctx.LineTo(point2, true, false);
|
||||||
|
var width = rect.TopRight.X - point2.X;
|
||||||
|
var height = point3.Y - rect.TopRight.Y;
|
||||||
|
if (!DoubleUtil.IsZero(width) || !DoubleUtil.IsZero(height))
|
||||||
|
{
|
||||||
|
ctx.ArcTo(point3, new Size(width, height), 0.0, false, SweepDirection.Clockwise, true, false);
|
||||||
|
}
|
||||||
|
ctx.LineTo(point4, true, false);
|
||||||
|
width = rect.BottomRight.X - point5.X;
|
||||||
|
height = rect.BottomRight.Y - point4.Y;
|
||||||
|
if (!DoubleUtil.IsZero(width) || !DoubleUtil.IsZero(height))
|
||||||
|
{
|
||||||
|
ctx.ArcTo(point5, new Size(width, height), 0.0, false, SweepDirection.Clockwise, true, false);
|
||||||
|
}
|
||||||
|
ctx.LineTo(point6, true, false);
|
||||||
|
width = point6.X - rect.BottomLeft.X;
|
||||||
|
height = rect.BottomLeft.Y - point7.Y;
|
||||||
|
if (!DoubleUtil.IsZero(width) || !DoubleUtil.IsZero(height))
|
||||||
|
{
|
||||||
|
ctx.ArcTo(point7, new Size(width, height), 0.0, false, SweepDirection.Clockwise, true, false);
|
||||||
|
}
|
||||||
|
ctx.LineTo(point8, true, false);
|
||||||
|
width = point.X - rect.TopLeft.X;
|
||||||
|
height = point8.Y - rect.TopLeft.Y;
|
||||||
|
if (!DoubleUtil.IsZero(width) || !DoubleUtil.IsZero(height))
|
||||||
|
{
|
||||||
|
ctx.ArcTo(point, new Size(width, height), 0.0, false, SweepDirection.Clockwise, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public struct Radii
|
||||||
|
{
|
||||||
|
internal Radii(CornerRadius radii, Thickness borders, bool outer)
|
||||||
|
{
|
||||||
|
var left = 0.5 * borders.Left;
|
||||||
|
var top = 0.5 * borders.Top;
|
||||||
|
var right = 0.5 * borders.Right;
|
||||||
|
var bottom = 0.5 * borders.Bottom;
|
||||||
|
if (!outer)
|
||||||
|
{
|
||||||
|
LeftTop = Math.Max(0.0, radii.TopLeft - left);
|
||||||
|
TopLeft = Math.Max(0.0, radii.TopLeft - top);
|
||||||
|
TopRight = Math.Max(0.0, radii.TopRight - top);
|
||||||
|
RightTop = Math.Max(0.0, radii.TopRight - right);
|
||||||
|
RightBottom = Math.Max(0.0, radii.BottomRight - right);
|
||||||
|
BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
|
||||||
|
BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
|
||||||
|
LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (DoubleUtil.IsZero(radii.TopLeft))
|
||||||
|
{
|
||||||
|
LeftTop = (TopLeft = 0.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LeftTop = radii.TopLeft + left;
|
||||||
|
TopLeft = radii.TopLeft + top;
|
||||||
|
}
|
||||||
|
if (DoubleUtil.IsZero(radii.TopRight))
|
||||||
|
{
|
||||||
|
TopRight = (RightTop = 0.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TopRight = radii.TopRight + top;
|
||||||
|
RightTop = radii.TopRight + right;
|
||||||
|
}
|
||||||
|
if (DoubleUtil.IsZero(radii.BottomRight))
|
||||||
|
{
|
||||||
|
RightBottom = (BottomRight = 0.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RightBottom = radii.BottomRight + right;
|
||||||
|
BottomRight = radii.BottomRight + bottom;
|
||||||
|
}
|
||||||
|
if (DoubleUtil.IsZero(radii.BottomLeft))
|
||||||
|
{
|
||||||
|
BottomLeft = (LeftBottom = 0.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BottomLeft = radii.BottomLeft + bottom;
|
||||||
|
LeftBottom = radii.BottomLeft + left;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal double LeftTop;
|
||||||
|
|
||||||
|
internal double TopLeft;
|
||||||
|
|
||||||
|
internal double TopRight;
|
||||||
|
|
||||||
|
internal double RightTop;
|
||||||
|
|
||||||
|
internal double RightBottom;
|
||||||
|
|
||||||
|
internal double BottomRight;
|
||||||
|
|
||||||
|
internal double BottomLeft;
|
||||||
|
|
||||||
|
internal double LeftBottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public class MultiSelectComboBoxItem : ListBoxItem
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public class MultiSelectListBox:ListBox
|
||||||
|
{
|
||||||
|
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||||
|
{
|
||||||
|
return item is MultiSelectComboBoxItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DependencyObject GetContainerForItemOverride()
|
||||||
|
{
|
||||||
|
return new MultiSelectComboBoxItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,630 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
[TemplatePart(Name = "PART_TextBox", Type = typeof(TextBox))]
|
||||||
|
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
|
||||||
|
[TemplatePart(Name = "PART_Selector", Type = typeof(ListBox))]
|
||||||
|
[TemplatePart(Name = "PART_SelectAll", Type = typeof(CheckBox))]
|
||||||
|
[TemplatePart(Name = "PART_SearchSelector", Type = typeof(ListBox))]
|
||||||
|
public class MultiSelectSearchComboBox : Control
|
||||||
|
{
|
||||||
|
private const string TextBoxTemplateName = "PART_TextBox";
|
||||||
|
private const string PopupTemplateName = "PART_Popup";
|
||||||
|
private const string ListBoxTemplateName = "PART_Selector";
|
||||||
|
private const string CheckBoxTemplateName = "PART_SelectAll";
|
||||||
|
private const string ListBoxTemplateNameSearch = "PART_SearchSelector";
|
||||||
|
|
||||||
|
public static readonly RoutedEvent ClosedEvent =
|
||||||
|
EventManager.RegisterRoutedEvent("Closed",
|
||||||
|
RoutingStrategy.Bubble,
|
||||||
|
typeof(RoutedEventHandler),
|
||||||
|
typeof(MultiSelectSearchComboBox));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty DisplayMemberPathProperty =
|
||||||
|
DependencyProperty.Register("DisplayMemberPath",
|
||||||
|
typeof(string),
|
||||||
|
typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(string.Empty));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SelectedValuePathProperty =
|
||||||
|
DependencyProperty.Register("SelectedValuePath",
|
||||||
|
typeof(string),
|
||||||
|
typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(string.Empty));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty TextProperty =
|
||||||
|
DependencyProperty.Register("Text",
|
||||||
|
typeof(string),
|
||||||
|
typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(string.Empty));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ItemsSourceProperty =
|
||||||
|
DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata());
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ItemsSourceSearchProperty =
|
||||||
|
DependencyProperty.Register("ItemsSourceSearch", typeof(IEnumerable), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata());
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SelectAllContentProperty =
|
||||||
|
DependencyProperty.Register("SelectAllContent", typeof(object), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata("全选"));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsSelectAllActiveProperty =
|
||||||
|
DependencyProperty.Register("IsSelectAllActive", typeof(bool), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(false));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty DelimiterProperty =
|
||||||
|
DependencyProperty.Register("Delimiter", typeof(string), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(";"));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IsDropDownOpenProperty =
|
||||||
|
DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(false, OnIsDropDownOpenChanged));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty MaxDropDownHeightProperty =
|
||||||
|
DependencyProperty.Register("MaxDropDownHeight", typeof(double), typeof(MultiSelectSearchComboBox),
|
||||||
|
new UIPropertyMetadata(SystemParameters.PrimaryScreenHeight / 3.0, OnMaxDropDownHeightChanged));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SelectedItemsProperty =
|
||||||
|
DependencyProperty.Register("SelectedItems", typeof(IList), typeof(MultiSelectSearchComboBox),
|
||||||
|
new FrameworkPropertyMetadata(new ArrayList(),
|
||||||
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
|
||||||
|
OnSelectedItemsChanged));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SearchWatermarkProperty =
|
||||||
|
DependencyProperty.Register("SearchWatermark",
|
||||||
|
typeof(string),
|
||||||
|
typeof(MultiSelectSearchComboBox),
|
||||||
|
new PropertyMetadata(string.Empty));
|
||||||
|
|
||||||
|
private CheckBox _checkBox;
|
||||||
|
private ListBox _listBox;
|
||||||
|
private ListBox _listBoxSearch;
|
||||||
|
private Popup _popup;
|
||||||
|
private TextBox _textBox;
|
||||||
|
private List<object> selectedItems;
|
||||||
|
|
||||||
|
private List<object> selectedList;
|
||||||
|
private List<object> selectedSearchList;
|
||||||
|
|
||||||
|
private bool _isTemplateApplied = false;
|
||||||
|
private IList _pendingSelectedItems;
|
||||||
|
|
||||||
|
private string theLastText;
|
||||||
|
|
||||||
|
static MultiSelectSearchComboBox()
|
||||||
|
{
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(MultiSelectSearchComboBox),
|
||||||
|
new FrameworkPropertyMetadata(typeof(MultiSelectSearchComboBox)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Delimiter
|
||||||
|
{
|
||||||
|
get => (string)GetValue(DelimiterProperty);
|
||||||
|
set => SetValue(DelimiterProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SelectedValuePath
|
||||||
|
{
|
||||||
|
get => (string)GetValue(SelectedValuePathProperty);
|
||||||
|
set => SetValue(SelectedValuePathProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayMemberPath
|
||||||
|
{
|
||||||
|
get => (string)GetValue(DisplayMemberPathProperty);
|
||||||
|
set => SetValue(DisplayMemberPathProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get => (string)GetValue(TextProperty);
|
||||||
|
set => SetValue(TextProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable ItemsSource
|
||||||
|
{
|
||||||
|
get => (IEnumerable)GetValue(ItemsSourceProperty);
|
||||||
|
set => SetValue(ItemsSourceProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable ItemsSourceSearch
|
||||||
|
{
|
||||||
|
get => (IEnumerable)GetValue(ItemsSourceSearchProperty);
|
||||||
|
set => SetValue(ItemsSourceSearchProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object SelectAllContent
|
||||||
|
{
|
||||||
|
get => GetValue(SelectAllContentProperty);
|
||||||
|
set => SetValue(SelectAllContentProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsSelectAllActive
|
||||||
|
{
|
||||||
|
get => (bool)GetValue(IsSelectAllActiveProperty);
|
||||||
|
set => SetValue(IsSelectAllActiveProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDropDownOpen
|
||||||
|
{
|
||||||
|
get => (bool)GetValue(IsDropDownOpenProperty);
|
||||||
|
set => SetValue(IsDropDownOpenProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double MaxDropDownHeight
|
||||||
|
{
|
||||||
|
get => (double)GetValue(MaxDropDownHeightProperty);
|
||||||
|
set => SetValue(MaxDropDownHeightProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList SelectedItems
|
||||||
|
{
|
||||||
|
get => (IList)GetValue(SelectedItemsProperty);
|
||||||
|
set => SetValue(SelectedItemsProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SearchWatermark
|
||||||
|
{
|
||||||
|
get => (string)GetValue(SearchWatermarkProperty);
|
||||||
|
set => SetValue(SearchWatermarkProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport(Win32.User32)]
|
||||||
|
private static extern IntPtr SetFocus(IntPtr hWnd);
|
||||||
|
|
||||||
|
public event RoutedEventHandler Closed
|
||||||
|
{
|
||||||
|
add => AddHandler(ClosedEvent, value);
|
||||||
|
remove => RemoveHandler(ClosedEvent, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
|
||||||
|
selectedList = new List<object>();
|
||||||
|
selectedSearchList = new List<object>();
|
||||||
|
selectedItems = new List<object>();
|
||||||
|
_textBox = GetTemplateChild(TextBoxTemplateName) as TextBox;
|
||||||
|
_popup = GetTemplateChild(PopupTemplateName) as Popup;
|
||||||
|
if (_popup != null)
|
||||||
|
_popup.GotFocus += OnPopup_GotFocus;
|
||||||
|
_listBox = GetTemplateChild(ListBoxTemplateName) as ListBox;
|
||||||
|
|
||||||
|
_checkBox = GetTemplateChild(CheckBoxTemplateName) as CheckBox;
|
||||||
|
_listBoxSearch = GetTemplateChild(ListBoxTemplateNameSearch) as ListBox;
|
||||||
|
if (_textBox != null)
|
||||||
|
{
|
||||||
|
_textBox.TextChanged -= OnTextbox_TextChanged;
|
||||||
|
_textBox.TextChanged += OnTextbox_TextChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_checkBox != null)
|
||||||
|
{
|
||||||
|
_checkBox.Checked -= OnCheckBox_Checked;
|
||||||
|
_checkBox.Unchecked -= OnCheckBox_Unchecked;
|
||||||
|
_checkBox.Checked += OnCheckBox_Checked;
|
||||||
|
_checkBox.Unchecked += OnCheckBox_Unchecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_listBox != null)
|
||||||
|
{
|
||||||
|
_listBox.IsVisibleChanged -= OnListBox_IsVisibleChanged;
|
||||||
|
_listBox.IsVisibleChanged += OnListBox_IsVisibleChanged;
|
||||||
|
_listBox.SelectionChanged -= OnListBox_SelectionChanged;
|
||||||
|
_listBox.SelectionChanged += OnListBox_SelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_listBoxSearch != null)
|
||||||
|
{
|
||||||
|
_listBoxSearch.IsVisibleChanged -= OnListBoxSearch_IsVisibleChanged;
|
||||||
|
_listBoxSearch.IsVisibleChanged += OnListBoxSearch_IsVisibleChanged;
|
||||||
|
_listBoxSearch.SelectionChanged -= OnListBoxSearch_SelectionChanged;
|
||||||
|
_listBoxSearch.SelectionChanged += OnListBoxSearch_SelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标记模板已应用
|
||||||
|
_isTemplateApplied = true;
|
||||||
|
|
||||||
|
// 处理之前暂存的 SelectedItems
|
||||||
|
if (_pendingSelectedItems != null)
|
||||||
|
{
|
||||||
|
HandleSelectedItemsChanged(_pendingSelectedItems);
|
||||||
|
_pendingSelectedItems = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnListBoxSearch_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
UpdateIsChecked(_listBoxSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnListBox_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
{
|
||||||
|
foreach (var item in selectedSearchList)
|
||||||
|
if (!_listBox.SelectedItems.Contains(item))
|
||||||
|
_listBox.SelectedItems.Add(item);
|
||||||
|
UpdateIsChecked(_listBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateIsChecked(ListBox listBox)
|
||||||
|
{
|
||||||
|
_checkBox.Checked -= OnCheckBox_Checked;
|
||||||
|
if (listBox.Items.Count > 0 && listBox.Items.Count == listBox.SelectedItems.Count)
|
||||||
|
{
|
||||||
|
if (_checkBox.IsChecked != true)
|
||||||
|
_checkBox.IsChecked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (listBox.SelectedItems.Count == 0)
|
||||||
|
_checkBox.IsChecked = false;
|
||||||
|
else
|
||||||
|
_checkBox.IsChecked = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_checkBox.Checked += OnCheckBox_Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPopup_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var source = (HwndSource)PresentationSource.FromVisual(_popup.Child);
|
||||||
|
if (source != null)
|
||||||
|
{
|
||||||
|
SetFocus(source.Handle);
|
||||||
|
_textBox.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCheckBox_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_listBoxSearch.Visibility == Visibility.Visible)
|
||||||
|
_listBoxSearch.UnselectAll();
|
||||||
|
else
|
||||||
|
_listBox.UnselectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCheckBox_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_listBoxSearch.Visibility == Visibility.Visible)
|
||||||
|
_listBoxSearch.SelectAll();
|
||||||
|
else
|
||||||
|
_listBox.SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Combination()
|
||||||
|
{
|
||||||
|
var seletedName = new List<string>();
|
||||||
|
foreach (var item in _listBox.SelectedItems)
|
||||||
|
{
|
||||||
|
var name = GetDisplayText(item);
|
||||||
|
if (!string.IsNullOrWhiteSpace(name))
|
||||||
|
seletedName.Add(name);
|
||||||
|
else
|
||||||
|
seletedName.Add(item.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in _listBoxSearch.SelectedItems)
|
||||||
|
{
|
||||||
|
if (_listBox.SelectedItems.Contains(item))
|
||||||
|
continue;
|
||||||
|
var name = GetDisplayText(item);
|
||||||
|
if (!string.IsNullOrWhiteSpace(name))
|
||||||
|
seletedName.Add(name);
|
||||||
|
else
|
||||||
|
seletedName.Add(item.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Text = string.Join(Delimiter, seletedName.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.RemovedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in e.RemovedItems)
|
||||||
|
{
|
||||||
|
if (_checkBox.IsChecked == true)
|
||||||
|
{
|
||||||
|
_checkBox.Unchecked -= OnCheckBox_Unchecked;
|
||||||
|
if (_listBox.Items.Count == 1)
|
||||||
|
_checkBox.IsChecked = false;
|
||||||
|
else
|
||||||
|
_checkBox.IsChecked = null;
|
||||||
|
_checkBox.Unchecked += OnCheckBox_Unchecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_listBoxSearch.SelectedItems.Contains(item))
|
||||||
|
_listBoxSearch.SelectedItems.Remove(item);
|
||||||
|
if (selectedSearchList.Contains(item))
|
||||||
|
selectedSearchList.Remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectionChecked(_listBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (e.AddedItems.Count > 0)
|
||||||
|
SelectionChecked(_listBox);
|
||||||
|
Combination();
|
||||||
|
var selectedItems = _listBox.SelectedItems;
|
||||||
|
if (SelectedItems == null)
|
||||||
|
SelectedItems = selectedItems;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var item in selectedItems)
|
||||||
|
{
|
||||||
|
if (!SelectedItems.Contains(item))
|
||||||
|
SelectedItems.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnListBoxSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!_listBoxSearch.IsVisible)
|
||||||
|
return;
|
||||||
|
if (e.RemovedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in e.RemovedItems)
|
||||||
|
{
|
||||||
|
if (selectedSearchList.Contains(item))
|
||||||
|
selectedSearchList.Remove(item);
|
||||||
|
if (_listBoxSearch.Items.Contains(item))
|
||||||
|
{
|
||||||
|
if (_listBox.SelectedItems.Contains(item))
|
||||||
|
_listBox.SelectedItems.Remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedList.Contains(item))
|
||||||
|
selectedList.Remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Combination();
|
||||||
|
SelectionChecked(_listBoxSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.AddedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in e.AddedItems)
|
||||||
|
if (!_listBox.SelectedItems.Contains(item))
|
||||||
|
_listBox.SelectedItems.Add(item);
|
||||||
|
Combination();
|
||||||
|
SelectionChecked(_listBoxSearch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectionChecked(ListBox listbox)
|
||||||
|
{
|
||||||
|
if (listbox.SelectedItems.Count > 0
|
||||||
|
&&
|
||||||
|
listbox.Items.Count == listbox.SelectedItems.Count)
|
||||||
|
{
|
||||||
|
_checkBox.Checked -= OnCheckBox_Checked;
|
||||||
|
_checkBox.IsChecked = true;
|
||||||
|
_checkBox.Checked += OnCheckBox_Checked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_checkBox.Checked -= OnCheckBox_Checked;
|
||||||
|
if (listbox.SelectedItems.Count > 0
|
||||||
|
&&
|
||||||
|
listbox.Items.Count == listbox.SelectedItems.Count)
|
||||||
|
{
|
||||||
|
if (_checkBox.IsChecked != true)
|
||||||
|
_checkBox.IsChecked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (listbox.SelectedItems.Count == 0)
|
||||||
|
_checkBox.IsChecked = false;
|
||||||
|
else
|
||||||
|
_checkBox.IsChecked = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_checkBox.Checked += OnCheckBox_Checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetDisplayText(object dataItem, string path = null)
|
||||||
|
{
|
||||||
|
if (dataItem == null) return string.Empty;
|
||||||
|
return GetPropertyValue(dataItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTextbox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(theLastText)) theLastText = _textBox.Text;
|
||||||
|
SearchText(_textBox.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SearchText(string _text)
|
||||||
|
{
|
||||||
|
var text = _text;
|
||||||
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
|
{
|
||||||
|
if (_listBoxSearch.Visibility != Visibility.Collapsed)
|
||||||
|
_listBoxSearch.Visibility = Visibility.Collapsed;
|
||||||
|
if (_listBox.Visibility != Visibility.Visible)
|
||||||
|
_listBox.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_listBoxSearch.Visibility != Visibility.Visible)
|
||||||
|
_listBoxSearch.Visibility = Visibility.Visible;
|
||||||
|
if (_listBox.Visibility != Visibility.Collapsed)
|
||||||
|
_listBox.Visibility = Visibility.Collapsed;
|
||||||
|
var listSearch = new List<object>();
|
||||||
|
foreach (var item in _listBox.Items)
|
||||||
|
{
|
||||||
|
var str = GetPropertyValue(item);
|
||||||
|
if (string.IsNullOrWhiteSpace(str))
|
||||||
|
str = item.ToString();
|
||||||
|
if (!string.IsNullOrWhiteSpace(str))
|
||||||
|
if (str.ToUpperInvariant().Contains(text.ToUpperInvariant()))
|
||||||
|
listSearch.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in selectedList)
|
||||||
|
if (!listSearch.Contains(item))
|
||||||
|
listSearch.Add(item);
|
||||||
|
|
||||||
|
var lastItem = ItemsSourceSearch;
|
||||||
|
ItemsSourceSearch = listSearch;
|
||||||
|
SelectionChecked(_listBoxSearch);
|
||||||
|
selectedItems.Clear();
|
||||||
|
foreach (var item in _listBoxSearch.Items)
|
||||||
|
if (_listBox.SelectedItems.Contains(item))
|
||||||
|
if (!_listBoxSearch.SelectedItems.Contains(item))
|
||||||
|
_listBoxSearch.SelectedItems.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetPropertyValue(object item)
|
||||||
|
{
|
||||||
|
var result = string.Empty;
|
||||||
|
var nameParts = DisplayMemberPath.Split('.');
|
||||||
|
if (nameParts.Length == 1)
|
||||||
|
{
|
||||||
|
var property = item.GetType().GetProperty(DisplayMemberPath);
|
||||||
|
if (property != null)
|
||||||
|
return (property.GetValue(item, null) ?? string.Empty).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.ToUpperInvariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnIsDropDownOpenChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var multiSelectionSearchComboBox = o as MultiSelectSearchComboBox;
|
||||||
|
if (multiSelectionSearchComboBox != null)
|
||||||
|
multiSelectionSearchComboBox.OnIsOpenChanged((bool)e.OldValue, (bool)e.NewValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnIsOpenChanged(bool oldValue, bool newValue)
|
||||||
|
{
|
||||||
|
if (!newValue)
|
||||||
|
RaiseRoutedEvent(ClosedEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RaiseRoutedEvent(RoutedEvent routedEvent)
|
||||||
|
{
|
||||||
|
var args = new RoutedEventArgs(routedEvent, this);
|
||||||
|
RaiseEvent(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnMaxDropDownHeightChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var comboBox = o as MultiSelectSearchComboBox;
|
||||||
|
if (comboBox != null)
|
||||||
|
comboBox.OnMaxDropDownHeightChanged((double)e.OldValue, (double)e.NewValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnMaxDropDownHeightChanged(double oldValue, double newValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnSelectedItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
var mltiSelectionSearchComboBox = d as MultiSelectSearchComboBox;
|
||||||
|
|
||||||
|
if (e.NewValue != null)
|
||||||
|
{
|
||||||
|
var collection = e.NewValue as IList;
|
||||||
|
if (collection.Count <= 0) return;
|
||||||
|
|
||||||
|
//mltiSelectionSearchComboBox._listBox.SelectionChanged -=
|
||||||
|
// mltiSelectionSearchComboBox.OnListBox_SelectionChanged;
|
||||||
|
// foreach (var item in collection)
|
||||||
|
// {
|
||||||
|
// var name = mltiSelectionSearchComboBox.GetPropertyValue(item);
|
||||||
|
// object model = null;
|
||||||
|
// if (!string.IsNullOrWhiteSpace(name))
|
||||||
|
// model = mltiSelectionSearchComboBox._listBox.ItemsSource.OfType<object>().FirstOrDefault(h =>
|
||||||
|
// mltiSelectionSearchComboBox.GetPropertyValue(h) == name);
|
||||||
|
// else
|
||||||
|
// model = mltiSelectionSearchComboBox._listBox.ItemsSource.OfType<object>()
|
||||||
|
// .FirstOrDefault(h => h == item);
|
||||||
|
// if (model != null && !mltiSelectionSearchComboBox._listBox.SelectedItems.Contains(item))
|
||||||
|
// mltiSelectionSearchComboBox._listBox.SelectedItems.Add(model);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// mltiSelectionSearchComboBox._listBox.SelectionChanged +=
|
||||||
|
// mltiSelectionSearchComboBox.OnListBox_SelectionChanged;
|
||||||
|
// mltiSelectionSearchComboBox.Combination();
|
||||||
|
// 如果模板未应用,暂存 SelectedItems
|
||||||
|
if (!mltiSelectionSearchComboBox._isTemplateApplied)
|
||||||
|
{
|
||||||
|
mltiSelectionSearchComboBox._pendingSelectedItems = e.NewValue as IList;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 模板已应用,正常处理
|
||||||
|
mltiSelectionSearchComboBox.HandleSelectedItemsChanged(e.NewValue as IList);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleSelectedItemsChanged(IList newSelectedItems)
|
||||||
|
{
|
||||||
|
if (newSelectedItems == null || _listBox == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_listBox.SelectionChanged -= OnListBox_SelectionChanged;
|
||||||
|
|
||||||
|
// 清空并重新添加选中项
|
||||||
|
_listBox.SelectedItems.Clear();
|
||||||
|
foreach (var item in newSelectedItems)
|
||||||
|
{
|
||||||
|
var model = FindItemInItemsSource(item);
|
||||||
|
if (model != null && !_listBox.SelectedItems.Contains(model))
|
||||||
|
_listBox.SelectedItems.Add(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
_listBox.SelectionChanged += OnListBox_SelectionChanged;
|
||||||
|
Combination(); // 更新显示文本
|
||||||
|
}
|
||||||
|
private object FindItemInItemsSource(object targetItem)
|
||||||
|
{
|
||||||
|
if (targetItem == null) return null;
|
||||||
|
|
||||||
|
// 根据 DisplayMemberPath 或直接比较查找匹配项
|
||||||
|
var displayPath = DisplayMemberPath;
|
||||||
|
if (string.IsNullOrEmpty(displayPath))
|
||||||
|
return targetItem;
|
||||||
|
|
||||||
|
var items = _listBox.ItemsSource?.OfType<object>().ToList();
|
||||||
|
if (items == null) return null;
|
||||||
|
|
||||||
|
var property = targetItem.GetType().GetProperty(displayPath);
|
||||||
|
if (property == null) return null;
|
||||||
|
|
||||||
|
var targetValue = property.GetValue(targetItem)?.ToString();
|
||||||
|
return items.FirstOrDefault(i =>
|
||||||
|
{
|
||||||
|
var iValue = i.GetType().GetProperty(displayPath)?.GetValue(i)?.ToString();
|
||||||
|
return iValue == targetValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 当不需要使用Grid的分行分列,则可使用 SmallPanel
|
||||||
|
/// </summary>
|
||||||
|
public class SmallPanel : Panel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Content measurement.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="constraint">Constraint</param>
|
||||||
|
/// <returns>Desired size</returns>
|
||||||
|
protected override Size MeasureOverride(Size constraint)
|
||||||
|
{
|
||||||
|
Size gridDesiredSize = new Size();
|
||||||
|
UIElementCollection children = InternalChildren;
|
||||||
|
|
||||||
|
for (int i = 0, count = children.Count; i < count; ++i)
|
||||||
|
{
|
||||||
|
UIElement child = children[i];
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
child.Measure(constraint);
|
||||||
|
gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
|
||||||
|
gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (gridDesiredSize);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Content arrangement.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="arrangeSize">Arrange size</param>
|
||||||
|
protected override Size ArrangeOverride(Size arrangeSize)
|
||||||
|
{
|
||||||
|
UIElementCollection children = InternalChildren;
|
||||||
|
for (int i = 0, count = children.Count; i < count; ++i)
|
||||||
|
{
|
||||||
|
UIElement child = children[i];
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
child.Arrange(new Rect(arrangeSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (arrangeSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public class WDBorder : Border
|
||||||
|
{
|
||||||
|
public static readonly DependencyPropertyKey ContentClipPropertyKey =
|
||||||
|
DependencyProperty.RegisterReadOnly("ContentClip", typeof(Geometry), typeof(WDBorder),
|
||||||
|
new PropertyMetadata(null));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ContentClipProperty = ContentClipPropertyKey.DependencyProperty;
|
||||||
|
|
||||||
|
public Geometry ContentClip
|
||||||
|
{
|
||||||
|
get => (Geometry)GetValue(ContentClipProperty);
|
||||||
|
set => SetValue(ContentClipProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Geometry CalculateContentClip()
|
||||||
|
{
|
||||||
|
var borderThickness = BorderThickness;
|
||||||
|
var cornerRadius = CornerRadius;
|
||||||
|
var renderSize = RenderSize;
|
||||||
|
var width = renderSize.Width - borderThickness.Left - borderThickness.Right;
|
||||||
|
var height = renderSize.Height - borderThickness.Top - borderThickness.Bottom;
|
||||||
|
if (width > 0.0 && height > 0.0)
|
||||||
|
{
|
||||||
|
var rect = new Rect(0.0, 0.0, width, height);
|
||||||
|
var radii = new GeometryHelper.Radii(cornerRadius, borderThickness, false);
|
||||||
|
var streamGeometry = new StreamGeometry();
|
||||||
|
using (var streamGeometryContext = streamGeometry.Open())
|
||||||
|
{
|
||||||
|
GeometryHelper.GenerateGeometry(streamGeometryContext, rect, radii);
|
||||||
|
streamGeometry.Freeze();
|
||||||
|
return streamGeometry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnRender(DrawingContext dc)
|
||||||
|
{
|
||||||
|
SetValue(ContentClipPropertyKey, CalculateContentClip());
|
||||||
|
base.OnRender(dc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,170 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.CustomControl
|
||||||
|
{
|
||||||
|
public static class Win32
|
||||||
|
{
|
||||||
|
public const string
|
||||||
|
User32 = "user32.dll",
|
||||||
|
Gdi32 = "gdi32.dll",
|
||||||
|
GdiPlus = "gdiplus.dll",
|
||||||
|
Kernel32 = "kernel32.dll",
|
||||||
|
Shell32 = "shell32.dll",
|
||||||
|
MsImg = "msimg32.dll",
|
||||||
|
NTdll = "ntdll.dll",
|
||||||
|
DwmApi = "dwmapi.dll",
|
||||||
|
Winmm = "winmm.dll",
|
||||||
|
Shcore = "Shcore.dll";
|
||||||
|
//查找窗口的委托 查找逻辑
|
||||||
|
public delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern IntPtr FindWindow(string className, string winName);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern IntPtr SendMessageTimeout(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam,
|
||||||
|
uint fuFlage, uint timeout, IntPtr result);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern bool EnumWindows(EnumWindowsProc proc, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className,
|
||||||
|
string winName);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern IntPtr SetParent(IntPtr hwnd, IntPtr parentHwnd);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
|
||||||
|
|
||||||
|
[DllImport(Winmm)]
|
||||||
|
public static extern long mciSendString(string strCommand, StringBuilder strReturn,
|
||||||
|
int iReturnLength, IntPtr hwndCallback);
|
||||||
|
|
||||||
|
#region WINAPI DLL Imports
|
||||||
|
|
||||||
|
[DllImport(Gdi32, ExactSpelling = true, PreserveSig = true, SetLastError = true)]
|
||||||
|
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
|
||||||
|
|
||||||
|
[DllImport(Gdi32)]
|
||||||
|
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
|
||||||
|
|
||||||
|
[DllImport(Gdi32, SetLastError = true)]
|
||||||
|
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
|
||||||
|
|
||||||
|
[DllImport(Gdi32)]
|
||||||
|
public static extern bool DeleteObject(IntPtr hObject);
|
||||||
|
|
||||||
|
[DllImport(Gdi32)]
|
||||||
|
public static extern IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel,
|
||||||
|
IntPtr lpvBits);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport(User32)]
|
||||||
|
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
|
||||||
|
|
||||||
|
[DllImport(Gdi32, EntryPoint = "DeleteDC")]
|
||||||
|
public static extern IntPtr DeleteDC(IntPtr hDc);
|
||||||
|
|
||||||
|
|
||||||
|
public const int SM_CXSCREEN = 0;
|
||||||
|
|
||||||
|
public const int SM_CYSCREEN = 1;
|
||||||
|
|
||||||
|
[DllImport(User32, EntryPoint = "GetDesktopWindow")]
|
||||||
|
public static extern IntPtr GetDesktopWindow();
|
||||||
|
|
||||||
|
[DllImport(User32, EntryPoint = "GetSystemMetrics")]
|
||||||
|
public static extern int GetSystemMetrics(int abc);
|
||||||
|
|
||||||
|
[DllImport(User32, EntryPoint = "GetWindowDC")]
|
||||||
|
public static extern IntPtr GetWindowDC(int ptr);
|
||||||
|
|
||||||
|
public struct DeskTopSize
|
||||||
|
{
|
||||||
|
public int cx;
|
||||||
|
public int cy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TernaryRasterOperations : uint
|
||||||
|
{
|
||||||
|
/// <summary>dest = source</summary>
|
||||||
|
SRCCOPY = 0x00CC0020,
|
||||||
|
|
||||||
|
/// <summary>dest = source OR dest</summary>
|
||||||
|
SRCPAINT = 0x00EE0086,
|
||||||
|
|
||||||
|
/// <summary>dest = source AND dest</summary>
|
||||||
|
SRCAND = 0x008800C6,
|
||||||
|
|
||||||
|
/// <summary>dest = source XOR dest</summary>
|
||||||
|
SRCINVERT = 0x00660046,
|
||||||
|
|
||||||
|
/// <summary>dest = source AND (NOT dest)</summary>
|
||||||
|
SRCERASE = 0x00440328,
|
||||||
|
|
||||||
|
/// <summary>dest = (NOT source)</summary>
|
||||||
|
NOTSRCCOPY = 0x00330008,
|
||||||
|
|
||||||
|
/// <summary>dest = (NOT src) AND (NOT dest)</summary>
|
||||||
|
NOTSRCERASE = 0x001100A6,
|
||||||
|
|
||||||
|
/// <summary>dest = (source AND pattern)</summary>
|
||||||
|
MERGECOPY = 0x00C000CA,
|
||||||
|
|
||||||
|
/// <summary>dest = (NOT source) OR dest</summary>
|
||||||
|
MERGEPAINT = 0x00BB0226,
|
||||||
|
|
||||||
|
/// <summary>dest = pattern</summary>
|
||||||
|
PATCOPY = 0x00F00021,
|
||||||
|
|
||||||
|
/// <summary>dest = DPSnoo</summary>
|
||||||
|
PATPAINT = 0x00FB0A09,
|
||||||
|
|
||||||
|
/// <summary>dest = pattern XOR dest</summary>
|
||||||
|
PATINVERT = 0x005A0049,
|
||||||
|
|
||||||
|
/// <summary>dest = (NOT dest)</summary>
|
||||||
|
DSTINVERT = 0x00550009,
|
||||||
|
|
||||||
|
/// <summary>dest = BLACK</summary>
|
||||||
|
BLACKNESS = 0x00000042,
|
||||||
|
|
||||||
|
/// <summary>dest = WHITE</summary>
|
||||||
|
WHITENESS = 0x00FF0062
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport(Gdi32)]
|
||||||
|
public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc,
|
||||||
|
int nXSrc, int nYSrc, TernaryRasterOperations dwRop);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置鼠标的坐标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">横坐标</param>
|
||||||
|
/// <param name="y">纵坐标</param>
|
||||||
|
[DllImport(User32)]
|
||||||
|
public extern static void SetCursorPos(int x, int y);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="DI_Electrical.Views.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:DI_Electrical.Views"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Border
|
||||||
|
Height="30"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Background="{StaticResource ColorPrimary}"
|
||||||
|
MouseDown="Border_MouseDown">
|
||||||
|
<Grid>
|
||||||
|
<Label
|
||||||
|
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,37 @@
|
|||||||
|
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 DI_Electrical.Views
|
||||||
|
{
|
||||||
|
/// <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 方法
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
58
newFront/c#前端/DI-Electrical/Views/Dialog/DialogInput.xaml
Normal file
58
newFront/c#前端/DI-Electrical/Views/Dialog/DialogInput.xaml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<UserControl x:Class="DI_Electrical.Views.Dialog.DialogInput"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views.Dialog"
|
||||||
|
xmlns:local2="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<!-- 关键:设置窗口根据内容自动调整尺寸 -->
|
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||||
|
|
||||||
|
<Setter Property="WindowState" Value="Normal"/>
|
||||||
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="35" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local2:customWindowTitleBar />
|
||||||
|
<Label Grid.Row="1" Content="{Binding TextRemark}" Height="auto" VerticalAlignment="Bottom" Margin="10,0,0,0" Width="auto" />
|
||||||
|
|
||||||
|
<TextBox Grid.Row="2"
|
||||||
|
Style="{StaticResource sysTextAreaInfo}"
|
||||||
|
Text="{Binding TextInfo, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Grid.Row="3"
|
||||||
|
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>
|
28
newFront/c#前端/DI-Electrical/Views/Dialog/DialogInput.xaml.cs
Normal file
28
newFront/c#前端/DI-Electrical/Views/Dialog/DialogInput.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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 DI_Electrical.Views.Dialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogInput.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogInput : UserControl
|
||||||
|
{
|
||||||
|
public DialogInput()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,756 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="DI_Electrical.Views.Dialog.DialogSignalManagements.DialogSignalManagement"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:CustomControl="clr-namespace:DI_Electrical.Views.CustomControl"
|
||||||
|
xmlns:StyleSelectors="clr-namespace:DI_Electrical.Style"
|
||||||
|
xmlns:cvt="clr-namespace:DI_Electrical.Helper.Converter"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views.Dialog.DialogSignalManagements"
|
||||||
|
xmlns:local2="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<Setter Property="Width" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}" />
|
||||||
|
<Setter Property="Height" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}" />
|
||||||
|
|
||||||
|
<Setter Property="WindowState" Value="Normal" />
|
||||||
|
<Setter Property="WindowStyle" Value="None" />
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize" />
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<!-- 转换器 -->
|
||||||
|
<cvt:RadGridViewRowToBoolConverter x:Key="RowToBoolCvt" />
|
||||||
|
<cvt:CollectionToStringConverter x:Key="CollectionToStringConverter" />
|
||||||
|
|
||||||
|
<!-- 模版样式 -->
|
||||||
|
<DataTemplate x:Key="CellTemplate1">
|
||||||
|
<TextBlock Text="{Binding WHCPUs, Converter={StaticResource CollectionToStringConverter}}" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CellEditTemplate1">
|
||||||
|
<CustomControl:MultiSelectSearchComboBox
|
||||||
|
x:Name="MultiSelectSearchComboBox1"
|
||||||
|
Width="auto"
|
||||||
|
Height="auto"
|
||||||
|
Delimiter="|"
|
||||||
|
DisplayMemberPath="DataItemName"
|
||||||
|
IsSelectAllActive="True"
|
||||||
|
ItemsSource="{Binding DataContext.WHCPUs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}"
|
||||||
|
SelectedItems="{Binding WHCPUs}"
|
||||||
|
SelectedValuePath="DataItemCode" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CellTemplate2">
|
||||||
|
<TextBlock Text="{Binding ECRCPUs, Converter={StaticResource CollectionToStringConverter}}" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CellEditTemplate2">
|
||||||
|
<CustomControl:MultiSelectSearchComboBox
|
||||||
|
x:Name="MultiSelectSearchComboBox1"
|
||||||
|
Width="auto"
|
||||||
|
Height="auto"
|
||||||
|
Delimiter="|"
|
||||||
|
DisplayMemberPath="DataItemName"
|
||||||
|
IsSelectAllActive="True"
|
||||||
|
ItemsSource="{Binding DataContext.ECRCPUs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}"
|
||||||
|
SelectedItems="{Binding ECRCPUs}"
|
||||||
|
SelectedValuePath="DataItemCode" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CellTemplate3">
|
||||||
|
<TextBlock Text="{Binding ShipOfficeCPUs, Converter={StaticResource CollectionToStringConverter}}" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="CellEditTemplate3">
|
||||||
|
<CustomControl:MultiSelectSearchComboBox
|
||||||
|
x:Name="MultiSelectSearchComboBox1"
|
||||||
|
Width="auto"
|
||||||
|
Height="auto"
|
||||||
|
Delimiter="|"
|
||||||
|
DisplayMemberPath="DataItemName"
|
||||||
|
IsSelectAllActive="True"
|
||||||
|
ItemsSource="{Binding DataContext.ShipOfficeCPUs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}"
|
||||||
|
SelectedItems="{Binding ShipOfficeCPUs}"
|
||||||
|
SelectedValuePath="DataItemCode" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<Style x:Key="buttoustyle1" TargetType="telerik:RadButton">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Content, ElementName=myButton}" Value="显示全部">
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 定义展开按钮样式 -->
|
||||||
|
<Style x:Key="ExpandButtonStyle" TargetType="telerik:GridViewToggleButton" />
|
||||||
|
|
||||||
|
<Style x:Key="cellstyle1" TargetType="{x:Type telerik:GridViewRow}">
|
||||||
|
<Setter Property="Background" Value="White" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ToDeleteStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="#db9fa9" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="NewStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="#fc7c2c" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="UsedStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="#49ac64" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ConfirmedStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="DarkGray" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ReopenStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="#1c3df5" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="deletedStatusStyle" TargetType="telerik:GridViewRow">
|
||||||
|
<Setter Property="Foreground" Value="DarkGray" />
|
||||||
|
</Style>
|
||||||
|
<cvt:StatusToColourConverter x:Key="converter" />
|
||||||
|
<StyleSelectors:ConditionalStyleSelector x:Key="selector" ConditionConverter="{StaticResource converter}">
|
||||||
|
<StyleSelectors:ConditionalStyleSelector.Rules>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource ToDeleteStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>ToDelete</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource NewStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>New</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource UsedStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>Used</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource ConfirmedStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>Confirmed</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource ReopenStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>Reopen</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
<StyleSelectors:ConditionalStyleRule Style="{StaticResource deletedStatusStyle}">
|
||||||
|
<StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>deleted</sys:String>
|
||||||
|
</StyleSelectors:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelectors:ConditionalStyleRule>
|
||||||
|
</StyleSelectors:ConditionalStyleSelector.Rules>
|
||||||
|
</StyleSelectors:ConditionalStyleSelector>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
|
||||||
|
</UserControl.Resources>
|
||||||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local2:customWindowTitleBar />
|
||||||
|
<Grid Grid.Row="1" Background="#5d6b99">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="5,0,0,0"
|
||||||
|
Style="{StaticResource sysLabel}"
|
||||||
|
Text="{Binding pojectName}" />
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Width="200"
|
||||||
|
Style="{StaticResource sysLabel}"
|
||||||
|
Text="{Binding count}" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="保存"
|
||||||
|
Content="保存"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M13,3 L3,3 L3,21 L21,21 L21,11 M15,3 L15,8 L21,8 M7,13 L11,17 L17,7"
|
||||||
|
IconPlacement="Left"
|
||||||
|
IconSize="16" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="退出"
|
||||||
|
Content="退出"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M12,3 L12,9 M12,21 L12,15 M15,18 L21,12 L15,6 M9,6 L3,12 L9,18"
|
||||||
|
IconPlacement="Left"
|
||||||
|
IconSize="16" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="通知信息"
|
||||||
|
Content="通知信息"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M12 2C8 2 6 5 6 9L4 18H20L18 9C18 5 16 2 12 2M12 22C10.9 22 10 21.1 10 20H14C14 21.1 13.1 22 12 22Z M12 5C15 5 16 7 16 9L17 16H7L8 9C8 7 9 5 12 5 M12 12L12 14 M12 8L12 10"
|
||||||
|
IconPlacement="Left"
|
||||||
|
IconSize="16" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="历史记录"
|
||||||
|
Content="历史记录"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M12,3 L12,9 M12,21 L12,15 M15,18 L21,12 L15,6 M9,6 L3,12 L9,18"
|
||||||
|
IconPlacement="Left"
|
||||||
|
IconSize="16" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
x:Name="myButton"
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="回收站"
|
||||||
|
Content="{Binding ButtonContent}"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M5 6L6 20H18L19 6 M3 6H21 M8 6L9 3H15L16 6"
|
||||||
|
IconPlacement="Left"
|
||||||
|
IconSize="16" />
|
||||||
|
<StackPanel Margin="5" Orientation="Horizontal">
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="7"
|
||||||
|
Width="120"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Text="{Binding SearchText}" />
|
||||||
|
<CustomControl:IconButton
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="搜索框"
|
||||||
|
Content=""
|
||||||
|
Foreground="Black"
|
||||||
|
IconData="M9.5,3 C13.09,3 16,5.91 16,9.5 C16,11.11 15.41,12.59 14.44,13.73 L14.71,14 L20.5,19.79 L19.79,20.5 L14,14.71 L13.73,14.44 C12.59,15.41 11.11,16 9.5,16 C5.91,16 3,13.09 3,9.5 C3,5.91 5.91,3 9.5,3 M9.5,5 C7,5 5,7 5,9.5 C5,12 7,14 9.5,14 C12,14 14,12 14,9.5 C14,7 12,5 9.5,5"
|
||||||
|
IconSize="16" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="2" Background="#5d6b99">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="12*" />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!-- test -->
|
||||||
|
|
||||||
|
<telerik:RadTreeListView
|
||||||
|
Name="RadGridView1"
|
||||||
|
Grid.Row="2"
|
||||||
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
EnableColumnGroupsVirtualization="True"
|
||||||
|
EnableColumnVirtualization="True"
|
||||||
|
EnableRowVirtualization="True"
|
||||||
|
HierarchyColumnIndex="1"
|
||||||
|
HierarchyExpandButtonStyle="{StaticResource ExpandButtonStyle}"
|
||||||
|
HierarchyIndent="0"
|
||||||
|
IsExpandableBinding="{Binding IsExpandable}"
|
||||||
|
IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}"
|
||||||
|
IsFilteringAllowed="False"
|
||||||
|
IsReadOnly="False"
|
||||||
|
ItemsSource="{Binding smInfosView, Mode=TwoWay}"
|
||||||
|
LeftFrozenColumnCount="4"
|
||||||
|
RowIndicatorVisibility="Collapsed"
|
||||||
|
RowStyleSelector="{StaticResource selector}"
|
||||||
|
SelectedItem="{Binding SelectedSmInfo}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
ShowGroupPanel="False">
|
||||||
|
<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="CellEditEnded">
|
||||||
|
<i:InvokeCommandAction Command="{Binding EditEndCmd}" CommandParameter="{Binding EventArgs}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
<i:EventTrigger EventName="RowLoaded">
|
||||||
|
<i:InvokeCommandAction Command="{Binding RowLoadedCmd}" CommandParameter="{Binding EventArgs}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>
|
||||||
|
<telerik:RadTreeListView.ColumnGroups>
|
||||||
|
<telerik:GridViewColumnGroup Name="Range" Header="Range" />
|
||||||
|
<telerik:GridViewColumnGroup Name="Alarm" Header="Alarm" />
|
||||||
|
<telerik:GridViewColumnGroup Name="SENSOR" Header="SENSOR" />
|
||||||
|
<telerik:GridViewColumnGroup Name="GRP." Header="GRP." />
|
||||||
|
<telerik:GridViewColumnGroup Name="AMS" Header="AMS" />
|
||||||
|
<telerik:GridViewColumnGroup Name="VDR" Header="VDR" />
|
||||||
|
<telerik:GridViewColumnGroup Name="W/H" Header="W/H" />
|
||||||
|
<telerik:GridViewColumnGroup Name="ECR" Header="ECR" />
|
||||||
|
<telerik:GridViewColumnGroup Name="SHIP OFFICE" Header="SHIP OFFICE" />
|
||||||
|
</telerik:RadTreeListView.ColumnGroups>
|
||||||
|
<!-- 层级结构定义 -->
|
||||||
|
<telerik:RadTreeListView.ChildTableDefinitions>
|
||||||
|
<telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildSignals}" />
|
||||||
|
</telerik:RadTreeListView.ChildTableDefinitions>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<telerik:RadTreeListView.Columns>
|
||||||
|
<!-- 展开行详情列“+”
|
||||||
|
<telerik:GridViewToggleRowDetailsColumn Header=""/>
|
||||||
|
-->
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding serialNumber}"
|
||||||
|
Header="序号"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=序号}">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Background" Value="#5d6b99" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding type}"
|
||||||
|
Header="类型"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=类型}">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Background" Value="#5d6b99" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding Group_Name}"
|
||||||
|
Header="CH.NO"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CH.NO}">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Background" Value="#FF297ACE" />
|
||||||
|
<Setter Property="Background" Value="#5d6b99" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
Width="200"
|
||||||
|
DataMemberBinding="{Binding Group_Desc_EN}"
|
||||||
|
Header="英文描述"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=英文描述}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
Width="120"
|
||||||
|
DataMemberBinding="{Binding Group_Desc}"
|
||||||
|
Header="中文描述"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=中文描述}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
DataMemberBinding="{Binding BelongingMajor}"
|
||||||
|
Header="归属专业"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=归属专业}"
|
||||||
|
ItemsSource="{Binding DataContext.BelongingMajors, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
DataMemberBinding="{Binding GroupOther}"
|
||||||
|
DisplayMemberPath="DataItemName"
|
||||||
|
Header="组别"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=组别}"
|
||||||
|
ItemsSource="{Binding DataContext.GroupOthers, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}"
|
||||||
|
SelectedValueMemberPath="DataItemName" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding Signal_SeqNo}"
|
||||||
|
Header="编码"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=编码}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding Code}"
|
||||||
|
Header="Code"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=Code}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
DataMemberBinding="{Binding InOrOut}"
|
||||||
|
Header="IO类型"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=IO类型}"
|
||||||
|
ItemsSource="{Binding DataContext.InOrOuts, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
DataMemberBinding="{Binding IO_Type}"
|
||||||
|
Header="信号类型"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=信号类型}"
|
||||||
|
ItemsSource="{Binding DataContext.IO_Types, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Range"
|
||||||
|
DataMemberBinding="{Binding Range_Min}"
|
||||||
|
Header="Min"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=Min}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Range"
|
||||||
|
DataMemberBinding="{Binding Range_Max}"
|
||||||
|
Header="Max"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=Max}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding Unit}"
|
||||||
|
Header="单位"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=单位}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Alarm"
|
||||||
|
DataMemberBinding="{Binding Alarm_LL}"
|
||||||
|
Header="L.L"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=L.L}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Alarm"
|
||||||
|
DataMemberBinding="{Binding Alarm_L}"
|
||||||
|
Header="L"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=L}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Alarm"
|
||||||
|
DataMemberBinding="{Binding Alarm_H}"
|
||||||
|
Header="H"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=H}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="Alarm"
|
||||||
|
DataMemberBinding="{Binding Alarm_HH}"
|
||||||
|
Header="H.H"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=H.H}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="SENSOR"
|
||||||
|
DataMemberBinding="{Binding SENSOR_CODE}"
|
||||||
|
Header="CODE"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CODE}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding CommunicationPoint}"
|
||||||
|
Header="通讯"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=通讯}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding SeriousType}"
|
||||||
|
Header="SeriousType"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=SeriousType}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
ColumnGroupName="GRP."
|
||||||
|
DataMemberBinding="{Binding AL_GRP}"
|
||||||
|
Header="AL."
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=AL.}"
|
||||||
|
ItemsSource="{Binding DataContext.AL_GRPs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
ColumnGroupName="GRP."
|
||||||
|
DataMemberBinding="{Binding BL_GRP}"
|
||||||
|
Header="BL."
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=BL.}"
|
||||||
|
ItemsSource="{Binding DataContext.BL_GRPs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="AMS"
|
||||||
|
DataMemberBinding="{Binding Time_Delay}"
|
||||||
|
Header="TimeDelay"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=TimeDelay}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
DataMemberBinding="{Binding Supplier}"
|
||||||
|
DisplayMemberPath="DataItemName"
|
||||||
|
Header="供应商"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=供应商}"
|
||||||
|
ItemsSource="{Binding DataContext.Suppliers, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}"
|
||||||
|
SelectedValueMemberPath="DataItemName" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding EquipName}"
|
||||||
|
Header="设备名"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=设备名}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="VDR"
|
||||||
|
DataMemberBinding="{Binding VDR_Record}"
|
||||||
|
Header="Record"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=Record}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="W/H"
|
||||||
|
DataMemberBinding="{Binding WHConsole}"
|
||||||
|
Header="CONSOLE"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CONSOLE_W/H}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
CellEditTemplate="{StaticResource CellEditTemplate1}"
|
||||||
|
CellTemplate="{StaticResource CellTemplate1}"
|
||||||
|
ColumnGroupName="W/H"
|
||||||
|
DataMemberBinding="{Binding WHCPUs}"
|
||||||
|
Header="CPU"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CPU_W/H}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="ECR"
|
||||||
|
DataMemberBinding="{Binding ECRConsole}"
|
||||||
|
Header="CONSOLE"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CONSOLE_ECR}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
CellEditTemplate="{StaticResource CellEditTemplate2}"
|
||||||
|
CellTemplate="{StaticResource CellTemplate2}"
|
||||||
|
ColumnGroupName="ECR"
|
||||||
|
DataMemberBinding="{Binding ECRCPU}"
|
||||||
|
Header="CPU"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CPU_ECR}"
|
||||||
|
ItemsSource="{Binding DataContext.ECRCPUs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
ColumnGroupName="SHIP OFFICE"
|
||||||
|
DataMemberBinding="{Binding ShipOfficeConsole}"
|
||||||
|
Header="CONSOLE"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CONSOLE_SHIPOFFICE}" />
|
||||||
|
<telerik:GridViewComboBoxColumn
|
||||||
|
CellEditTemplate="{StaticResource CellEditTemplate3}"
|
||||||
|
CellTemplate="{StaticResource CellTemplate3}"
|
||||||
|
ColumnGroupName="SHIP OFFICE"
|
||||||
|
DataMemberBinding="{Binding ShipOfficeCPU}"
|
||||||
|
Header="CPU"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=CPU_SHIPOFFICE}"
|
||||||
|
ItemsSource="{Binding DataContext.ShipOfficeCPUs, RelativeSource={RelativeSource AncestorType=telerik:RadTreeListView}}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding SLD}"
|
||||||
|
Header="SLD"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=SLD}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding SHD}"
|
||||||
|
Header="SHD"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=SHD}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding SafetyDelay}"
|
||||||
|
Header="安保延迟"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=安保延迟}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding AutoCtrl}"
|
||||||
|
Header="自动控制"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=自动控制}" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding AssociatedCableInfo}"
|
||||||
|
Header="关联的电缆信息"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=关联的电缆信息}">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Foreground" Value="#c0c0c0" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding AssociatedChannelInfo}"
|
||||||
|
Header="关联的通道信息"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=关联的通道信息}">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Foreground" Value="#c0c0c0" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding Remarks}"
|
||||||
|
Header="备注"
|
||||||
|
IsReadOnlyBinding="{Binding Converter={StaticResource RowToBoolCvt}, RelativeSource={RelativeSource AncestorType={x:Type telerik:GridViewRow}}, ConverterParameter=备注}" />
|
||||||
|
</telerik:RadTreeListView.Columns>
|
||||||
|
|
||||||
|
<!-- 定义行详情模板
|
||||||
|
<telerik:RadTreeListView.RowDetailsTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="111"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</telerik:RadTreeListView.RowDetailsTemplate>
|
||||||
|
-->
|
||||||
|
</telerik:RadTreeListView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="5">
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="新增信号"
|
||||||
|
Content="新增信号"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="新增虚拟点"
|
||||||
|
Content="新增虚拟点"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="信号转虚拟点">
|
||||||
|
<telerik:RadButton.Style>
|
||||||
|
<Style TargetType="telerik:RadButton">
|
||||||
|
<!-- 默认文本 -->
|
||||||
|
<Setter Property="Content" Value="虚拟转信号" />
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
|
||||||
|
<!-- 当选中项的Content为信号时 -->
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem.type, ElementName=RadGridView1}" Value="信号">
|
||||||
|
<Setter Property="Content" Value="信号转虚拟点" />
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding SelectedItem.type, ElementName=RadGridView1}" Value="虚拟点">
|
||||||
|
<Setter Property="Content" Value="虚拟点转信号" />
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding Content, ElementName=myButton}" Value="显示全部">
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
|
||||||
|
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding SelectedItem.type, ElementName=RadGridView1}" Value="信号" />
|
||||||
|
<Condition Binding="{Binding SelectedItem.IsExpandable, ElementName=RadGridView1}" Value="True" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
</MultiDataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</telerik:RadButton.Style>
|
||||||
|
|
||||||
|
</telerik:RadButton>
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="删除"
|
||||||
|
Content="删除"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="撤销删除"
|
||||||
|
Content="撤销删除"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="彻底删除"
|
||||||
|
Content="彻底删除"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="还原信号"
|
||||||
|
Content="还原信号">
|
||||||
|
<telerik:RadButton.Style>
|
||||||
|
<Style TargetType="telerik:RadButton">
|
||||||
|
<Setter Property="IsEnabled" Value="False" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Content, ElementName=myButton}" Value="显示全部">
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</telerik:RadButton.Style>
|
||||||
|
</telerik:RadButton>
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,20,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="审核"
|
||||||
|
Content="审核"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="重新打开"
|
||||||
|
Content="重新打开"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,60,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Content="关联信号"
|
||||||
|
IsEnabled="False"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="100"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Content="查关联信号"
|
||||||
|
IsEnabled="False"
|
||||||
|
Style="{StaticResource buttoustyle1}" />
|
||||||
|
<GroupBox
|
||||||
|
Margin="5,120,5,5"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Header="显示状态">
|
||||||
|
<StackPanel>
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="ToDelete"
|
||||||
|
Content="待删除"
|
||||||
|
Foreground="#db9fa9" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="New"
|
||||||
|
Content="新增"
|
||||||
|
Foreground="#fc7c2c" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="Used"
|
||||||
|
Content="已关联"
|
||||||
|
Foreground="#49ac64" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="Confirmed"
|
||||||
|
Content="已审核"
|
||||||
|
Foreground="#565656" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="Reopen"
|
||||||
|
Content="重新打开"
|
||||||
|
Foreground="#1c3df5" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Width="80"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding StatusButtonCmd}"
|
||||||
|
CommandParameter="All"
|
||||||
|
Content="全部"
|
||||||
|
Foreground="#232323" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</telerik:RadBusyIndicator>
|
||||||
|
</UserControl>
|
@ -0,0 +1,28 @@
|
|||||||
|
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 DI_Electrical.Views.Dialog.DialogSignalManagements
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogSignalManagement.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogSignalManagement : UserControl
|
||||||
|
{
|
||||||
|
public DialogSignalManagement()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,152 @@
|
|||||||
|
<UserControl x:Class="DI_Electrical.Views.Dialog.DialogSignalManagements.DialogSignalNotice"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:CustomControl ="clr-namespace:DI_Electrical.Views.CustomControl"
|
||||||
|
xmlns:StyleSelector ="clr-namespace:DI_Electrical.Style"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<!-- 关键:设置窗口根据内容自动调整尺寸 -->
|
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||||
|
|
||||||
|
<Setter Property="WindowState" Value="Normal"/>
|
||||||
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
|
||||||
|
<Style x:Key="trueStatusStyle" TargetType="telerik:GridViewCell">
|
||||||
|
<Setter Property="Foreground" Value="#dadbde" />
|
||||||
|
<!-- 定义触发器 -->
|
||||||
|
<Style.Triggers>
|
||||||
|
<!-- 当按钮禁用时 -->
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Background" Value="Gray"/>
|
||||||
|
<Setter Property="Foreground" Value="DarkGray"/>
|
||||||
|
<Setter Property="BorderBrush" Value="Gray" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="falseStatusStyle" TargetType="telerik:GridViewCell">
|
||||||
|
<Setter Property="Foreground" Value="Red" />
|
||||||
|
</Style>
|
||||||
|
<StyleSelector:SignalNoticeStyleSelector x:Key="selector">
|
||||||
|
<StyleSelector:SignalNoticeStyleSelector.Rules>
|
||||||
|
<StyleSelector:ConditionalStyleRule Style="{StaticResource trueStatusStyle}">
|
||||||
|
<StyleSelector:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>True</sys:String>
|
||||||
|
</StyleSelector:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelector:ConditionalStyleRule>
|
||||||
|
<StyleSelector:ConditionalStyleRule Style="{StaticResource falseStatusStyle}">
|
||||||
|
<StyleSelector:ConditionalStyleRule.Value>
|
||||||
|
<sys:String>False</sys:String>
|
||||||
|
</StyleSelector:ConditionalStyleRule.Value>
|
||||||
|
</StyleSelector:ConditionalStyleRule>
|
||||||
|
</StyleSelector:SignalNoticeStyleSelector.Rules>
|
||||||
|
|
||||||
|
</StyleSelector:SignalNoticeStyleSelector>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<StackPanel Background="#5d6b99">
|
||||||
|
<local:customWindowTitleBar />
|
||||||
|
<Grid Margin="6" >
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1000"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="消息列表" Foreground="White"/>
|
||||||
|
<telerik:RadGridView Name="RadGridView2"
|
||||||
|
Grid.Row="2"
|
||||||
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||||||
|
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||||||
|
ItemsSource="{Binding MySignalNotices,Mode=TwoWay}"
|
||||||
|
SelectedItem="{Binding SelectedSignalNotice}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
LeftFrozenColumnCount="2"
|
||||||
|
ShowGroupPanel="False"
|
||||||
|
Width="auto" Height="500">
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="序号">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Background" Value="#5d6b99" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Group_Name}" Header="CH.NO">
|
||||||
|
<telerik:GridViewDataColumn.CellStyle>
|
||||||
|
<Style TargetType="{x:Type telerik:GridViewCell}">
|
||||||
|
<Setter Property="Background" Value="#5d6b99" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
</telerik:GridViewDataColumn.CellStyle>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Group_Desc_EN}" Header="英文描述"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Group_Desc}" Header="中文描述"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding IO_Type}" Header="信号类型"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Action}" Header="操作"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateUserName}" Header="发出者"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateTime}" Header="操作时间"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding UpdateUserName}" Header="已阅人"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding UpdateTime}" Header="已阅时间"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Message}" Header="操作信息"
|
||||||
|
IsReadOnlyBinding="{Binding IsReadOnly}"
|
||||||
|
CellStyleSelector="{StaticResource selector}"/>
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
|
||||||
|
</telerik:RadGridView>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<telerik:RadButton Width="80" Margin="0 0 0 6" HorizontalAlignment="Right" Content="确定"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="确定"/>
|
||||||
|
<telerik:RadButton Width="80" Margin="0 0 0 6" HorizontalAlignment="Right" Content="取消"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="取消"/>
|
||||||
|
<telerik:RadButton Width="80" Margin="0 20 0 6" HorizontalAlignment="Right" Content="已阅"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="已阅"/>
|
||||||
|
<telerik:RadButton Width="80" Margin="0 0 0 6" HorizontalAlignment="Right" Content="全部已阅"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="全部已阅"/>
|
||||||
|
<GroupBox Margin="5,120,5,5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Header="显示状态">
|
||||||
|
<StackPanel>
|
||||||
|
<telerik:RadButton Width="65" Margin="0 0 0 5" HorizontalAlignment="Center" Content="已阅" Command="{Binding StatusButtonCmd}" CommandParameter="True" />
|
||||||
|
<telerik:RadButton Width="65" Margin="0 0 0 5" HorizontalAlignment="Center" Content="未阅" Command="{Binding StatusButtonCmd}" CommandParameter="False"/>
|
||||||
|
<telerik:RadButton Width="65" Margin="0 0 0 5" HorizontalAlignment="Center" Content="全部" Command="{Binding StatusButtonCmd}" CommandParameter="All"/>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
@ -0,0 +1,29 @@
|
|||||||
|
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;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.Dialog.DialogSignalManagements
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogSignalNotice.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogSignalNotice : UserControl
|
||||||
|
{
|
||||||
|
public DialogSignalNotice()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
<UserControl x:Class="DI_Electrical.Views.Dialog.DialogSignalManagements.DialogSignalPropertyhisAndLogs"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:CustomControl ="clr-namespace:DI_Electrical.Views.CustomControl"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<!-- 关键:设置窗口根据内容自动调整尺寸 -->
|
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||||
|
<Setter Property="WindowState" Value="Normal"/>
|
||||||
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<local:customWindowTitleBar />
|
||||||
|
<Grid Grid.Row="1" Background="#5d6b99">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1000"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel>
|
||||||
|
<GroupBox Margin="5" Header="信号属性修改历史">
|
||||||
|
<telerik:RadGridView Name="RadGridView1"
|
||||||
|
Grid.Row="2"
|
||||||
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||||||
|
IsReadOnly="True" RowIndicatorVisibility="Collapsed"
|
||||||
|
ItemsSource="{Binding MySingnalPropertyhis,Mode=TwoWay}"
|
||||||
|
SelectedItem="{Binding SelectedPropertyhi}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
ShowGroupPanel="False"
|
||||||
|
Width="auto" Height="250">
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn Header="序号"
|
||||||
|
DataMemberBinding="{Binding ID}"
|
||||||
|
Width="80" />
|
||||||
|
<telerik:GridViewDataColumn Header="属性"
|
||||||
|
DataMemberBinding="{Binding PropertyNameDec, StringFormat=c}"
|
||||||
|
UniqueName="PropertyNameDec"
|
||||||
|
Width="100" />
|
||||||
|
<telerik:GridViewDataColumn Header="旧属性"
|
||||||
|
DataMemberBinding="{Binding OldPropertyValue}"
|
||||||
|
Width="100" />
|
||||||
|
<telerik:GridViewDataColumn Header="新属性值"
|
||||||
|
DataMemberBinding="{Binding NewPropertyValue}"
|
||||||
|
Width="100" />
|
||||||
|
<telerik:GridViewDataColumn Header="修改人"
|
||||||
|
DataMemberBinding="{Binding CreateUserName}"
|
||||||
|
Width="100" />
|
||||||
|
<telerik:GridViewDataColumn Header="修改时间"
|
||||||
|
DataFormatString="{}yyyy-MM-dd HH:mm:ss"
|
||||||
|
DataMemberBinding="{Binding CreateTime}"
|
||||||
|
Width="*" />
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
<telerik:RadGridView.GroupDescriptors>
|
||||||
|
<telerik:ColumnGroupDescriptor Column="{Binding Columns[\PropertyNameDec\], ElementName=RadGridView1}"
|
||||||
|
SortDirection="Ascending" />
|
||||||
|
</telerik:RadGridView.GroupDescriptors>
|
||||||
|
</telerik:RadGridView>
|
||||||
|
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox Margin="5" Header="消息操作记录">
|
||||||
|
<telerik:RadGridView Name="RadGridView2"
|
||||||
|
Grid.Row="2"
|
||||||
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||||||
|
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||||||
|
ItemsSource="{Binding MySignalLogs,Mode=TwoWay}"
|
||||||
|
SelectedItem="{Binding SelectedSignalLog}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
ShowGroupPanel="False"
|
||||||
|
Height="250">
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="序号" />
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding OperateType}" Header="操作" IsReadOnly="True"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding ExtraMsg}" Header="附加消息" IsReadOnly="True"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateUserName}" Header="操作人" IsReadOnly="True"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateTime}" Header="操作时间"
|
||||||
|
DataFormatString="{}yyyy-MM-dd HH:mm:ss" IsReadOnly="True"
|
||||||
|
Width="*"/>
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
</telerik:RadGridView>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1" Margin="5">
|
||||||
|
<telerik:RadButton Width="60" Margin="0 0 0 6" HorizontalAlignment="Right" Content="确定"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="确定"/>
|
||||||
|
<telerik:RadButton Width="60" Margin="0 0 0 6" HorizontalAlignment="Right" Content="取消"
|
||||||
|
Command="{Binding ButtonCmd}" CommandParameter="取消"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
@ -0,0 +1,28 @@
|
|||||||
|
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 DI_Electrical.Views.Dialog.DialogSignalManagements
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogSignalPropertyhisAndLogs.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogSignalPropertyhisAndLogs : UserControl
|
||||||
|
{
|
||||||
|
public DialogSignalPropertyhisAndLogs()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
<UserControl x:Class="DI_Electrical.Views.Dialog.DialogSignalManagements.DialogSignalSelect"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:CustomControl ="clr-namespace:DI_Electrical.Views.CustomControl"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
Background="White">
|
||||||
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<!-- 关键:设置窗口根据内容自动调整尺寸 -->
|
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||||
|
<Setter Property="WindowState" Value="Normal"/>
|
||||||
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<local:customWindowTitleBar/>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Margin="10 0" Text="请选择要将这个虚拟点放在哪个信号下"/>
|
||||||
|
<Border Width="250" Grid.Row="1"
|
||||||
|
BorderBrush="SlateBlue"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="5"
|
||||||
|
Margin="10">
|
||||||
|
<ListBox ItemsSource="{Binding listSignal}" SelectedItem="{Binding SelectedSignal,Mode=TwoWay}" >
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border>
|
||||||
|
<TextBlock Text="{Binding SignalName}"
|
||||||
|
FontSize="14"
|
||||||
|
Margin="5"/>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
<ListBox.Style>
|
||||||
|
<Style TargetType="ListBox">
|
||||||
|
<Setter Property="Focusable" Value="False"/>
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="Margin" Value="0"/>
|
||||||
|
<Setter Property="Height" Value="500"/>
|
||||||
|
<Setter Property="Background" Value="SlateGray"/>
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Setter Property="ItemContainerStyle">
|
||||||
|
<Setter.Value>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Height" Value="30"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
|
<Border Height="{TemplateBinding Height}"
|
||||||
|
BorderThickness="0 0 0 1"
|
||||||
|
BorderBrush="#DFDFDF"
|
||||||
|
Background="{TemplateBinding Background}">
|
||||||
|
<ContentPresenter VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="LightBlue"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="DeepSkyBlue"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ListBox.Style>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
@ -0,0 +1,28 @@
|
|||||||
|
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 DI_Electrical.Views.Dialog.DialogSignalManagements
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogSignalSelect.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogSignalSelect : UserControl
|
||||||
|
{
|
||||||
|
public DialogSignalSelect()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
newFront/c#前端/DI-Electrical/Views/Dialog/DialogTest.xaml
Normal file
51
newFront/c#前端/DI-Electrical/Views/Dialog/DialogTest.xaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="DI_Electrical.Views.Dialog.DialogTest"
|
||||||
|
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:DI_Electrical.Views.Dialog"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Width="400"
|
||||||
|
Height="200"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="0"
|
||||||
|
Height="30"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Width="60"
|
||||||
|
FontSize="18"
|
||||||
|
Text="传参:" />
|
||||||
|
<TextBox
|
||||||
|
Width="200"
|
||||||
|
FontSize="18"
|
||||||
|
Text="{Binding parText}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="1"
|
||||||
|
Height="60"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Button
|
||||||
|
Width="100"
|
||||||
|
Margin="10"
|
||||||
|
Command="{Binding Command_Close1}"
|
||||||
|
Content="Yes关闭"
|
||||||
|
FontSize="18" />
|
||||||
|
<Button
|
||||||
|
Width="100"
|
||||||
|
Margin="10"
|
||||||
|
Command="{Binding Command_Close2}"
|
||||||
|
Content="No关闭"
|
||||||
|
FontSize="18" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
29
newFront/c#前端/DI-Electrical/Views/Dialog/DialogTest.xaml.cs
Normal file
29
newFront/c#前端/DI-Electrical/Views/Dialog/DialogTest.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views.Dialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DialogTest.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DialogTest : UserControl
|
||||||
|
{
|
||||||
|
public DialogTest()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
107
newFront/c#前端/DI-Electrical/Views/Login.xaml
Normal file
107
newFront/c#前端/DI-Electrical/Views/Login.xaml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="DI_Electrical.Views.Login"
|
||||||
|
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:local="clr-namespace:DI_Electrical.Views"
|
||||||
|
xmlns:local2="clr-namespace:DI_Electrical.Helper"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
Width="300"
|
||||||
|
Height="250"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="White"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="None"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- 自定义标题栏 -->
|
||||||
|
<local:customWindowTitleBar />
|
||||||
|
<!-- 主要内容区 -->
|
||||||
|
<Grid Grid.Row="1" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Style="{StaticResource sysLabel}" Text="用户名:" />
|
||||||
|
<telerik:RadWatermarkTextBox
|
||||||
|
Grid.Row="1"
|
||||||
|
Style="{StaticResource sysTextBox}"
|
||||||
|
Text="{Binding UserName, Mode=TwoWay}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
Style="{StaticResource sysLabel}"
|
||||||
|
Text="密码:" />
|
||||||
|
<telerik:RadPasswordBox
|
||||||
|
x:Name="passwordBox"
|
||||||
|
Grid.Row="3"
|
||||||
|
Style="{StaticResource sysTextBox}">
|
||||||
|
<i:Interaction.Behaviors>
|
||||||
|
<local2:PasswordBoxBehavior Password="{Binding sPASSWORD, Mode=TwoWay}" />
|
||||||
|
</i:Interaction.Behaviors>
|
||||||
|
</telerik:RadPasswordBox>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="4"
|
||||||
|
Style="{StaticResource sysLabel}"
|
||||||
|
Text="{Binding curServer}" />
|
||||||
|
<StackPanel Grid.Row="5" Orientation="Horizontal">
|
||||||
|
<CheckBox Content="记住密码" IsChecked="{Binding rememberPs}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<Border
|
||||||
|
Grid.Row="2"
|
||||||
|
Height="30"
|
||||||
|
Background="{StaticResource ColorPrimary}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Column="0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding Command_Config}"
|
||||||
|
Content="设置"
|
||||||
|
Style="{StaticResource sysBtn}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding CloseCommand}"
|
||||||
|
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Content="取消"
|
||||||
|
Style="{StaticResource sysBtn2}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding OKCommand}"
|
||||||
|
CommandParameter="{Binding ElementName=passwordBox}"
|
||||||
|
Content="登录"
|
||||||
|
Style="{StaticResource sysBtn}" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</telerik:RadBusyIndicator>
|
||||||
|
</Window>
|
30
newFront/c#前端/DI-Electrical/Views/Login.xaml.cs
Normal file
30
newFront/c#前端/DI-Electrical/Views/Login.xaml.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
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.Shapes;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Login.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Login : Window
|
||||||
|
{
|
||||||
|
public Login(LoginViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel.CloseWindowAction = this.Close; // 将关闭方法传递给 ViewModel
|
||||||
|
DataContext = viewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
newFront/c#前端/DI-Electrical/Views/MainWindow.xaml
Normal file
40
newFront/c#前端/DI-Electrical/Views/MainWindow.xaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="DI_Electrical.Views.MainWindow"
|
||||||
|
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:DI_Electrical.Views"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Title="MainWindow"
|
||||||
|
Width="800"
|
||||||
|
Height="450"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="0"
|
||||||
|
Height="30"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Width="100"
|
||||||
|
FontSize="18"
|
||||||
|
Text="当前项目:" />
|
||||||
|
<TextBox
|
||||||
|
Width="200"
|
||||||
|
FontSize="18"
|
||||||
|
Text="{Binding ProjectName}" />
|
||||||
|
<Button
|
||||||
|
Width="100"
|
||||||
|
Height="25"
|
||||||
|
Command="{Binding Command_ShowDialogTest}"
|
||||||
|
Content="弹窗测试" />
|
||||||
|
<Button
|
||||||
|
Width="100"
|
||||||
|
Height="25"
|
||||||
|
Command="{Binding Command_ShowDialogSignalManagement}"
|
||||||
|
Content="信号管理测试" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
27
newFront/c#前端/DI-Electrical/Views/MainWindow.xaml.cs
Normal file
27
newFront/c#前端/DI-Electrical/Views/MainWindow.xaml.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MainWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
80
newFront/c#前端/DI-Electrical/Views/Project.xaml
Normal file
80
newFront/c#前端/DI-Electrical/Views/Project.xaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="DI_Electrical.Views.Project"
|
||||||
|
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:DI_Electrical.Views"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
Width="400"
|
||||||
|
Height="600"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="White"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="None">
|
||||||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local:customWindowTitleBar />
|
||||||
|
|
||||||
|
<telerik:RadGridView
|
||||||
|
Grid.Row="1"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ItemsSource="{Binding Projects}"
|
||||||
|
SelectedItem="{Binding select}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
ShowGroupPanel="False">
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding ProjectId}"
|
||||||
|
Header="项目ID"
|
||||||
|
IsFilteringDeferred="True"
|
||||||
|
IsVisible="False" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding ProjectName}"
|
||||||
|
Header="项目名称"
|
||||||
|
IsFilteringDeferred="True" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding ProjectCode}"
|
||||||
|
Header="项目代号"
|
||||||
|
IsFilteringDeferred="True" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding ShipSociety}"
|
||||||
|
Header="船级社"
|
||||||
|
IsFilteringDeferred="True" />
|
||||||
|
<telerik:GridViewDataColumn
|
||||||
|
DataMemberBinding="{Binding ShipOwner}"
|
||||||
|
Header="船东"
|
||||||
|
IsFilteringDeferred="True" />
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
</telerik:RadGridView>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Grid.Row="2"
|
||||||
|
Height="30"
|
||||||
|
Background="{StaticResource ColorPrimary}">
|
||||||
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding CloseCommand}"
|
||||||
|
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Content="取消"
|
||||||
|
Style="{StaticResource sysBtn2}" />
|
||||||
|
<telerik:RadButton
|
||||||
|
Margin="5"
|
||||||
|
Command="{Binding OKCommand}"
|
||||||
|
Content="进入项目"
|
||||||
|
Style="{StaticResource sysBtn}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</telerik:RadBusyIndicator>
|
||||||
|
|
||||||
|
</Window>
|
35
newFront/c#前端/DI-Electrical/Views/Project.xaml.cs
Normal file
35
newFront/c#前端/DI-Electrical/Views/Project.xaml.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
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.Shapes;
|
||||||
|
using DI_Electrical.ViewModels;
|
||||||
|
|
||||||
|
namespace DI_Electrical.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Project.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Project : Window
|
||||||
|
{
|
||||||
|
public Project(ProjectViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel.CloseWindowAction = this.Close;
|
||||||
|
DataContext = viewModel;
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var x = DataContext as ProjectViewModel;
|
||||||
|
x.onWindow_loaded(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
newFront/c#前端/DI-Electrical/bin/Debug/Config.ini
Normal file
7
newFront/c#前端/DI-Electrical/bin/Debug/Config.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Profile]
|
||||||
|
Address = 27.154.35.18
|
||||||
|
Port = 7044
|
||||||
|
Directory = C:\Users\acer\AppData\Roaming\SWS
|
||||||
|
UserName = system
|
||||||
|
UserPs = Do123456
|
||||||
|
ProjectID = c151f5d4-cbe1-4522-945c-501b1ad990d5
|
@ -0,0 +1,6 @@
|
|||||||
|
【22:41:02.968】 logerror T1
|
||||||
|
----------------------------Error BEGIN------------------------------
|
||||||
|
【22:41:02.976】 logerror T1
|
||||||
|
接口:LoginApi/CheckLogin?username=1&password=6512bd43d9caa6e02c990b0a82652dca失败,异常:发送请求时出错。
|
||||||
|
【22:41:02.977】 logerror T1
|
||||||
|
-----------------------------Error END-------------------------------
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user