105040 增加布线助手窗口

This commit is contained in:
lihanbo 2024-12-04 14:21:35 +08:00
parent 698c23fcdb
commit 01ce9d436a
5 changed files with 154 additions and 8 deletions

View File

@ -180,6 +180,9 @@
<Compile Include="View\CableLectotypeWindow.xaml.cs">
<DependentUpon>CableLectotypeWindow.xaml</DependentUpon>
</Compile>
<Compile Include="View\LayoutHelperWindow.xaml.cs">
<DependentUpon>LayoutHelperWindow.xaml</DependentUpon>
</Compile>
<Compile Include="View\LectotypeWindow.xaml.cs">
<DependentUpon>LectotypeWindow.xaml</DependentUpon>
</Compile>
@ -201,6 +204,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\LayoutHelperWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\LectotypeWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@ -0,0 +1,89 @@
<Window
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.LayoutHelperWindow"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="布线助手"
Width="450"
Height="230"
MinWidth="450"
MinHeight="230"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition Height="15" />
<RowDefinition Height="30" />
<RowDefinition Height="*" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<hc:SimpleStackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock FontSize="14" TextWrapping="Wrap">
<Run Text="选中的电机:" />
<Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" />
</TextBlock>
<TextBlock
Margin="5,0,0,0"
FontSize="14"
TextWrapping="Wrap">
<Run Text="当前布线的电机:" />
<Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" />
</TextBlock>
</hc:SimpleStackPanel>
<StackPanel Grid.Row="1" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center" FontSize="14">
<Run Text="当前线段:" />
<Run Foreground="{StaticResource DangerBrush}" Text="前段" />
<Run Text="当前线类型:" />
<Run Foreground="{StaticResource DangerBrush}" Text="编码器线+动力线" />
<Run Text="轴号:" />
<Run Foreground="{StaticResource DangerBrush}" Text="MRJ001" />
</TextBlock>
</StackPanel>
<ListView Grid.Row="2">
<ListView.View>
<GridView hc:GridViewAttach.ColumnHeaderHeight="15">
<GridViewColumn Width="100" Header="线类型" />
<GridViewColumn Width="100" Header="线型号" />
<GridViewColumn Width="100" Header="查看图纸" />
</GridView>
</ListView.View>
<ListViewItem Content="12312" />
</ListView>
<hc:SimpleStackPanel Grid.Row="3">
<TextBlock TextWrapping="Wrap">
<Run Text="选中的线:" />
</TextBlock>
<TextBlock>
<Run Text="三菱伺服编码器线 TRVVSP3×2×0.2-2000W-CE定制(带DB9公头)电机" />
</TextBlock>
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Grid.Row="4" VerticalAlignment="Bottom">
<DockPanel HorizontalAlignment="Stretch">
<Button
Content="上一根线"
DockPanel.Dock="Left"
Style="{StaticResource ButtonDanger}" />
<Button
HorizontalAlignment="Right"
Content="下一根线"
DockPanel.Dock="Right"
Style="{StaticResource ButtonPrimary}" />
<Button
Content="MRJ001-1"
DockPanel.Dock="Right"
Style="{StaticResource ButtonSuccess}" />
</DockPanel>
</hc:SimpleStackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,27 @@
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
{
/// <summary>
/// LayoutHelperWindow.xaml 的交互逻辑
/// </summary>
public partial class LayoutHelperWindow : Window
{
public LayoutHelperWindow()
{
InitializeComponent();
}
}
}

View File

@ -172,7 +172,8 @@
<Button
Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource DialogBoxLauncherGeometry}"
Content="置顶显示"
Click="StartLayoutBtn_Click"
Content="开始布线"
FontSize="14"
Style="{StaticResource ButtonSuccess}" />
</hc:SimpleStackPanel>
@ -208,6 +209,14 @@
<Setter Property="Background" Value="#dc4d41" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsError}" Value="false" />
<Condition Binding="{Binding IsChecked}" Value="true" />
</MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#18a05d" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</ListBox.Resources>
@ -218,7 +227,7 @@
<Expander
HorizontalAlignment="Stretch"
FontSize="14"
IsExpanded="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}">
IsExpanded="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=ListBoxItem}}">
<!-- Expander 的标题部分 -->
<Expander.Header>
@ -230,7 +239,6 @@
<ColumnDefinition Width="160" MinWidth="160" />
<ColumnDefinition Width="*" MinWidth="300" />
<ColumnDefinition Width="300" MinWidth="300" />
<ColumnDefinition Width="160" MinWidth="160" />
</Grid.ColumnDefinitions>
<!-- 电机型号 -->
<TextBlock
@ -258,10 +266,8 @@
VerticalAlignment="Center"
Orientation="Horizontal">
<!-- Click="SelectedLectotype_Click" -->
<ToggleButton Content="展开线材选型" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=Expander}}" />
<ToggleButton Content="展开线材选型" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=Expander}}" />
</StackPanel>
<!-- ID -->
<TextBlock Grid.Column="5" Text="{Binding OccPartId}" />
</Grid>
</Expander.Header>
<!-- Expander 的内容部分 -->

View File

@ -1,5 +1,9 @@
using CommunityToolkit.Mvvm.Messaging;
using EPLAN.Harness.AppCore;
using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.Extensions;
using EPLAN.Harness.Core.LibEntities;
using EPLAN.Harness.Core.Library;
using HandyControl.Controls;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
@ -9,15 +13,18 @@ using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
using Sinvo.EplanHpD.Plugin.WPFUI.View;
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms.Integration;
using System.Windows.Input;
using System.Windows.Media.Animation;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace Sinvo.EplanHpD.Plugin.WPFUI
{
@ -343,10 +350,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
//}
}
}
private void EnableSelectSetBtn_Click(object sender, RoutedEventArgs e)
{
//LibrarySystem.PartBrowser.GetPart((new List<CategoryType>() { CategoryType.Cable }).ToQueryFilter(), "123");
}
private void MotorDataGridToMotorSourceMenuItem_Click(object sender, RoutedEventArgs e)
@ -394,5 +400,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
{
}
private void StartLayoutBtn_Click(object sender, RoutedEventArgs e)
{
var window = new LayoutHelperWindow();
ElementHost.EnableModelessKeyboardInterop(window);
var mainApp = BaseApp.ActiveApplication;
var helper = new System.Windows.Interop.WindowInteropHelper(window);
helper.Owner = mainApp.Handle;
window.Show();
this.Close();
}
}
}