From c257842321d76292d4079b0220feee6450d3c1b0 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 23 Dec 2024 11:57:20 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Fix=20=E4=BF=AE=E5=A4=8DEnum.IsDefined?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E5=88=A4=E6=96=AD=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Converter/ConnectionTypeConverter.cs | 12 +++++++----- .../Converter/FlagEnumConverter.cs | 8 ++++---- .../Converter/NameTypeConverter.cs | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/ConnectionTypeConverter.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/ConnectionTypeConverter.cs index 33a209e..f99244a 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/ConnectionTypeConverter.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/ConnectionTypeConverter.cs @@ -1,4 +1,5 @@ -using EPLAN.Harness.Core.Platform; + +using Sinvo.EplanHpD.Plugin.WPFUI.Enum; using Sinvo.EplanHpD.Plugin.WPFUI.Utils; using System; using System.Collections.Generic; @@ -14,11 +15,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Converter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + //if (!System.Enum.IsDefined(typeof(ConnectionType), (ConnectionType)value)) + //{ + // return false; + //} var flag = (ConnectionType)value; - if (!System.Enum.IsDefined(typeof(ConnectionType), flag)) - { - return false; - } + return flag == (ConnectionType)parameter; } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/FlagEnumConverter.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/FlagEnumConverter.cs index bca7cb7..ca465c4 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/FlagEnumConverter.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/FlagEnumConverter.cs @@ -11,10 +11,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Converter public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var flag = (WireFlagType)value; - if (!System.Enum.IsDefined(typeof(WireFlagType), flag)) - { - return false; - } + //if (!System.Enum.IsDefined(typeof(WireFlagType), flag)) + //{ + // return false; + //} return flag == (WireFlagType)parameter; } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/NameTypeConverter.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/NameTypeConverter.cs index d02a94f..e0329dd 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Converter/NameTypeConverter.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Converter/NameTypeConverter.cs @@ -11,10 +11,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Converter public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var flag = (ExportFileNameType)value; - if (!System.Enum.IsDefined(typeof(ExportFileNameType), flag)) - { - return false; - } + //if (!System.Enum.IsDefined(typeof(ExportFileNameType), flag)) + //{ + // return false; + //} return flag == (ExportFileNameType)parameter; }