本文整理汇总了C#中Core.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Core.GetType方法的具体用法?C# Core.GetType怎么用?C# Core.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveNotificationParameters
public NotificationParameter[] ResolveNotificationParameters(Core.Notifications.Notification notification)
{
var retVal = new List<NotificationParameter>();
List<PropertyInfo> properties = notification.GetType().GetProperties().Where(p => p.GetCustomAttributes(typeof(NotificationParameterAttribute), true).Any()).ToList();
if (properties.Count > 0)
{
foreach (var property in properties)
{
var attributes = property.GetCustomAttributes(typeof(NotificationParameterAttribute), true);
retVal.Add(new NotificationParameter
{
ParameterName = property.Name,
ParameterDescription = attributes.Length > 0 ? ((NotificationParameterAttribute)(attributes[0])).Description : string.Empty,
ParameterCodeInView = GetLiquidCodeOfParameter(property.Name),
IsDictionary = property.PropertyType.IsAssignableFrom(typeof(IDictionary)),
IsArray = property.PropertyType.IsArray,
Type = GetParameterType(property.PropertyType.Name)
});
}
}
return retVal.ToArray();
}
示例2: ResolveNotificationParameters
public NotificationParameter[] ResolveNotificationParameters(Core.Notification.Notification notification)
{
var retVal = new List<NotificationParameter>();
var attributeCollection = TypeDescriptor.GetAttributes(notification.GetType());
var attribute = (LiquidTypeAttribute)attributeCollection[typeof(LiquidTypeAttribute)];
if (attribute != null)
{
foreach (var property in attribute.AllowedMembers)
{
var attributes = notification.GetType().GetProperty(property).GetCustomAttributes(typeof(DescriptionAttribute), true);
retVal.Add(new NotificationParameter
{
ParameterName = property,
ParameterDescription = attributes.Length > 0 ? ((DescriptionAttribute)(attributes[0])).Description : string.Empty,
ParameterCodeInView = GetLiquidCodeOfParameter(property)
});
}
}
return retVal.ToArray();
}
示例3: ResolveTemplate
public void ResolveTemplate(Core.Notifications.Notification notification)
{
var parameters = ResolveNotificationParameters(notification);
Dictionary<string, object> myDict = new Dictionary<string, object>();
foreach(var parameter in parameters)
{
myDict.Add(parameter.ParameterName, notification.GetType().GetProperty(parameter.ParameterName).GetValue(notification));
}
Template templateSubject = Template.Parse(notification.NotificationTemplate.Subject);
notification.Subject = templateSubject.Render(Hash.FromDictionary(myDict));
Template templateBody = Template.Parse(notification.NotificationTemplate.Body);
notification.Body = templateBody.Render(Hash.FromDictionary(myDict));
}
示例4: ShouldExecute
public override bool ShouldExecute(Core.Item item, Core.Enums.ItemEvent itemEvent)
{
var type = item.GetType();
if (type == typeof(ContentPropertyData))
{
var propertyData = (ContentPropertyData)item;
var rightEvent = (itemEvent == ItemEvent.Extracting || itemEvent == ItemEvent.Packaging);
if(!rightEvent)
return false;
var hasType = propertyData.Data.Any(x => x.Value != null && DataTypeIds.Contains(x.DataTypeEditor));
return hasType;
}
else
{
var dataType = (DataType)item;
return ( DataTypeIds.Contains(dataType.DataEditorId));
}
}
示例5: HandleMessage
public override void HandleMessage(Core.Messages.AMessage message, VSPCContext context)
{
if (message is UserClickedLoginMessage)
InitSimConnect(context);
else if (message is UserClickedLogoffMessage)
CloseConnection();
else if (message is TrafficPositionReportMessage)
HandleTrafficPositionReport((TrafficPositionReportMessage)message);
else
Logger.Error("Unexpected message type received in SimConnectInterface: " + message.GetType().Name);
}
示例6: SearchFilterByIdentifyObject
public SearchFilterByIdentifyObject(Core.IdentifiableObject obj)
: this(obj, obj.GetType().Name)
{
}
示例7: HandleAlertCallback
private static void HandleAlertCallback(Core.Alert a)
{
using (a)
{
Action<object> run;
if (Alert2Func.TryGetValue(a.GetType(), out run))
{
run(a);
}
}
}