diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
index f3743c7..ba40b69 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
@@ -207,6 +207,9 @@
MainWindow.xaml
+
+ ScannerInfo.xaml
+
ScannerWindow.xaml
@@ -234,6 +237,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -266,7 +273,7 @@
-
+
{60d3c75c-e71d-4116-bd7e-cac68c4dd96b}
PdfiumViewer
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml
new file mode 100644
index 0000000..28c0302
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml.cs
new file mode 100644
index 0000000..0fce9ae
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerInfo.xaml.cs
@@ -0,0 +1,68 @@
+using EPLAN.Harness.Core;
+using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using DataGrid = System.Windows.Controls.DataGrid;
+
+namespace Sinvo.EplanHpD.Plugin.WPFUI.View
+{
+ /// ScannerInfo.xaml 的交互逻辑
+ ///
+ public partial class ScannerInfo : Window
+ {
+ public ScannerViewModel _scannerViewModel;
+ public static readonly bool o = false;
+ public ScannerInfo(ScannerViewModel scannerViewModel)
+ {
+ InitializeComponent();
+ _scannerViewModel = scannerViewModel;
+ this.DataContext = _scannerViewModel;
+ this.Topmost = true;
+ }
+
+ private void DataGrid_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ for (int i = 1; i < this.scannerinfo.Items.Count; i++)
+ {
+ DataGridRow row = (DataGridRow)scannerinfo.ItemContainerGenerator.ContainerFromIndex(i);
+ // 如果行还没有生成,则调用此方法以强制生成
+ if (row == null)
+ {
+ scannerinfo.ScrollIntoView(scannerinfo.Items[i]);
+ scannerinfo.ScrollIntoView(scannerinfo.Items[i]);
+ row = (DataGridRow)scannerinfo.ItemContainerGenerator.ContainerFromIndex(i);
+ if (row != null)
+ {
+ row.Visibility = Visibility.Collapsed;
+ }
+ }
+
+
+ }
+ }
+ public void ScannerInfoClosed(object sender, EventArgs e)
+ {
+ this.Close(); // 或者你可以根据需要选择是否关闭当前窗口
+ // 如果你想要关闭的是另一个特定的窗口实例,而不是当前窗口,
+ // 那么你应该在这里关闭那个特定的窗口实例,比如:
+ // someOtherWindowInstance.Close();
+ }
+
+ private void DataGrid_DataContextChanged(object sender, DataGridRowDetailsEventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml
index f0657a7..f34b2f7 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml
@@ -8,11 +8,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel"
Title="扫描"
- Width="540"
+ Width="340"
Height="750"
MinWidth="340"
d:DataContext="{d:DesignInstance Type=viewmodel:ScannerViewModel}"
- Left="1300"
+ Left="1500"
Loaded="Window_Loaded"
Top="450"
WindowStartupLocation="Manual"
@@ -49,6 +49,7 @@
ValidatesOnNotifyDataErrors="True" />
+
-
+ Header="结束管脚" />-->
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml.cs
index d56d15d..a880ca2 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/ScannerWindow.xaml.cs
@@ -49,6 +49,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
InitializeComponent();
_viewModel = new ScannerViewModel();
this.DataContext = _viewModel;
+
+
}
private void TopMostWindow_Checked(object sender, RoutedEventArgs e)
@@ -95,8 +97,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
private void Window_Loaded(object sender, RoutedEventArgs e)
{
+
_viewModel.GetCurrentDoc();
_viewModel.GetAllCables();
+ ScannerInfo scannerInfo = new ScannerInfo(_viewModel);
+ this.Closing += scannerInfo.ScannerInfoClosed;
+ scannerInfo.Show();
WeakReferenceMessenger.Default.Register(sender, "ScanedIndexChanged", (r, m) =>
{
Dispatcher.BeginInvoke(new Action(() =>
@@ -106,5 +112,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
}
);
}
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ ScanCodeTextBox.Focus();
+ }
+
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs
index 62ccb61..d6bdc02 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/ScannerViewModel.cs
@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.Messaging;
using EPLAN.Harness.API;
using EPLAN.Harness.AppCore.StudioCommon.TreeView;
+using EPLAN.Harness.Common;
using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.Extensions;
using EPLAN.Harness.Primitives.Treeviews;
@@ -107,7 +108,7 @@ private DispatcherTimer _debounceTimer;
S_Pin= wire.ConnectedPinsUI.Substring(0,wire.ConnectedPinsUI.IndexOf("<>")),
E_Pin= wire.ConnectedPinsUI.Substring( wire.ConnectedPinsUI.IndexOf("<>")+3,wire.ConnectedPinsUI.Length- wire.ConnectedPinsUI.IndexOf("<>")-3),
Name = wire.LibraryName,
- Length=wire.Length_VH.ToString(),
+ Length= Math.Ceiling(wire.Length_VH.GetValueInUnit(UNIT_CLASS.LENGTH)).ToString(),
Code = wire.Name,
Imprint = wire.Imprint
});