105040 优化界面显示效果

This commit is contained in:
lihanbo 2024-12-05 14:15:08 +08:00
parent 01ce9d436a
commit 7bcddb1702
4 changed files with 112 additions and 80 deletions

View File

@ -227,7 +227,7 @@
VirtualizingPanel.ScrollUnit="Pixel"> VirtualizingPanel.ScrollUnit="Pixel">
<DataGrid.RowStyle> <DataGrid.RowStyle>
<Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow"> <Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow">
<Setter Property="Foreground" Value="White" /> <Setter Property="Foreground" Value="{StaticResource LightPrimaryBrush}" />
<Setter Property="Background" Value="#18a05d" /> <Setter Property="Background" Value="#18a05d" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding DrawingNo}" Value=""> <DataTrigger Binding="{Binding DrawingNo}" Value="">

View File

@ -1,4 +1,4 @@
<Window <hc:GlowWindow
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.LayoutHelperWindow" x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.LayoutHelperWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -11,6 +11,8 @@
Height="230" Height="230"
MinWidth="450" MinWidth="450"
MinHeight="230" MinHeight="230"
ActiveGlowColor="{DynamicResource PrimaryColor}"
Background="White"
mc:Ignorable="d"> mc:Ignorable="d">
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -19,71 +21,76 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
<Grid Margin="2"> <Border Background="{DynamicResource MainContentForegroundDrawingBrush}">
<Grid.RowDefinitions> <Grid Margin="2">
<RowDefinition Height="15" /> <Grid.RowDefinitions>
<RowDefinition Height="30" /> <RowDefinition Height="15" />
<RowDefinition Height="*" /> <RowDefinition Height="30" />
<RowDefinition Height="30" /> <RowDefinition Height="*" />
<RowDefinition Height="30" /> <RowDefinition Height="30" />
</Grid.RowDefinitions> <RowDefinition Height="30" />
<hc:SimpleStackPanel Grid.Row="0" Orientation="Horizontal"> </Grid.RowDefinitions>
<TextBlock FontSize="14" TextWrapping="Wrap"> <hc:SimpleStackPanel Grid.Row="0" Orientation="Horizontal">
<Run Text="选中的电机:" /> <TextBlock FontSize="14" TextWrapping="Wrap">
<Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" /> <Run Text="选中的电机:" />
</TextBlock> <Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" />
<TextBlock </TextBlock>
Margin="5,0,0,0" <TextBlock
FontSize="14" Margin="5,0,0,0"
TextWrapping="Wrap"> FontSize="14"
<Run Text="当前布线的电机:" /> TextWrapping="Wrap">
<Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" /> <Run Text="当前布线的电机:" />
</TextBlock> <Run Foreground="{StaticResource DangerBrush}" Text="HK-KT103WJK" />
</hc:SimpleStackPanel> </TextBlock>
<StackPanel Grid.Row="1" VerticalAlignment="Center"> </hc:SimpleStackPanel>
<TextBlock VerticalAlignment="Center" FontSize="14"> <StackPanel Grid.Row="1" VerticalAlignment="Center">
<Run Text="当前线段:" /> <TextBlock VerticalAlignment="Center" FontSize="14">
<Run Foreground="{StaticResource DangerBrush}" Text="前段" /> <Run Text="当前线段:" />
<Run Text="当前线类型:" /> <Run Foreground="{StaticResource DangerBrush}" Text="前段" />
<Run Foreground="{StaticResource DangerBrush}" Text="编码器线+动力线" /> <Run Text="当前线类型:" />
<Run Text="轴号:" /> <Run Foreground="{StaticResource DangerBrush}" Text="编码器线+动力线" />
<Run Foreground="{StaticResource DangerBrush}" Text="MRJ001" /> <Run Text="轴号:" />
</TextBlock> <Run Foreground="{StaticResource DangerBrush}" Text="MRJ001" />
</StackPanel> </TextBlock>
<ListView Grid.Row="2"> </StackPanel>
<ListView.View> <ListView
<GridView hc:GridViewAttach.ColumnHeaderHeight="15"> Grid.Row="2"
<GridViewColumn Width="100" Header="线类型" /> hc:GridViewAttach.ColumnHeaderHeight="10"
<GridViewColumn Width="100" Header="线型号" /> Style="{StaticResource ListView.Small}">
<GridViewColumn Width="100" Header="查看图纸" /> <ListView.View>
</GridView> <GridView>
</ListView.View> <GridViewColumn Width="100" Header="线类型" />
<ListViewItem Content="12312" /> <GridViewColumn Width="200" Header="线型号" />
</ListView> <GridViewColumn Width="50" Header="图纸" />
<hc:SimpleStackPanel Grid.Row="3"> </GridView>
<TextBlock TextWrapping="Wrap"> </ListView.View>
<Run Text="选中的线:" /> <ListViewItem Content="1231211111111111111" />
</TextBlock> </ListView>
<TextBlock> <hc:SimpleStackPanel Grid.Row="3">
<Run Text="三菱伺服编码器线 TRVVSP3×2×0.2-2000W-CE定制(带DB9公头)电机" /> <TextBlock TextWrapping="Wrap">
</TextBlock> <Run Text="选中的线:" />
</hc:SimpleStackPanel> </TextBlock>
<hc:SimpleStackPanel Grid.Row="4" VerticalAlignment="Bottom"> <TextBlock>
<DockPanel HorizontalAlignment="Stretch"> <Run Text="三菱伺服编码器线 TRVVSP3×2×0.2-2000W-CE定制(带DB9公头)电机" />
<Button </TextBlock>
Content="上一根线" </hc:SimpleStackPanel>
DockPanel.Dock="Left" <hc:SimpleStackPanel Grid.Row="4" VerticalAlignment="Bottom">
Style="{StaticResource ButtonDanger}" /> <DockPanel HorizontalAlignment="Stretch">
<Button <Button
HorizontalAlignment="Right" Content="上一根线"
Content="下一根线" DockPanel.Dock="Left"
DockPanel.Dock="Right" Style="{StaticResource ButtonDanger}" />
Style="{StaticResource ButtonPrimary}" /> <Button
<Button HorizontalAlignment="Right"
Content="MRJ001-1" Content="下一根线"
DockPanel.Dock="Right" DockPanel.Dock="Right"
Style="{StaticResource ButtonSuccess}" /> Style="{StaticResource ButtonPrimary}" />
</DockPanel> <Button
</hc:SimpleStackPanel> Content="MRJ001-1"
</Grid> DockPanel.Dock="Right"
</Window> Style="{StaticResource ButtonSuccess}" />
</DockPanel>
</hc:SimpleStackPanel>
</Grid>
</Border>
</hc:GlowWindow>

