105040 Update
更新连接物属性,优化 UI 和数据处理 在 `MultiCoreWireLecDBModel.cs` 中,更新连接物的型号和数量属性,移除后连接物型号,增加后连接物型号和数量属性。 在 `MultiCoreWireDataModel.cs` 中,添加引脚编号属性。 在 `MultiCoreWireLecModel.cs` 中,更新前后连接物的型号和数量属性,移除前端子和后端子的型号属性。 在 `MultiCoreWireWindow.xaml` 中,添加新的 UI 元素以显示连接物数量,并更新数据绑定。 在 `MultiCoreWireWindow.xaml.cs` 中,添加对新属性的处理逻辑。 在 `MultiCoreWireLayoutHelperViewModel.cs` 中,更新服务定义方式,移除不必要的属性。 在 `MultiCoreWireViewModel.cs` 中,添加新属性以支持连接物数量,并更新相关逻辑。 在 `MultiCoreWirePluginEntry.cs` 中,更新窗口显示逻辑,确保登录后正确显示窗口。 新增 `ScrollSynchronizer.cs` 文件,提供同步滚动功能。
This commit is contained in:
parent
071f3bc503
commit
aafcacaeb5
|
@ -45,14 +45,25 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
|
|||
/// </summary>
|
||||
public string WireModelSpecification { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接
|
||||
/// 前连接物型号
|
||||
/// </summary>
|
||||
public string FrontConnectorModel { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接物数量
|
||||
/// </summary>
|
||||
public int FrontConnectorQuantity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// 后连接物型号
|
||||
/// </summary>
|
||||
public string BackConnectorModel { get; set; }
|
||||
public string RearConnectorModel { get; set; }
|
||||
/// <summary>
|
||||
/// 后连接物数量
|
||||
/// </summary>
|
||||
public int RearConnectorQuantity { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否已布线
|
||||
|
|
|
@ -8,6 +8,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
{
|
||||
public class MultiCoreWireDataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 引脚编号
|
||||
/// </summary>
|
||||
public string PinIndex { get; set; }
|
||||
/// <summary>
|
||||
/// 线材型号规格
|
||||
/// </summary>
|
||||
|
@ -36,13 +40,35 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
public bool IsHighFlexibility { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// 前连接物型号
|
||||
/// </summary>
|
||||
public string FrontTerminalModel { get; set; }
|
||||
public string FrontConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端子型号
|
||||
/// 前连接物料号
|
||||
/// </summary>
|
||||
public string BackTerminalModel { get; set; }
|
||||
public string FrontConnectorMCode { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接物数量
|
||||
/// </summary>
|
||||
public int FrontConnectorQuantity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物型号
|
||||
/// </summary>
|
||||
public string RearConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物料号
|
||||
/// </summary>
|
||||
public string RearConnectorMCode { get; set; }
|
||||
/// <summary>
|
||||
/// 后连接物数量
|
||||
/// </summary>
|
||||
public int RearConnectorQuantity { get; set; }
|
||||
|
||||
|
||||
|
||||
private List<MultiCoreWireDataModel> _children = [];
|
||||
public List<MultiCoreWireDataModel> Children
|
||||
|
|
|
@ -19,7 +19,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
public string UniqueKey { get; set; }
|
||||
public string ProjectName { get; set; }
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 线材名称
|
||||
/// </summary>
|
||||
public string WireKey { get; set; }
|
||||
|
||||
private int _seqNo;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
|
@ -407,22 +410,43 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
OnPropertyChanged(nameof(FrontConnectorModel));
|
||||
}
|
||||
}
|
||||
private string _frontConnectorMCode;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string FrontConnectorMCode
|
||||
{
|
||||
get => _frontConnectorMCode;
|
||||
set
|
||||
{
|
||||
_frontConnectorMCode = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorMCode));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// </summary>
|
||||
private string _backConnectorModel;
|
||||
private string _rearConnectorModel;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string BackConnectorModel
|
||||
public string RearConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
get => _rearConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
_rearConnectorModel = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModel));
|
||||
}
|
||||
}
|
||||
private string _rearConnectorMCode;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string RearConnectorMCode
|
||||
{
|
||||
get => _rearConnectorMCode;
|
||||
set
|
||||
{
|
||||
_rearConnectorMCode = value;
|
||||
OnPropertyChanged(nameof(RearConnectorMCode));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _layouted;
|
||||
/// <summary>
|
||||
/// 是否已布线
|
||||
|
@ -446,41 +470,77 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
get
|
||||
{
|
||||
// 将所有类型的端子模型组合成一个列表
|
||||
return [
|
||||
List<MultiCoreWireTerminalModel> terminals = [
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = ForkTerminal,
|
||||
TerminalStripLength = ForkTerminalStripLength,
|
||||
TerminalMaterialCode = ForkTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = FlatTerminal,
|
||||
TerminalStripLength = FlatTerminalStripLength,
|
||||
TerminalMaterialCode = FlatTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = OTypeTerminal,
|
||||
TerminalStripLength = OTypeTerminalStripLength,
|
||||
TerminalMaterialCode = OTypeTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = PinTerminal,
|
||||
TerminalStripLength = PinTerminalStripLength,
|
||||
TerminalMaterialCode = PinTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = YTypeTerminal,
|
||||
TerminalStripLength = YTypeTerminalStripLength,
|
||||
TerminalMaterialCode = YTypeTerminalMaterialCode
|
||||
}
|
||||
{
|
||||
TerminalModel = ForkTerminal,
|
||||
TerminalStripLength = ForkTerminalStripLength,
|
||||
TerminalMaterialCode = ForkTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = FlatTerminal,
|
||||
TerminalStripLength = FlatTerminalStripLength,
|
||||
TerminalMaterialCode = FlatTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = OTypeTerminal,
|
||||
TerminalStripLength = OTypeTerminalStripLength,
|
||||
TerminalMaterialCode = OTypeTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = PinTerminal,
|
||||
TerminalStripLength = PinTerminalStripLength,
|
||||
TerminalMaterialCode = PinTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = YTypeTerminal,
|
||||
TerminalStripLength = YTypeTerminalStripLength,
|
||||
TerminalMaterialCode = YTypeTerminalMaterialCode
|
||||
}
|
||||
];
|
||||
return [.. terminals.Where(it => !string.IsNullOrEmpty(it.TerminalModel))];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int _frontConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int FrontConnectorQuantity
|
||||
{
|
||||
get => _frontConnectorCount;
|
||||
set
|
||||
{
|
||||
_frontConnectorCount = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorQuantity));
|
||||
}
|
||||
}
|
||||
private int _rearConnectorQuantity;
|
||||
/// <summary>
|
||||
///
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int RearConnectorQuantity
|
||||
{
|
||||
get => _rearConnectorQuantity;
|
||||
set
|
||||
{
|
||||
_rearConnectorQuantity = value;
|
||||
OnPropertyChanged(nameof(RearConnectorQuantity));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 号码管型号
|
||||
/// </summary>
|
||||
public string NumberTubeModel { get; set; }
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
|
|
|
@ -286,6 +286,7 @@
|
|||
<Compile Include="Utils\MapperUtil.cs" />
|
||||
<Compile Include="Utils\MotorExcelHelper.cs" />
|
||||
<Compile Include="Utils\MultiCoreWireExcelHelper.cs" />
|
||||
<Compile Include="Utils\ScrollSynchronizer.cs" />
|
||||
<Compile Include="ViewModel\CableLectotype\CableLectotypeViewModel.cs" />
|
||||
<Compile Include="ViewModel\CableLectotype\LayoutHelperViewModel.cs" />
|
||||
<Compile Include="ViewModel\CableLectotype\LectotypeViewModel.cs" />
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
public static class ScrollSynchronizer
|
||||
{
|
||||
// 附加属性定义
|
||||
public static readonly DependencyProperty SynchronizeWithParentProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"SynchronizeWithParent",
|
||||
typeof(bool),
|
||||
typeof(ScrollSynchronizer),
|
||||
new PropertyMetadata(false, OnSynchronizeWithParentChanged));
|
||||
// 为 ListBox 添加自动寻找内部 DataGrid 的附加属性
|
||||
public static readonly DependencyProperty AutoSynchronizeChildrenProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"AutoSynchronizeChildren",
|
||||
typeof(bool),
|
||||
typeof(ScrollSynchronizer),
|
||||
new PropertyMetadata(false, OnAutoSynchronizeChildrenChanged));
|
||||
|
||||
// Getter 和 Setter
|
||||
public static bool GetSynchronizeWithParent(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(SynchronizeWithParentProperty);
|
||||
}
|
||||
|
||||
public static void SetSynchronizeWithParent(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(SynchronizeWithParentProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当属性值改变时触发
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void OnSynchronizeWithParentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is UIElement element)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
// 添加事件处理
|
||||
element.PreviewMouseWheel += Element_PreviewMouseWheel;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 移除事件处理
|
||||
element.PreviewMouseWheel -= Element_PreviewMouseWheel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理滚动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void Element_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (sender is UIElement element)
|
||||
{
|
||||
// 向上查找父级 ListBox
|
||||
var listBox = FindParentListBox(element);
|
||||
if (listBox != null)
|
||||
{
|
||||
// 直接获取 ListBox 的 ScrollViewer
|
||||
ScrollViewer scrollViewer = GetScrollViewer(listBox);
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
// 直接控制滚动位置
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
scrollViewer.LineDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollViewer.LineUp();
|
||||
}
|
||||
|
||||
// 标记事件已处理
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到 ScrollViewer,回退到事件传递
|
||||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
||||
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
eventArg.Source = sender;
|
||||
listBox.RaiseEvent(eventArg);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加获取 ScrollViewer 的辅助方法
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
private static ScrollViewer GetScrollViewer(DependencyObject element)
|
||||
{
|
||||
if (element is ScrollViewer scrollViewer)
|
||||
return scrollViewer;
|
||||
|
||||
// 尝试从控件模板中查找 ScrollViewer
|
||||
ScrollViewer result = null;
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element) && result == null; i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(element, i);
|
||||
result = GetScrollViewer(child); // 递归查找
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找父级 ListBox
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
/// <returns></returns>
|
||||
private static ListBox FindParentListBox(DependencyObject child)
|
||||
{
|
||||
var parent = VisualTreeHelper.GetParent(child);
|
||||
while (parent != null && !(parent is ListBox))
|
||||
{
|
||||
parent = VisualTreeHelper.GetParent(parent);
|
||||
}
|
||||
return parent as ListBox;
|
||||
}
|
||||
|
||||
public static bool GetAutoSynchronizeChildren(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(AutoSynchronizeChildrenProperty);
|
||||
}
|
||||
|
||||
public static void SetAutoSynchronizeChildren(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(AutoSynchronizeChildrenProperty, value);
|
||||
}
|
||||
|
||||
private static void OnAutoSynchronizeChildrenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ListBox listBox && (bool)e.NewValue)
|
||||
{
|
||||
// 监听 ListBox 的 Loaded 事件
|
||||
listBox.Loaded += ListBox_Loaded;
|
||||
// 监听 ItemContainerGenerator 状态变化,处理动态加载的项
|
||||
listBox.ItemContainerGenerator.StatusChanged += (s, args) =>
|
||||
{
|
||||
if (listBox.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
|
||||
{
|
||||
AttachToAllDataGrids(listBox);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void ListBox_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ListBox listBox)
|
||||
{
|
||||
AttachToAllDataGrids(listBox);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AttachToAllDataGrids(ListBox listBox)
|
||||
{
|
||||
var dataGrids = FindVisualChildren<DataGrid>(listBox);
|
||||
foreach (var dataGrid in dataGrids)
|
||||
{
|
||||
SetSynchronizeWithParent(dataGrid, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// 查找所有指定类型的可视化子元素
|
||||
private static IEnumerable<T> FindVisualChildren<T>(DependencyObject obj) where T : DependencyObject
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
|
||||
if (child != null && child is T)
|
||||
{
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child))
|
||||
{
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
xmlns:localconverter="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Converter"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:multicorewireviewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel"
|
||||
xmlns:utils="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Utils"
|
||||
Title="多芯线数据抓取"
|
||||
Width="1200"
|
||||
Height="600"
|
||||
|
@ -56,7 +57,7 @@
|
|||
<TabItem Header="多芯线选型">
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="210" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
|
@ -145,6 +146,23 @@
|
|||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线材标识:" />
|
||||
<hc:TextBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding Wirekey}" />
|
||||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="0"
|
||||
|
@ -185,6 +203,8 @@
|
|||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
<TextBlock VerticalAlignment="Center" Text="连接物数量:" />
|
||||
<hc:NumericUpDown Value="{Binding FrontConnectorCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
|
@ -219,6 +239,9 @@
|
|||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="连接物数量:" />
|
||||
<hc:NumericUpDown Value="{Binding BackConnectorCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
|
@ -289,13 +312,26 @@
|
|||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Binding="{Binding SeqNo}" Header="序号" />-->
|
||||
<DataGridTextColumn Binding="{Binding ApplicationScenario}" Header="应用场景" />
|
||||
<DataGridTextColumn Binding="{Binding WireKey}" Header="线材标识" />
|
||||
<DataGridTextColumn Binding="{Binding WireDiameterSpecification}" Header="线径规格(mm²)" />
|
||||
<DataGridTextColumn Binding="{Binding IsHighFlexibilityStr}" Header="是否高柔" />
|
||||
<DataGridTextColumn Binding="{Binding WireCoreCount}" Header="线芯数量" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="线材型号" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管型号" />
|
||||
<!--<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管物料编码" />-->
|
||||
<!--<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管数量" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管长度" />-->
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorModel}" Header="前连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding BackConnectorModel}" Header="后连接物型号" />
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorMCode}" Header="前连接物料号" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorQuantity}" Header="前连接物数量" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管型号(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管物料编码(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管数量(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管总长度(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorModel}" Header="后连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorMCode}" Header="后连接物料号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorQuantity}" Header="后连接物数量" />
|
||||
<DataGridTemplateColumn Header="操作">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel>
|
||||
|
@ -314,8 +350,10 @@
|
|||
</TabItem>
|
||||
<TabItem Header="数据抓取">
|
||||
<ListBox
|
||||
x:Name="DataList"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
utils:ScrollSynchronizer.AutoSynchronizeChildren="True"
|
||||
Focusable="True"
|
||||
ItemsSource="{Binding Wires}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
|
@ -357,72 +395,53 @@
|
|||
</hc:SimpleStackPanel>
|
||||
</Expander.Header>
|
||||
<DataGrid
|
||||
utils:ScrollSynchronizer.SynchronizeWithParent="True"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Children}">
|
||||
<DataGrid.Resources>
|
||||
<localconverter:WireColorConverter x:Key="WireColorConverter" />
|
||||
<Style BasedOn="{StaticResource DataGridCellStyle}" TargetType="DataGridCell">
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource WireColorConverter}">
|
||||
<Binding Path="WireColorHex" />
|
||||
<Binding Path="WireColorHexSec" />
|
||||
<Binding Path="IsMultiColor" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
</Style>
|
||||
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="线芯名称" />
|
||||
<DataGridTextColumn Binding="{Binding WireColorName}" Header="线芯颜色" />
|
||||
<DataGridTextColumn Binding="{Binding FrontTerminalModel}" Header="前连接" />
|
||||
<DataGridTextColumn Binding="{Binding BackTerminalModel}" Header="后连接" />
|
||||
<DataGridTemplateColumn Header="线芯颜色">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border>
|
||||
<Border.Resources>
|
||||
<Style BasedOn="{StaticResource BorderClip}" TargetType="Border">
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource WireColorConverter}">
|
||||
<Binding Path="WireColorHex" />
|
||||
<Binding Path="WireColorHexSec" />
|
||||
<Binding Path="IsMultiColor" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<TextBlock Text="{Binding WireColorName}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorModel}" Header="前连接" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorMCode}" Header="前连接料号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorModel}" Header="后连接" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorMCode}" Header="后连接料号" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--<ItemsControl ItemsSource="{Binding Children}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Margin="5" IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Margin="10,0"
|
||||
BorderBrush="{Binding WireColorHex}"
|
||||
BorderThickness="0,0,0,2">
|
||||
<hc:SimpleStackPanel>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="线芯名称:" />
|
||||
<Run Text="{Binding WireModelSpecification}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="线芯颜色:" />
|
||||
<Run Text="{Binding WireColorName}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="前端子:" />
|
||||
<Run Text="{Binding FrontTerminalModel}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="后端子:" />
|
||||
<Run Text="{Binding BackTerminalModel}" />
|
||||
</TextBlock>
|
||||
</hc:SimpleStackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>-->
|
||||
</Expander>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
|
|
|
@ -4,6 +4,7 @@ using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
|||
using SqlSugar.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||
{
|
||||
|
@ -62,5 +63,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
layoutWindow.Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,29 +24,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
public class MultiCoreWireLayoutHelperViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private MultiCoreWireService _service = new();
|
||||
private readonly MultiCoreWireService _service = new();
|
||||
private string _uniqueKey;
|
||||
private FlexDesigner _currentFlexDesigner;
|
||||
|
||||
private List<string> ApplicationScenarios = [];
|
||||
|
||||
public int ApplicationScenarioIndex = 0;
|
||||
|
||||
|
||||
private List<MultiCoreWireLecModel> _wireData = [];
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
internal void LoadData()
|
||||
{
|
||||
|
||||
var wireDatas = _service.GetByUniqueKey(_uniqueKey);
|
||||
var applicationScenarios = wireDatas.Select(it => it.ApplicationScenario).Distinct().ToList();
|
||||
|
||||
ApplicationScenarios = applicationScenarios;
|
||||
UpdatePropNotify();
|
||||
wireDatas.ForEach(wire =>
|
||||
|
@ -69,7 +61,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void SelectSet_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is OccSelectSet selectSet)
|
||||
|
@ -81,7 +72,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
if (part.Parents != null)
|
||||
{
|
||||
var SelectMotorModel = part.Parents?.First()?.Name ?? "";
|
||||
Debug.WriteLine($"Select part parent -> {part.Parents?.First()?.Name} / {part.Parents?.First()?.ID}");
|
||||
Debug.WriteLine($"Select part parent -> {SelectMotorModel} / {part.Parents?.First()?.ID}");
|
||||
}
|
||||
}
|
||||
else if (item != null)
|
||||
|
@ -90,8 +81,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查选中的线
|
||||
/// </summary>
|
||||
|
|
|
@ -76,6 +76,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private string _wireKey;
|
||||
/// <summary>
|
||||
/// 线材标识
|
||||
/// </summary>
|
||||
public string Wirekey
|
||||
{
|
||||
get => _wireKey;
|
||||
set
|
||||
{
|
||||
_wireKey = value;
|
||||
|
||||
OnPropertyChanged(nameof(Wirekey));
|
||||
|
||||
}
|
||||
}
|
||||
private bool _applicationScenarioSelected;
|
||||
|
||||
public bool ApplicationScenarioSelected
|
||||
|
@ -157,6 +172,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
_wireModelSpecification = value;
|
||||
OnPropertyChanged(nameof(WireModelSpecification));
|
||||
OnLecChanged(nameof(WireModelSpecification));
|
||||
OnWireChange();
|
||||
}
|
||||
}
|
||||
//private string _connectorModel;
|
||||
|
@ -267,8 +283,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
_wireModelSpecifications = value;
|
||||
OnPropertyChanged(nameof(WireModelSpecifications));
|
||||
OnWireChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<string> _highFlexibilitys;
|
||||
/// <summary>
|
||||
/// 线径规格
|
||||
|
@ -310,17 +329,17 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
|
||||
|
||||
private List<MultiCoreWireTerminalModel> _backConnectorModels;
|
||||
private List<MultiCoreWireTerminalModel> _rearConnectorModels;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public List<MultiCoreWireTerminalModel> BackConnectorModels
|
||||
public List<MultiCoreWireTerminalModel> RearConnectorModels
|
||||
{
|
||||
get => _backConnectorModels;
|
||||
get => _rearConnectorModels;
|
||||
set
|
||||
{
|
||||
_backConnectorModels = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModels));
|
||||
_rearConnectorModels = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModels));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,51 +354,51 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
_frontConnectorType = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorType));
|
||||
OnFrontTypeChange(FrontConnectorType);
|
||||
OnFrontConnectorTypeModels(FrontConnectorType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnFrontTypeChange(string type)
|
||||
private void OnFrontConnectorTypeModels(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels ?? [] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
FrontConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel ?? null
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string _backConnectorType;
|
||||
private string _rearConnectorType;
|
||||
/// <summary>
|
||||
/// 后连接器类型
|
||||
/// </summary>
|
||||
public string BackConnectorType
|
||||
public string RearConnectorType
|
||||
{
|
||||
get => _backConnectorType;
|
||||
get => _rearConnectorType;
|
||||
set
|
||||
{
|
||||
_backConnectorType = value;
|
||||
OnPropertyChanged(nameof(BackConnectorType));
|
||||
OnBackTypeChange(BackConnectorType);
|
||||
_rearConnectorType = value;
|
||||
OnPropertyChanged(nameof(RearConnectorType));
|
||||
OnRearConnectorTypeChange(RearConnectorType);
|
||||
|
||||
}
|
||||
}
|
||||
private void OnBackTypeChange(string type)
|
||||
private void OnRearConnectorTypeChange(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
BackConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
RearConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels ?? []];
|
||||
}
|
||||
else
|
||||
{
|
||||
BackConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
RearConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel ?? null
|
||||
}];
|
||||
|
||||
}
|
||||
|
@ -401,17 +420,42 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
|
||||
|
||||
private string _backConnectorModel;
|
||||
private string _rearConnectorModel;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public string BackConnectorModel
|
||||
public string RearConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
get => _rearConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
_rearConnectorModel = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
private int _frontConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
public int FrontConnectorCount
|
||||
{
|
||||
get => _frontConnectorCount;
|
||||
set
|
||||
{
|
||||
_frontConnectorCount = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorCount));
|
||||
}
|
||||
}
|
||||
private int _rearConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
public int RearConnectorCount
|
||||
{
|
||||
get => _rearConnectorCount;
|
||||
set
|
||||
{
|
||||
_rearConnectorCount = value;
|
||||
OnPropertyChanged(nameof(RearConnectorCount));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -436,12 +480,13 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
Id = wire.Id,
|
||||
SeqNo = wire.SeqNo,
|
||||
ApplicationScenario = wire.ApplicationScenario,
|
||||
WireKey = Wirekey,
|
||||
WireDiameterSpecification = wire.WireDiameterSpecification,
|
||||
IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
|
||||
WireCoreCount = wire.WireCoreCount,
|
||||
WireModelSpecification = wire.WireModelSpecification,
|
||||
FrontConnectorModel = wire.FrontConnectorModel,
|
||||
BackConnectorModel = wire.BackConnectorModel,
|
||||
RearConnectorModel = wire.RearConnectorModel,
|
||||
UserId = wire.UserId,
|
||||
ProjectName = wire.ProjectName,
|
||||
UniqueKey = wire.UniqueKey
|
||||
|
@ -557,8 +602,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
WireColorHex = $"#{wire.Color.Major.ToHex()}",
|
||||
WireColorHexSec = $"#{wire.Color.Minor.ToHex()}",
|
||||
IsMultiColor = wire.Color.Major.IsValid() && wire.Color.Minor.IsValid(),
|
||||
FrontTerminalModel = wire.GetEndingPins()?.FirstOrDefault()?.Parents?.FirstOrDefault()?.LibraryName,
|
||||
BackTerminalModel = wire.GetEndingPins()?.LastOrDefault()?.Parents?.FirstOrDefault()?.LibraryName
|
||||
FrontConnectorModel = wire.GetEndingPins()?.FirstOrDefault()?.Parents?.FirstOrDefault()?.LibraryName,
|
||||
RearConnectorModel = wire.GetEndingPins()?.LastOrDefault()?.Parents?.FirstOrDefault()?.LibraryName
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -585,7 +630,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
WireCoreCount = "";
|
||||
WireModelSpecification = "";
|
||||
FrontConnectorType = "";
|
||||
BackConnectorType = "";
|
||||
RearConnectorType = "";
|
||||
|
||||
LecChanging = false;
|
||||
OnLecChanged("");
|
||||
|
@ -599,13 +644,13 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
|| WireCoreCount == null
|
||||
|| WireModelSpecification == null
|
||||
|| FrontConnectorModel == null
|
||||
|| BackConnectorModel == null)
|
||||
|| RearConnectorModel == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("有信息未选择!",caption: "提示",icon: MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
if (LecWires.Any(it => it.ApplicationScenario == ApplicationScenario && it.WireModelSpecification == WireModelSpecification
|
||||
&& it.FrontConnectorModel == FrontConnectorModel && it.BackConnectorModel == BackConnectorModel))
|
||||
&& it.FrontConnectorModel == FrontConnectorModel && it.RearConnectorModel == RearConnectorModel))
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Show("存在信息相同的线,是否继续添加?", "提示", button: MessageBoxButton.YesNo);
|
||||
if(!(result == MessageBoxResult.Yes))
|
||||
|
@ -616,6 +661,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
|
||||
try
|
||||
{
|
||||
var frontConnectorMCode = GetConnectorMCode(FrontConnectorModel, FrontConnectorType);
|
||||
var rearConnectorMCode = GetConnectorMCode(RearConnectorModel, RearConnectorType);
|
||||
|
||||
|
||||
|
||||
var wire = new MultiCoreWireLecModel
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
|
@ -626,7 +676,13 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
WireCoreCount = WireCoreCount,
|
||||
WireModelSpecification = WireModelSpecification,
|
||||
FrontConnectorModel = FrontConnectorModel,
|
||||
BackConnectorModel = BackConnectorModel,
|
||||
FrontConnectorQuantity = FrontConnectorCount,
|
||||
FrontConnectorMCode = frontConnectorMCode,
|
||||
|
||||
RearConnectorModel = RearConnectorModel,
|
||||
RearConnectorQuantity = RearConnectorCount,
|
||||
RearConnectorMCode = rearConnectorMCode,
|
||||
|
||||
UserId = PluginServices.user.ID,
|
||||
ProjectName = LectotypeManager.CURRENT_DOC_NAME,
|
||||
UniqueKey = $"{LectotypeManager.CURRENT_DOC_NAME}_{PluginServices.user.ID}"
|
||||
|
@ -644,8 +700,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
|
||||
WireCoreCount = wire.WireCoreCount,
|
||||
WireModelSpecification = wire.WireModelSpecification,
|
||||
|
||||
FrontConnectorModel = wire.FrontConnectorModel,
|
||||
BackConnectorModel = wire.BackConnectorModel
|
||||
FrontConnectorQuantity = wire.FrontConnectorQuantity,
|
||||
RearConnectorModel = wire.RearConnectorModel,
|
||||
RearConnectorQuantity = wire.RearConnectorQuantity
|
||||
|
||||
});
|
||||
LecWires.Add(wire);
|
||||
|
@ -693,6 +752,33 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private string GetConnectorMCode(string connectorModel,string connectorType)
|
||||
{
|
||||
if(_datas != null)
|
||||
{
|
||||
if (connectorType == "端子")
|
||||
{
|
||||
|
||||
var terminals = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels;
|
||||
return terminals.FirstOrDefault(it => it.TerminalModel == connectorModel)?.TerminalMaterialCode ?? "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO 插头型号信息获取
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWireChange()
|
||||
{
|
||||
OnFrontConnectorTypeModels(FrontConnectorType);
|
||||
OnRearConnectorTypeChange(RearConnectorType);
|
||||
}
|
||||
//private void ReOrderLecWires()
|
||||
//{
|
||||
// int seq = 1;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using EPLAN.Harness.API;
|
||||
using EPLAN.Harness.API.Plugins.Core;
|
||||
using EPLAN.Harness.AppCore;
|
||||
using HandyControl.Controls;
|
||||
using Sinvo.EplanHpD.Plugin.DynaClient;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI;
|
||||
|
@ -70,27 +71,34 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
}
|
||||
if (isLogin)
|
||||
{
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
try
|
||||
{
|
||||
window = new MultiCoreWireWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
window = new MultiCoreWireWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
MessageBox.Show(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue