105040 Update 增加注释
This commit is contained in:
parent
e4320a34e9
commit
2e3eb98583
|
@ -273,7 +273,7 @@
|
|||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\PDFView\PdfiumViewer.csproj">
|
||||
<ProjectReference Include="..\..\PdfiumViewer\PdfiumViewer.csproj">
|
||||
<Project>{60d3c75c-e71d-4116-bd7e-cac68c4dd96b}</Project>
|
||||
<Name>PdfiumViewer</Name>
|
||||
</ProjectReference>
|
||||
|
|
|
@ -174,16 +174,18 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(LectotypeManager.CURRENT_DOC_ID)) return;
|
||||
// 获取当前使用的设计器的实例
|
||||
var doc = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == LectotypeManager.CURRENT_DOC_ID);
|
||||
// 使用设计器根据EPLAN内部的部件ID,获取部件实例
|
||||
var part = doc.GetOccurrenceByID(motorId);
|
||||
//var cable = doc.GetOccurrenceByName(cableName, typeof(OccCableForked));
|
||||
if (part != null)
|
||||
{
|
||||
doc.SelectSet.Clear();
|
||||
var oriOcc = SelfControler<BaseOccurrence>.FindInstance(part.ID);
|
||||
oriOcc.SetVisibility(true, null);
|
||||
doc.SelectSet.Add(oriOcc);
|
||||
|
||||
// 根据EPLAN内部的部件ID,获取部件实例
|
||||
//var oriOcc = SelfControler<BaseOccurrence>.FindInstance(part.ID);
|
||||
part.SetVisibility(true, null);
|
||||
doc.SelectSet.Add(part);
|
||||
doc.FitToSelectSet();
|
||||
doc.SelectSet.OnSelectionChanged();
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
OnPropertyChanged(nameof(InputCode));
|
||||
if (_enableEvent)
|
||||
{
|
||||
// 扫描输入框防抖,延迟一秒后触发
|
||||
// 由于扫描枪不一定有发送回车事件,所以需要自动进行触发
|
||||
if (_debounceTimer == null)
|
||||
{
|
||||
_debounceTimer = new DispatcherTimer();
|
||||
|
@ -116,7 +118,9 @@ private DispatcherTimer _debounceTimer;
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前设计器
|
||||
/// </summary>
|
||||
public void GetCurrentDoc()
|
||||
{
|
||||
try
|
||||
|
@ -146,7 +150,10 @@ private DispatcherTimer _debounceTimer;
|
|||
string searchText = InputCode;
|
||||
PerformSearch(searchText);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码(印记/名称)
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
private void PerformSearch(string searchText)
|
||||
{
|
||||
// 清除错误信息
|
||||
|
@ -154,14 +161,16 @@ private DispatcherTimer _debounceTimer;
|
|||
var cable = ScanCableModels.FirstOrDefault(c => c.Code.Equals(searchText, StringComparison.OrdinalIgnoreCase) || c.Imprint.StartsWith(searchText, StringComparison.OrdinalIgnoreCase));
|
||||
if (cable != null)
|
||||
{
|
||||
|
||||
// 处理其他线是否隐藏
|
||||
OthersOccShow(!OthersWireShow);
|
||||
if (_continueScan)
|
||||
{
|
||||
// 清空输入框
|
||||
_enableEvent = false;
|
||||
InputCode = string.Empty;
|
||||
_enableEvent = true;
|
||||
}
|
||||
// 扫描即装配
|
||||
if (ScanAndAssembled)
|
||||
{
|
||||
//cable.IsChecked = true;
|
||||
|
@ -172,6 +181,8 @@ private DispatcherTimer _debounceTimer;
|
|||
ScanCableModels.Insert(0,scanCableModel);
|
||||
|
||||
}
|
||||
// 扫描的线位置,选中扫描线的上一条线,避免无法判断是否已扫描
|
||||
// index不能小于0
|
||||
ScanedIndex = Math.Max(cable.Index - 1, 0);
|
||||
ToSourceById(cable.Id);
|
||||
|
||||
|
@ -210,17 +221,24 @@ private DispatcherTimer _debounceTimer;
|
|||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将设计器聚焦到对应的线
|
||||
/// </summary>
|
||||
/// <param name="occId"></param>
|
||||
private void ToSourceById(string occId)
|
||||
{
|
||||
// 从设计器中获取线实例
|
||||
var occWire = _currentFlexDesigner.GetOccurrenceByID(occId);
|
||||
if (occWire != null)
|
||||
{
|
||||
// 设置线显示
|
||||
occWire.SetVisibility(true, null);
|
||||
// 清空已选择项并加入当前线
|
||||
_currentFlexDesigner.SelectSet.Clear();
|
||||
_currentFlexDesigner.SelectSet.Add(occWire);
|
||||
_currentFlexDesigner.FitToSelectSet();
|
||||
|
||||
// 缩放设计器且触发选中事件
|
||||
_currentFlexDesigner.FitToSelectSet();
|
||||
_currentFlexDesigner.SelectSet.OnSelectionChanged();
|
||||
|
||||
//_currentFlexDesigner.Camera.GraphicControl._HighlightNode()
|
||||
|
@ -244,18 +262,23 @@ private DispatcherTimer _debounceTimer;
|
|||
|
||||
public void OthersOccShow(bool show = false)
|
||||
{
|
||||
// 获取设计器中所有的Occurrence
|
||||
_currentFlexDesigner.GetOrganizerOccurrences().ToList().ForEach(occ =>
|
||||
{
|
||||
// 导线
|
||||
if (occ is OccWire wire)
|
||||
{
|
||||
wire.SetVisibility(show, null);
|
||||
}
|
||||
// 电缆
|
||||
if (occ is OccCableForked cable)
|
||||
{
|
||||
cable.SetVisibility(show, null);
|
||||
}
|
||||
// 是否包含注解
|
||||
if (_isIncludeAnnotation)
|
||||
{
|
||||
// 注解
|
||||
if (occ is OccAnnotation annotation)
|
||||
{
|
||||
Debug.WriteLine($"BaseOccurrence -> {annotation.Name} Type: {annotation.GetType().Name}");
|
||||
|
@ -265,6 +288,7 @@ private DispatcherTimer _debounceTimer;
|
|||
});
|
||||
if (show)
|
||||
{
|
||||
// 放大到选中的线
|
||||
_currentFlexDesigner.FitToSelectSet();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue