105040 Update 增加异常提示
This commit is contained in:
parent
9d1d9f4fab
commit
78c2ba4261
|
@ -21,6 +21,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
var bytes = File.ReadAllBytes(file);
|
||||
dataFileStream = new MemoryStream(bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FileNotFoundException(file);
|
||||
}
|
||||
}
|
||||
public List<LectotypeModel> GetCableDatas(string brand = Brands.SANLING_HK_KT)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using EPLAN.Harness.Core.Utils;
|
|||
using EPLAN.Harness.ProjectCore;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Tools.Extension;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
|
@ -176,24 +177,28 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
|||
|
||||
public Task LoadData()
|
||||
{
|
||||
if (string.IsNullOrEmpty(docId))
|
||||
try
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
// 当前的工作区
|
||||
var designer = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == docId);
|
||||
// 获取项目名
|
||||
DocName = GetDocName(designer);
|
||||
LectotypeManager.CURRENT_DOC_NAME = DocName;
|
||||
LectotypeManager.CURRENT_DOC_CREATE_TIME = new DateTimeOffset(designer.CreatedDateDateTime).ToUnixTimeMilliseconds().ToString();
|
||||
|
||||
// 获取所有存在的
|
||||
var wires = designer.GetOrganizerOccurrences(designer.ID);
|
||||
//OriWires = wires.ToList();
|
||||
// 所有的线材
|
||||
// OccCableForked 多芯线? 对应设计器中Cables(电缆)下的内容
|
||||
// OccWire 导线 对应设计器中Wires(导线)下的内容
|
||||
List<LectotypeLineModel> cables = [.. wires
|
||||
|
||||
if (string.IsNullOrEmpty(docId))
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
// 当前的工作区
|
||||
var designer = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == docId);
|
||||
// 获取项目名
|
||||
DocName = GetDocName(designer);
|
||||
LectotypeManager.CURRENT_DOC_NAME = DocName;
|
||||
LectotypeManager.CURRENT_DOC_CREATE_TIME = new DateTimeOffset(designer.CreatedDateDateTime).ToUnixTimeMilliseconds().ToString();
|
||||
|
||||
// 获取所有存在的
|
||||
var wires = designer.GetOrganizerOccurrences(designer.ID);
|
||||
//OriWires = wires.ToList();
|
||||
// 所有的线材
|
||||
// OccCableForked 多芯线? 对应设计器中Cables(电缆)下的内容
|
||||
// OccWire 导线 对应设计器中Wires(导线)下的内容
|
||||
List<LectotypeLineModel> cables = [.. wires
|
||||
.Where(it =>
|
||||
it.GetType() == typeof(OccCableForked)
|
||||
//|| it.GetType() == typeof(OccWire)
|
||||
|
@ -241,9 +246,19 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
|||
//.Where(it => !string.IsNullOrEmpty(it.AxisNo))
|
||||
.OrderBy(it => it?.CurrentLine ?? 0)];
|
||||
|
||||
Wires = StuffData(cables);
|
||||
designer.SelectSet.NodeSelected += SelectSet_NodeSelected;
|
||||
return Task.CompletedTask;
|
||||
Wires = StuffData(cables);
|
||||
designer.SelectSet.NodeSelected += SelectSet_NodeSelected;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show(ex.ToString());
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectSet_NodeSelected(object sender, EPLAN.Harness.Common.Events.EventArgs<BaseOccurrence> e)
|
||||
|
|
Loading…
Reference in New Issue