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