View File

@ -184,6 +184,7 @@
x:Name="MotorListView" x:Name="MotorListView"
Padding="0" Padding="0"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
Focusable="True"
ItemsSource="{Binding Motors}" ItemsSource="{Binding Motors}"
ScrollViewer.CanContentScroll="False" ScrollViewer.CanContentScroll="False"
VirtualizingPanel.ScrollUnit="Pixel"> VirtualizingPanel.ScrollUnit="Pixel">
@ -191,7 +192,11 @@
<Style BasedOn="{StaticResource ListBoxItemBaseStyle}" TargetType="ListBoxItem"> <Style BasedOn="{StaticResource ListBoxItemBaseStyle}" TargetType="ListBoxItem">
<Setter Property="Padding" Value="0" /> <Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" /> <Setter Property="Margin" Value="0" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#f5f5f5" />
</Trigger>
</Style.Triggers>
</Style> </Style>
</ListBox.ItemContainerStyle> </ListBox.ItemContainerStyle>
<ListBox.Resources> <ListBox.Resources>
@ -202,7 +207,7 @@
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsExpanded" Value="True"> <Trigger Property="IsExpanded" Value="True">
<Setter Property="Foreground" Value="{StaticResource LightPrimaryBrush}" /> <Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
</Trigger> </Trigger>
<DataTrigger Binding="{Binding IsError}" Value="True"> <DataTrigger Binding="{Binding IsError}" Value="True">
@ -267,6 +272,10 @@
Orientation="Horizontal"> Orientation="Horizontal">
<!-- Click="SelectedLectotype_Click" --> <!-- Click="SelectedLectotype_Click" -->
<ToggleButton Content="展开线材选型" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=Expander}}" /> <ToggleButton Content="展开线材选型" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=Expander}}" />
<Button
Margin="10,0,0,0"
Click="MotorListViewToMotorSourceMenuItem_Click"
Content="查看3D中电机" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Expander.Header> </Expander.Header>

View File

@ -86,14 +86,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
LoadingMask.Visibility = Visibility.Visible; LoadingMask.Visibility = Visibility.Visible;
ViewModel.GetMotors().ContinueWith(x => ViewModel.GetMotors().ContinueWith(x =>
{ {
ViewModel.LoadData() //ViewModel.LoadData()
.ContinueWith(x => // .ContinueWith(x =>
{ // {
this.Dispatcher.BeginInvoke(delegate () this.Dispatcher.BeginInvoke(delegate ()
{ {
LoadingMask.Visibility = Visibility.Collapsed; LoadingMask.Visibility = Visibility.Collapsed;
}); });
}); //});
}); });
} }
@ -393,7 +393,23 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
private void MotorListViewToMotorSourceMenuItem_Click(object sender, RoutedEventArgs e) private void MotorListViewToMotorSourceMenuItem_Click(object sender, RoutedEventArgs e)
{ {
var selectItem = MotorListView.SelectedItem;
if (selectItem is MotorModel motor)
{
var motorModelPartId = motor?.OccPartId;
//var cableName = model.IsComplexLine ? model.CableName.Split('/')[1] : model.CableName;
//if (string.IsNullOrEmpty(motorModelPartId))
//{
// FlexMessageBox.ShowText(FlexMessageBox.Type.INFO, "未获取到电机名称");
//}
//else
{
ViewModel.ToMotorSource(motorModelPartId, "");
}
//}
}
} }
private void MotorListViewToCableLectotype_Click(object sender, RoutedEventArgs e) private void MotorListViewToCableLectotype_Click(object sender, RoutedEventArgs e)