diff --git a/Sinvo.EplanHpD.Plugin.Service/PluginServices.cs b/Sinvo.EplanHpD.Plugin.Service/PluginServices.cs index 045f5df..c0ad9d2 100644 --- a/Sinvo.EplanHpD.Plugin.Service/PluginServices.cs +++ b/Sinvo.EplanHpD.Plugin.Service/PluginServices.cs @@ -10,12 +10,8 @@ namespace Sinvo.EplanHpD.Plugin.Service { public class PluginServices { - public static UserInfo user; -#if DEBUG + public static UserInfo user; public static bool IsLogin => user != null && !string.IsNullOrEmpty(user.GUID) && DynaServerClient.GetClient().IsLoginExpired(); -#else - - public static bool IsLogin => true; -#endif + } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs index ec59cd1..2f769ab 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs @@ -1,4 +1,5 @@ -using MiniExcelLibs.Attributes; +using Microsoft.WindowsAPICodePack.ApplicationServices; +using MiniExcelLibs.Attributes; using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire; using System; using System.Collections.Generic; @@ -422,7 +423,23 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models } } - + private bool _layouted; + /// + /// 是否已布线 + /// + [ExcelColumn(Ignore = true)] + public bool Layouted + { + get + { + return _layouted; + } + set + { + _layouted = value; + OnPropertyChanged(nameof(Layouted)); + } + } [ExcelColumn(Ignore = true)] public List TerminalModels { diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MultiCoreWireService.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MultiCoreWireService.cs index 8cfe7de..c7328c7 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MultiCoreWireService.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MultiCoreWireService.cs @@ -96,5 +96,27 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Service throw; } } + internal void UpdateWireIsLayout(string id) + { + if (string.IsNullOrEmpty(id)) + { + return; + } + var db = DBHelper.DB; + try + { + db.BeginTran(); + db.Updateable() + .Where(it => it.Id == id) + .SetColumns(it => it.Layouted == true) + .ExecuteCommand(); + db.CommitTran(); + } + catch (Exception) + { + db.RollbackTran(); + throw; + } + } } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj index b7d1bb5..0631070 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj @@ -283,6 +283,7 @@ + diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MapperUtil.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MapperUtil.cs new file mode 100644 index 0000000..dd2f5cb --- /dev/null +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MapperUtil.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils +{ + public class MapperUtil + { + public static T MapFor(S sourceObj) + { + if (sourceObj == null) + return default(T); + var destObj = Activator.CreateInstance(); + var sourceType = sourceObj.GetType(); + var destType = typeof(T); + foreach (var prop in destType.GetProperties()) + { + var sourceProp = sourceType.GetProperty(prop.Name); + if (sourceProp != null && prop.CanWrite) + { + var value = sourceProp.GetValue(sourceObj); + prop.SetValue(destObj, value); + } + } + return destObj; + } + } +} diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml index 1045605..edc6546 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml @@ -12,14 +12,14 @@ Width="450" Height="260" MinWidth="450" - MinHeight="260" + MinHeight="360" d:DataContext="{d:DesignInstance Type=multicorewireviewmodel:MultiCoreWireLayoutHelperViewModel}" ActiveGlowColor="{DynamicResource PrimaryColor}" Background="White" FontSize="14" Left="1460" Loaded="GlowWindow_Loaded" - Top="770" + Top="700" WindowStartupLocation="Manual" mc:Ignorable="d"> @@ -46,22 +46,46 @@ FontSize="16" FontWeight="Bold" Foreground="#c92d28" - Text="触摸屏" /> + Text="{Binding ApplicationScenario}" /> - - - - - - - + hc:GridViewAttach.ColumnHeaderHeight="10" + ItemsSource="{Binding LecWires}" + Style="{StaticResource ListView.Small}"> + + + + + + + + + + + + + + + +