105040 优化电机线材选型页面
This commit is contained in:
parent
4ffa6d478a
commit
870faf37a9
|
@ -0,0 +1,16 @@
|
||||||
|
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Common
|
||||||
|
{
|
||||||
|
public class CommonMessage : ValueChangedMessage<int>
|
||||||
|
{
|
||||||
|
public CommonMessage(int value) : base(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
using EPLAN.Harness.Core.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
||||||
|
{
|
||||||
|
public class ScanCableModel : CheckedModel
|
||||||
|
{
|
||||||
|
private int _index;
|
||||||
|
public int Index
|
||||||
|
{
|
||||||
|
get => _index; set
|
||||||
|
{
|
||||||
|
_index = value;
|
||||||
|
OnPropertyChanged(nameof(Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _name; set
|
||||||
|
{
|
||||||
|
_name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _code;
|
||||||
|
public string Code
|
||||||
|
{
|
||||||
|
get => _code;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_code = value;
|
||||||
|
OnPropertyChanged(nameof(Code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _imprint;
|
||||||
|
public string Imprint
|
||||||
|
{
|
||||||
|
get => _imprint;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_imprint = value;
|
||||||
|
OnPropertyChanged(nameof(Imprint));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -135,6 +135,7 @@
|
||||||
<Reference Include="WindowsFormsIntegration" />
|
<Reference Include="WindowsFormsIntegration" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Common\CommonMessage.cs" />
|
||||||
<Compile Include="Models\CheckedModel.cs" />
|
<Compile Include="Models\CheckedModel.cs" />
|
||||||
<Compile Include="Models\ConfigItemModel.cs" />
|
<Compile Include="Models\ConfigItemModel.cs" />
|
||||||
<Compile Include="Models\ExcelModel.cs" />
|
<Compile Include="Models\ExcelModel.cs" />
|
||||||
|
@ -146,6 +147,7 @@
|
||||||
<Compile Include="Models\LineBomModel.cs" />
|
<Compile Include="Models\LineBomModel.cs" />
|
||||||
<Compile Include="Models\MotorModel.cs" />
|
<Compile Include="Models\MotorModel.cs" />
|
||||||
<Compile Include="Models\ReportModel.cs" />
|
<Compile Include="Models\ReportModel.cs" />
|
||||||
|
<Compile Include="Models\ScanCableModel.cs" />
|
||||||
<Compile Include="Models\StuffedDataModel.cs" />
|
<Compile Include="Models\StuffedDataModel.cs" />
|
||||||
<Compile Include="Models\TerminalModel.cs" />
|
<Compile Include="Models\TerminalModel.cs" />
|
||||||
<Compile Include="TestWindow.xaml.cs">
|
<Compile Include="TestWindow.xaml.cs">
|
||||||
|
@ -164,6 +166,8 @@
|
||||||
<Compile Include="Utils\FlagEnumConverter.cs" />
|
<Compile Include="Utils\FlagEnumConverter.cs" />
|
||||||
<Compile Include="Utils\LambdaComparer.cs" />
|
<Compile Include="Utils\LambdaComparer.cs" />
|
||||||
<Compile Include="Utils\LectotypeLengthDataTemplateSelector.cs" />
|
<Compile Include="Utils\LectotypeLengthDataTemplateSelector.cs" />
|
||||||
|
<Compile Include="Utils\LectotypeManager.cs" />
|
||||||
|
<Compile Include="Utils\MessageSend.cs" />
|
||||||
<Compile Include="Utils\MotorExcelHelper.cs" />
|
<Compile Include="Utils\MotorExcelHelper.cs" />
|
||||||
<Compile Include="Utils\NameTypeConverter.cs" />
|
<Compile Include="Utils\NameTypeConverter.cs" />
|
||||||
<Compile Include="Utils\PropertyListExt.cs" />
|
<Compile Include="Utils\PropertyListExt.cs" />
|
||||||
|
@ -172,6 +176,7 @@
|
||||||
<Compile Include="ViewModel\LectotypeViewModel.cs" />
|
<Compile Include="ViewModel\LectotypeViewModel.cs" />
|
||||||
<Compile Include="ViewModel\MainViewModel.Check.cs" />
|
<Compile Include="ViewModel\MainViewModel.Check.cs" />
|
||||||
<Compile Include="ViewModel\MainViewModel.cs" />
|
<Compile Include="ViewModel\MainViewModel.cs" />
|
||||||
|
<Compile Include="ViewModel\ScannerViewModel.cs" />
|
||||||
<Compile Include="View\CableLectotypeWindow.xaml.cs">
|
<Compile Include="View\CableLectotypeWindow.xaml.cs">
|
||||||
<DependentUpon>CableLectotypeWindow.xaml</DependentUpon>
|
<DependentUpon>CableLectotypeWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -181,6 +186,9 @@
|
||||||
<Compile Include="View\MainWindow.xaml.cs">
|
<Compile Include="View\MainWindow.xaml.cs">
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="View\ScannerWindow.xaml.cs">
|
||||||
|
<DependentUpon>ScannerWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Page Include="TestWindow.xaml">
|
<Page Include="TestWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -201,6 +209,10 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="View\ScannerWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
@ -235,6 +247,9 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm">
|
||||||
|
<Version>8.4.0-preview3</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="HandyControl">
|
<PackageReference Include="HandyControl">
|
||||||
<Version>3.5.1</Version>
|
<Version>3.5.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
@ -252,7 +267,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Commands\" />
|
<Folder Include="Commands\" />
|
||||||
<Folder Include="Common\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -40,13 +40,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
var window = new CableLectotypeWindow(new Models.MotorModel
|
//var window = new CableLectotypeWindow(new Models.MotorModel
|
||||||
{
|
//{
|
||||||
AxisNo = "MRJ001",
|
// AxisNo = "MRJ001",
|
||||||
MotorPower = "1000W(220V)",
|
// MotorPower = "1000W(220V)",
|
||||||
MotorModelStr = "HK-KT103WJK",
|
// MotorModelStr = "HK-KT103WJK",
|
||||||
MotorSerie = "HK-KT"
|
// MotorSerie = "HK-KT"
|
||||||
});
|
//});
|
||||||
|
//window.ShowDialog();
|
||||||
|
|
||||||
|
var window = new ScannerWindow();
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||||
|
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||||
|
{
|
||||||
|
public static class LectotypeManager
|
||||||
|
{
|
||||||
|
public static MotorModel Motor;
|
||||||
|
|
||||||
|
|
||||||
|
public class LectotypeViewModelFactory
|
||||||
|
{
|
||||||
|
private static readonly IDictionary<string, CableLectotypeViewModel> _motorViewModel = new Dictionary<string, CableLectotypeViewModel>();
|
||||||
|
|
||||||
|
public static CableLectotypeViewModel CreateOrGet(MotorModel motor)
|
||||||
|
{
|
||||||
|
if (motor == null || string.IsNullOrEmpty(motor.OccPartId))
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"CreateOrGet Create for null-> {motor?.MotorModelStr} => {motor?.OccPartId}");
|
||||||
|
|
||||||
|
return new CableLectotypeViewModel(new MotorModel());
|
||||||
|
}
|
||||||
|
if (_motorViewModel.ContainsKey(motor.OccPartId))
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"CreateOrGet Get -> {motor.MotorModelStr} => {motor.OccPartId}");
|
||||||
|
return _motorViewModel[motor.OccPartId];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var viewModel = new CableLectotypeViewModel(motor);
|
||||||
|
_motorViewModel.Add(motor.OccPartId, viewModel);
|
||||||
|
Debug.WriteLine($"CreateOrGet Create -> {motor.MotorModelStr} => {motor.OccPartId}");
|
||||||
|
return viewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Register(MotorModel motor, CableLectotypeViewModel viewModel)
|
||||||
|
{
|
||||||
|
if (!_motorViewModel.ContainsKey(motor.OccPartId))
|
||||||
|
{
|
||||||
|
_motorViewModel.Add(motor.OccPartId, viewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 消息发送与接收
|
||||||
|
/// </summary>
|
||||||
|
public class MessageSend
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<string, List<Action<object>>> _subscribers = new();
|
||||||
|
|
||||||
|
public static void Subscribe(string message, Action<object> callback)
|
||||||
|
{
|
||||||
|
if (!_subscribers.ContainsKey(message))
|
||||||
|
{
|
||||||
|
_subscribers[message] = new List<Action<object>>();
|
||||||
|
}
|
||||||
|
_subscribers[message].Add(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Unsubscribe(string message, Action<object> callback)
|
||||||
|
{
|
||||||
|
if (_subscribers.ContainsKey(message))
|
||||||
|
{
|
||||||
|
_subscribers[message].Remove(callback);
|
||||||
|
if (_subscribers[message].Count == 0)
|
||||||
|
{
|
||||||
|
_subscribers.Remove(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Publish(string message, object parameter = null)
|
||||||
|
{
|
||||||
|
if (_subscribers.ContainsKey(message))
|
||||||
|
{
|
||||||
|
foreach (var callback in _subscribers[message])
|
||||||
|
{
|
||||||
|
callback(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
<Window
|
<Page
|
||||||
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.CableLectotypeWindow"
|
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.CableLectotypeWindow"
|
||||||
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"
|
||||||
|
@ -9,18 +9,30 @@
|
||||||
xmlns:util="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Utils"
|
xmlns:util="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Utils"
|
||||||
xmlns:viewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel"
|
xmlns:viewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel"
|
||||||
Title="CableLectotypeWindow"
|
Title="CableLectotypeWindow"
|
||||||
Width="1200"
|
Height="750"
|
||||||
Height="800"
|
|
||||||
d:DataContext="{d:DesignInstance Type=viewmodel:CableLectotypeViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewmodel:CableLectotypeViewModel}"
|
||||||
|
IsVisibleChanged="Page_IsVisibleChanged"
|
||||||
|
Loaded="Page_Loaded"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Window.Resources>
|
<Page.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<util:ConnectionTypeConverter x:Key="ConnectionTypeConverter" />
|
<util:ConnectionTypeConverter x:Key="ConnectionTypeConverter" />
|
||||||
|
<DataTemplate x:Key="LoadingMask">
|
||||||
|
<Grid Background="#ccd7d7d7">
|
||||||
|
<!--<hc:WaveProgressBar HorizontalAlignment="Center" VerticalAlignment="Center" />-->
|
||||||
|
<hc:CircleProgressBar
|
||||||
|
Width="150"
|
||||||
|
Height="150"
|
||||||
|
Margin="16,0,0,0"
|
||||||
|
IsIndeterminate="True" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Window.Resources>
|
</Page.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
@ -44,7 +56,16 @@
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Panel.ZIndex="99" />
|
Panel.ZIndex="99" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="LoadingContentMask"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.RowSpan="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Panel.ZIndex="99"
|
||||||
|
ContentTemplate="{StaticResource LoadingMask}" />
|
||||||
<hc:Card
|
<hc:Card
|
||||||
|
x:Name="InfoCard"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
|
@ -53,22 +74,28 @@
|
||||||
Margin="10"
|
Margin="10"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
<hc:SimpleStackPanel
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
DataContext="{Binding Motor}"
|
||||||
|
Orientation="Horizontal">
|
||||||
<TextBlock VerticalAlignment="Center" Text="电机ID:" />
|
<TextBlock VerticalAlignment="Center" Text="电机ID:" />
|
||||||
<hc:TextBox
|
<hc:TextBox
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Style="{StaticResource TextBoxPlusBaseStyle}"
|
Style="{StaticResource TextBoxPlusBaseStyle}"
|
||||||
Text="{Binding Motor.OccPartId}" />
|
Text="{Binding OccPartId}" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
<hc:SimpleStackPanel
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
DataContext="{Binding Motor}"
|
||||||
|
Orientation="Horizontal">
|
||||||
<TextBlock VerticalAlignment="Center" Text="电机型号:" />
|
<TextBlock VerticalAlignment="Center" Text="电机型号:" />
|
||||||
<hc:TextBox
|
<hc:TextBox
|
||||||
Width="100"
|
Width="100"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Style="{StaticResource TextBoxPlusBaseStyle}"
|
Style="{StaticResource TextBoxPlusBaseStyle}"
|
||||||
Text="{Binding Motor.MotorModelStr}" />
|
Text="{Binding MotorModelStr}" />
|
||||||
<TextBlock VerticalAlignment="Center" Text="电机功率:" />
|
<TextBlock VerticalAlignment="Center" Text="电机功率:" />
|
||||||
<hc:TextBox
|
<hc:TextBox
|
||||||
Width="118"
|
Width="118"
|
||||||
|
@ -76,7 +103,7 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Style="{StaticResource TextBoxPlusBaseStyle}"
|
Style="{StaticResource TextBoxPlusBaseStyle}"
|
||||||
Text="{Binding Motor.MotorPower}" />
|
Text="{Binding MotorPower}" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
<hc:SimpleStackPanel
|
<hc:SimpleStackPanel
|
||||||
Margin="0,10,0,0"
|
Margin="0,10,0,0"
|
||||||
|
@ -169,7 +196,7 @@
|
||||||
<Button hc:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" />
|
<Button hc:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
<hc:SimpleStackPanel>
|
<hc:SimpleStackPanel>
|
||||||
<hc:ButtonGroup>
|
<!--<hc:ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
Background="{StaticResource LightPrimaryBrush}"
|
Background="{StaticResource LightPrimaryBrush}"
|
||||||
Content="查看图纸"
|
Content="查看图纸"
|
||||||
|
@ -180,14 +207,12 @@
|
||||||
Content="查看BOM"
|
Content="查看BOM"
|
||||||
Foreground="{StaticResource PrimaryTextBrush}"
|
Foreground="{StaticResource PrimaryTextBrush}"
|
||||||
Style="{StaticResource ButtonGroupItemBaseStyle}" />
|
Style="{StaticResource ButtonGroupItemBaseStyle}" />
|
||||||
<Button
|
</hc:ButtonGroup>-->
|
||||||
x:Name="CableratorBtn"
|
<Button
|
||||||
Background="{StaticResource LightPrimaryBrush}"
|
x:Name="CableratorBtn"
|
||||||
Click="CableratorBtn_Click"
|
Click="CableratorBtn_Click"
|
||||||
Content="生成线材列表"
|
Content="生成线材推荐列表"
|
||||||
Foreground="{StaticResource PrimaryTextBrush}"
|
Style="{StaticResource ButtonPrimary}" />
|
||||||
Style="{StaticResource ButtonGroupItemBaseStyle}" />
|
|
||||||
</hc:ButtonGroup>
|
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
@ -205,8 +230,7 @@
|
||||||
ItemsSource="{Binding SelectedLines}"
|
ItemsSource="{Binding SelectedLines}"
|
||||||
RowDetailsVisibilityMode="Visible"
|
RowDetailsVisibilityMode="Visible"
|
||||||
RowHeight="NaN"
|
RowHeight="NaN"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="False">
|
||||||
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="White" />
|
||||||
|
@ -256,9 +280,8 @@
|
||||||
<DataGridTemplateColumn Width="300" Header="操作">
|
<DataGridTemplateColumn Width="300" Header="操作">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel MinWidth="300" Orientation="Horizontal">
|
<StackPanel MinWidth="90" Orientation="Horizontal">
|
||||||
<Button Content="查看图纸" />
|
<Button Content="查看图纸" />
|
||||||
<Button Margin="10,0,0,0" Content="查看BOM" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
@ -332,6 +355,7 @@
|
||||||
<Button
|
<Button
|
||||||
Margin="10,0,0,0"
|
Margin="10,0,0,0"
|
||||||
hc:IconElement.Geometry="{StaticResource SaveGeometry}"
|
hc:IconElement.Geometry="{StaticResource SaveGeometry}"
|
||||||
|
Click="SaveBtn_Click"
|
||||||
Content="保存"
|
Content="保存"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
Style="{StaticResource ButtonPrimary}" />
|
Style="{StaticResource ButtonPrimary}" />
|
||||||
|
@ -343,4 +367,4 @@
|
||||||
Style="{StaticResource ButtonDanger}" />
|
Style="{StaticResource ButtonDanger}" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Page>
|
||||||
|
|
|
@ -1,27 +1,48 @@
|
||||||
using HandyControl.Controls;
|
using EPLAN.Harness.Core.Tasks;
|
||||||
|
using HandyControl.Controls;
|
||||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||||
|
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using static Sinvo.EplanHpD.Plugin.WPFUI.Utils.LectotypeManager;
|
||||||
|
|
||||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CableLectotypeWindow.xaml 的交互逻辑
|
/// CableLectotypeWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class CableLectotypeWindow : System.Windows.Window
|
public partial class CableLectotypeWindow : Page
|
||||||
{
|
{
|
||||||
private MotorModel _motor;
|
private MotorModel _motor;
|
||||||
private CableLectotypeViewModel ViewModel;
|
private CableLectotypeViewModel ViewModel;
|
||||||
public CableLectotypeWindow(MotorModel motor)
|
public CableLectotypeWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_motor = motor;
|
|
||||||
this.DataContext = ViewModel = new CableLectotypeViewModel(motor);
|
|
||||||
Growl.Register("CableLectotypeMessage", GrowlParent);
|
Growl.Register("CableLectotypeMessage", GrowlParent);
|
||||||
|
MessageSend.Subscribe("MotorChanged", (x) => OnMotorChanged());
|
||||||
}
|
}
|
||||||
|
private void OnMotorChanged()
|
||||||
|
{
|
||||||
|
this.Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
_motor = LectotypeManager.Motor;
|
||||||
|
if (ViewModel == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.DataContext = ViewModel = LectotypeViewModelFactory.CreateOrGet(_motor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewModel.Motor = _motor;
|
||||||
|
}
|
||||||
|
Debug.WriteLine($"OnMotorChanged - ViewModel -> {ViewModel.Motor.MotorModelStr} => {ViewModel.Motor.OccPartId}");
|
||||||
|
Debug.WriteLine($"OnMotorChanged -> {LectotypeManager.Motor.MotorModelStr} => {LectotypeManager.Motor.OccPartId}");
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
private void CableratorBtn_Click(object sender, RoutedEventArgs e)
|
private void CableratorBtn_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.Cablerator();
|
ViewModel.Cablerator();
|
||||||
|
@ -29,10 +50,30 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||||
|
|
||||||
private void ListView_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
private void ListView_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
|
||||||
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
{
|
||||||
eventArg.Source = sender;
|
RoutedEvent = UIElement.MouseWheelEvent,
|
||||||
|
Source = sender
|
||||||
|
};
|
||||||
(sender as ListView).RaiseEvent(eventArg);
|
(sender as ListView).RaiseEvent(eventArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Page_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
//_motor = LectotypeManager.Motor;
|
||||||
|
//this.DataContext = ViewModel = LectotypeViewModelFactory.CreateOrGet(_motor);
|
||||||
|
Debug.WriteLine($"Page_IsVisibleChanged -> {LectotypeManager.Motor?.MotorModelStr} => {LectotypeManager.Motor?.OccPartId}");
|
||||||
|
MessageSend.Publish("MotorChanged", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
LoadingContentMask.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,82 @@
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<TabControl Grid.Row="1" FontSize="14">
|
<TabControl Grid.Row="1" FontSize="14">
|
||||||
|
<TabItem Header="电机数据">
|
||||||
|
<DataGrid
|
||||||
|
x:Name="MotorDataGrid"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ItemsSource="{Binding Motors}"
|
||||||
|
MouseDoubleClick="MotorDataGrid_MouseDoubleClick"
|
||||||
|
RowDetailsVisibilityMode="{Binding RowDetailsVisibility}"
|
||||||
|
RowHeight="NaN"
|
||||||
|
ScrollViewer.CanContentScroll="False"
|
||||||
|
SelectionChanged="MotorDataGrid_SelectionChanged">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Click="MotorDataGridToMotorSourceMenuItem_Click" Header="在3D中查看(转至电机)" />
|
||||||
|
<MenuItem Click="MotorDataGridToCableLectotype_Click" Header="根据此电机开始选择线材" />
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<Style BasedOn="{StaticResource DataGridCellStyle}" TargetType="DataGridCell">
|
||||||
|
<Setter Property="Height" Value="Auto" />
|
||||||
|
<Setter Property="MaxHeight" Value="9999" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsError}" Value="True">
|
||||||
|
<Setter Property="Background" Value="#dc4d41" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</DataTrigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="Background" Value="#326cf3" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Width="160"
|
||||||
|
Binding="{Binding MotorModelStr}"
|
||||||
|
Header="电机型号" />
|
||||||
|
<DataGridTextColumn
|
||||||
|
Width="160"
|
||||||
|
Binding="{Binding MotorPower}"
|
||||||
|
Header="电机功率" />
|
||||||
|
<DataGridTextColumn
|
||||||
|
Width="160"
|
||||||
|
Binding="{Binding AxisNo}"
|
||||||
|
Header="轴号" />
|
||||||
|
<DataGridTextColumn Binding="{Binding CheckedMsg}" Header="异常信息" />
|
||||||
|
<DataGridTemplateColumn Width="300" Header="操作">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel MinWidth="90" Orientation="Horizontal">
|
||||||
|
<Button Click="SelectedLectotype_Click" Content="展开线材选型" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
<DataGrid.RowDetailsTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<hc:TransitioningContentControl TransitionMode="Top2BottomWithFade">
|
||||||
|
<Frame SnapsToDevicePixels="True" Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/View/CableLectotypeWindow.xaml" />
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGrid.RowDetailsTemplate>
|
||||||
|
</DataGrid>
|
||||||
|
</TabItem>
|
||||||
<TabItem Header="整理后的数据">
|
<TabItem Header="整理后的数据">
|
||||||
<!--
|
<!--
|
||||||
-->
|
-->
|
||||||
|
@ -342,7 +418,7 @@
|
||||||
Checked="CheckBox_Checked"
|
Checked="CheckBox_Checked"
|
||||||
Click="CheckBox_Click"
|
Click="CheckBox_Click"
|
||||||
IsChecked="{Binding IsFlexibility, UpdateSourceTrigger=PropertyChanged}"
|
IsChecked="{Binding IsFlexibility, UpdateSourceTrigger=PropertyChanged}"
|
||||||
IsEnabled="True"
|
IsEnabled="False"
|
||||||
Unchecked="CheckBox_Unchecked" />
|
Unchecked="CheckBox_Unchecked" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
@ -406,62 +482,7 @@
|
||||||
</DataGrid.RowDetailsTemplate>
|
</DataGrid.RowDetailsTemplate>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="电机数据">
|
|
||||||
<DataGrid
|
|
||||||
x:Name="MotorDataGrid"
|
|
||||||
AutoGenerateColumns="False"
|
|
||||||
IsReadOnly="False"
|
|
||||||
ItemsSource="{Binding Motors}"
|
|
||||||
RowHeight="NaN">
|
|
||||||
<DataGrid.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Click="MotorDataGridToMotorSourceMenuItem_Click" Header="在3D中查看(转至电机)" />
|
|
||||||
<MenuItem Click="MotorDataGridToCableLectotype_Click" Header="根据此电机开始选择线材" />
|
|
||||||
</ContextMenu>
|
|
||||||
</DataGrid.ContextMenu>
|
|
||||||
<DataGrid.Resources>
|
|
||||||
<Style BasedOn="{StaticResource DataGridCellStyle}" TargetType="DataGridCell">
|
|
||||||
<Setter Property="Height" Value="Auto" />
|
|
||||||
<Setter Property="MaxHeight" Value="9999" />
|
|
||||||
<Style.Triggers>
|
|
||||||
<Trigger Property="IsSelected" Value="True">
|
|
||||||
<Setter Property="Background" Value="Transparent" />
|
|
||||||
<Setter Property="Foreground" Value="White" />
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</DataGrid.Resources>
|
|
||||||
<DataGrid.RowStyle>
|
|
||||||
<Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow">
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsError}" Value="True">
|
|
||||||
<Setter Property="Background" Value="#dc4d41" />
|
|
||||||
<Setter Property="Foreground" Value="White" />
|
|
||||||
</DataTrigger>
|
|
||||||
<Trigger Property="IsSelected" Value="True">
|
|
||||||
<Setter Property="Foreground" Value="White" />
|
|
||||||
<Setter Property="Background" Value="#326cf3" />
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</DataGrid.RowStyle>
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="160"
|
|
||||||
Binding="{Binding MotorModelStr}"
|
|
||||||
Header="电机型号" />
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="160"
|
|
||||||
Binding="{Binding MotorPower}"
|
|
||||||
Header="电机功率" />
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="160"
|
|
||||||
Binding="{Binding AxisNo}"
|
|
||||||
Header="轴号" />
|
|
||||||
<DataGridTextColumn Binding="{Binding CheckedMsg}" Header="异常信息" />
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
</TabControl>
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
|
|
|
@ -15,6 +15,7 @@ using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Forms.Integration;
|
using System.Windows.Forms.Integration;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
|
||||||
namespace Sinvo.EplanHpD.Plugin.WPFUI
|
namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
//_docId = docId;
|
//_docId = docId;
|
||||||
this.DataContext = ViewModel = new LectotypeViewModel(docId);
|
this.DataContext = ViewModel = new LectotypeViewModel(docId);
|
||||||
Application.Current.SetMainWindow(this);
|
Application.Current.SetMainWindow(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
@ -359,13 +361,13 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
|
|
||||||
private void MotorDataGridToCableLectotype_Click(object sender, RoutedEventArgs e)
|
private void MotorDataGridToCableLectotype_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (MotorDataGrid.SelectedItem != null)
|
//if (MotorDataGrid.SelectedItem != null)
|
||||||
{
|
//{
|
||||||
var window = new CableLectotypeWindow(MotorDataGrid.SelectedItem as MotorModel);
|
// var window = new CableLectotypeWindow(MotorDataGrid.SelectedItem as MotorModel);
|
||||||
ElementHost.EnableModelessKeyboardInterop(window);
|
// ElementHost.EnableModelessKeyboardInterop(window);
|
||||||
window.Show();
|
// window.Show();
|
||||||
|
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListView_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
private void ListView_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||||
|
@ -375,5 +377,46 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
eventArg.Source = sender;
|
eventArg.Source = sender;
|
||||||
(sender as ListView).RaiseEvent(eventArg);
|
(sender as ListView).RaiseEvent(eventArg);
|
||||||
}
|
}
|
||||||
|
private void MotorDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (LectotypeManager.Motor?.OccPartId != (MotorDataGrid.SelectedItem as MotorModel)?.OccPartId)
|
||||||
|
{
|
||||||
|
//ViewModel.RowDetailsVisibility = DataGridRowDetailsVisibilityMode.Collapsed;
|
||||||
|
LectotypeManager.Motor = MotorDataGrid.SelectedItem as MotorModel;
|
||||||
|
Debug.WriteLine($"{LectotypeManager.Motor.MotorModelStr} => {LectotypeManager.Motor.OccPartId}");
|
||||||
|
//ViewModel.RowDetailsVisibility = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
|
||||||
|
MessageSend.Publish("MotorChanged", null);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MotorDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private bool showRowDetails = false;
|
||||||
|
private void SelectedLectotype_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var curSelItem = MotorDataGrid.SelectedItem as MotorModel;
|
||||||
|
if (LectotypeManager.Motor == null || LectotypeManager.Motor.OccPartId == curSelItem.OccPartId)
|
||||||
|
{
|
||||||
|
if (showRowDetails)
|
||||||
|
{
|
||||||
|
ViewModel.RowDetailsVisibility = DataGridRowDetailsVisibilityMode.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewModel.RowDetailsVisibility = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
|
||||||
|
}
|
||||||
|
//LectotypeManager.Motor = new MotorModel();
|
||||||
|
showRowDetails = !showRowDetails;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LectotypeManager.Motor = curSelItem;
|
||||||
|
ViewModel.RowDetailsVisibility = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
|
||||||
|
}
|
||||||
|
MessageSend.Publish("MotorChanged", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using EPLAN.Harness.Common.Extensions;
|
using EPLAN.Harness.AppCore;
|
||||||
|
using EPLAN.Harness.Common.Extensions;
|
||||||
using EPLAN.Harness.Core.Controls;
|
using EPLAN.Harness.Core.Controls;
|
||||||
using EPLAN.Harness.Core.Utils;
|
using EPLAN.Harness.Core.Utils;
|
||||||
using EPLAN.Harness.ProjectCore;
|
using EPLAN.Harness.ProjectCore;
|
||||||
|
@ -14,12 +15,24 @@ using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||||
|
|
||||||
public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private DataGridRowDetailsVisibilityMode _rowDetailsVisibility;//= DataGridRowDetailsVisibilityMode.Visible;
|
||||||
|
public DataGridRowDetailsVisibilityMode RowDetailsVisibility
|
||||||
|
{
|
||||||
|
get => _rowDetailsVisibility;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_rowDetailsVisibility = value;
|
||||||
|
OnPropertyChanged(nameof(RowDetailsVisibility));
|
||||||
|
}
|
||||||
|
}
|
||||||
private List<LectotypeLineModel> _wires;
|
private List<LectotypeLineModel> _wires;
|
||||||
public List<LectotypeLineModel> Wires
|
public List<LectotypeLineModel> Wires
|
||||||
{
|
{
|
||||||
|
@ -408,15 +421,24 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
if (imprint != null && imprint.Contains("-"))
|
if (imprint != null && imprint.Contains("-"))
|
||||||
{
|
{
|
||||||
var vals = imprint.Split('-');
|
try
|
||||||
if (int.TryParse(vals[2], out int line))
|
|
||||||
{
|
{
|
||||||
return line;
|
var vals = imprint.Split('-');
|
||||||
|
if (int.TryParse(vals[2], out int line))
|
||||||
|
{
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine(ex.ToStringEx());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue