105067 add线材两端管脚信息窗口
This commit is contained in:
parent
a598f5f352
commit
6bed559bfe
|
@ -207,6 +207,9 @@
|
|||
<Compile Include="View\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\ScannerInfo.xaml.cs">
|
||||
<DependentUpon>ScannerInfo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\ScannerWindow.xaml.cs">
|
||||
<DependentUpon>ScannerWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -234,6 +237,10 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\ScannerInfo.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\ScannerWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -266,7 +273,7 @@
|
|||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\PdfiumViewer\PdfiumViewer.csproj">
|
||||
<ProjectReference Include="..\..\PDFView\PdfiumViewer.csproj">
|
||||
<Project>{60d3c75c-e71d-4116-bd7e-cac68c4dd96b}</Project>
|
||||
<Name>PdfiumViewer</Name>
|
||||
</ProjectReference>
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<Window
|
||||
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.ScannerInfo"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.View"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel"
|
||||
Title="ScannerInfo"
|
||||
Width="1000"
|
||||
Height="70"
|
||||
MinHeight="85"
|
||||
MaxHeight="85"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:ScannerViewModel}"
|
||||
AllowsTransparency="True"
|
||||
Left="300"
|
||||
Topmost="True"
|
||||
WindowStartupLocation="Manual"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d">
|
||||
<Grid x:Name="top">
|
||||
|
||||
<DataGrid
|
||||
x:Name="scannerinfo"
|
||||
Width="auto"
|
||||
Margin="6"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
ColumnHeaderHeight="30"
|
||||
ColumnWidth="auto"
|
||||
FontSize="18"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding _ScanCableModels}"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<DataGrid.RowStyle>
|
||||
<Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked}" Value="false">
|
||||
<Setter Property="Background" Value="#dc4d41" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsChecked}" Value="true">
|
||||
<Setter Property="Background" Value="#18a05d" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="#33326cf3" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" Header="线材名" />
|
||||
<DataGridTextColumn Binding="{Binding Code}" Header="线材号" />
|
||||
<DataGridTextColumn Binding="{Binding S_Pin}" Header="开始管脚" />
|
||||
<DataGridTextColumn Binding="{Binding E_Pin}" Header="结束管脚" />
|
||||
<DataGridTextColumn Binding="{Binding Length}" Header="长度" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
|
@ -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 的交互逻辑
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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" />
|
||||
</hc:TextBox.Text>
|
||||
</hc:TextBox>
|
||||
|
||||
<WrapPanel Margin="10">
|
||||
<CheckBox
|
||||
x:Name="HideOthersWire"
|
||||
|
@ -161,7 +162,7 @@
|
|||
hc:Poptip.HitMode="Hover"
|
||||
Binding="{Binding Name}"
|
||||
Header="线材名称" />
|
||||
<DataGridTextColumn
|
||||
<!--<DataGridTextColumn
|
||||
Width="60"
|
||||
hc:Poptip.Content="{Binding Length}"
|
||||
hc:Poptip.HitMode="Hover"
|
||||
|
@ -178,7 +179,7 @@
|
|||
hc:Poptip.Content="{Binding Length}"
|
||||
hc:Poptip.HitMode="Hover"
|
||||
Binding="{Binding E_Pin}"
|
||||
Header="结束管脚" />
|
||||
Header="结束管脚" />-->
|
||||
<DataGridTextColumn Binding="{Binding Imprint}" Header="印记" />
|
||||
<!--<DataGridTextColumn Binding="{Binding IsChecked}" Header="线材名称" />-->
|
||||
</DataGrid.Columns>
|
||||
|
|
|
@ -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<CommonMessage, string>(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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue