105040 Fix 修复Enum.IsDefined无法正确判断的问题

This commit is contained in:
lihanbo 2024-12-23 11:57:20 +08:00
parent adfc11b82d
commit c257842321
3 changed files with 15 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}