本文整理汇总了C#中MethodReturnEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# MethodReturnEventArgs类的具体用法?C# MethodReturnEventArgs怎么用?C# MethodReturnEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodReturnEventArgs类属于命名空间,在下文中一共展示了MethodReturnEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
public static void ToString(ViewModelDescriptor obj, MethodReturnEventArgs<string> e)
{
e.Result = string.Format("{0} (default: {1}) [{2}]",
obj.Description,
obj.DefaultEditorKind,
string.IsNullOrWhiteSpace(obj.ViewModelTypeRef) ? "(no type)" : obj.ViewModelTypeRef);
}
示例2: MakeStaticFile
public static void MakeStaticFile(ImportedFile obj, MethodReturnEventArgs<StaticFile> e)
{
var ctx = obj.Context;
var doc = ctx.Create<StaticFile>();
MakeInternal(ctx, obj, doc);
e.Result = doc;
}
示例3: ToString
public static void ToString(ViewModelDescriptor obj, MethodReturnEventArgs<string> e)
{
e.Result = string.Format("{0} (default: {1}) [{2}]",
obj.Description,
obj.DefaultEditorKind,
obj.ViewModelRef == null ? "(no type)" : obj.ViewModelRef.ToString());
}
示例4: AppliesTo
public static void AppliesTo(FixedYearlyCalendarRule obj, MethodReturnEventArgs<System.Boolean> e, System.DateTime date)
{
if (obj.CheckValidDate(date))
{
e.Result = date.Day == obj.Day && date.Month == obj.Month;
}
}
示例5: CreateNavigator
public static void CreateNavigator(RelationEnd obj, MethodReturnEventArgs<ObjectReferenceProperty> e)
{
Relation rel = obj.AParent ?? obj.BParent;
RelationEnd other = rel != null ? rel.GetOtherEnd(obj) : null;
var nav = obj.Context.Create<ObjectReferenceProperty>();
nav.CategoryTags = String.Empty;
nav.ObjectClass = obj.Type;
nav.RelationEnd = obj;
nav.Module = rel != null ? rel.Module : null;
if (other != null)
{
if (nav.GetIsList())
{
if (nav.RelationEnd.Parent.GetOtherEnd(nav.RelationEnd).HasPersistentOrder)
{
nav.ValueModelDescriptor = obj.Context.FindPersistenceObject<ViewModelDescriptor>(ViewModelDescriptor_ObjectListModel);
}
else
{
nav.ValueModelDescriptor = obj.Context.FindPersistenceObject<ViewModelDescriptor>(ViewModelDescriptor_ObjectCollectionModel);
}
}
else
{
nav.ValueModelDescriptor = obj.Context.FindPersistenceObject<ViewModelDescriptor>(ViewModelDescriptor_ObjectReferenceModel);
}
nav.Name = other.RoleName;
}
e.Result = nav;
}
示例6: GetRelationType
public static void GetRelationType(Relation rel, MethodReturnEventArgs<RelationType> e)
{
if (rel == null)
{
throw new ArgumentNullException("rel");
}
if (rel.A == null)
{
throw new ArgumentNullException("rel", "rel.A is null");
}
if (rel.B == null)
{
throw new ArgumentNullException("rel", "rel.B is null");
}
if ((rel.A.Multiplicity.UpperBound() == 1 && rel.B.Multiplicity.UpperBound() > 1)
|| (rel.A.Multiplicity.UpperBound() > 1 && rel.B.Multiplicity.UpperBound() == 1))
{
e.Result = RelationType.one_n;
}
else if (rel.A.Multiplicity.UpperBound() > 1 && rel.B.Multiplicity.UpperBound() > 1)
{
e.Result = RelationType.n_m;
}
else if (rel.A.Multiplicity.UpperBound() == 1 && rel.B.Multiplicity.UpperBound() == 1)
{
e.Result = RelationType.one_one;
}
else
{
throw new InvalidOperationException(String.Format("Unable to find out RelationType: {0}:{1}", rel.A.Multiplicity, rel.B.Multiplicity));
}
}
示例7: GetErrorText
public static void GetErrorText(
IntegerRangeConstraint obj,
MethodReturnEventArgs<string> e,
object constrainedObjectParam,
object constrainedValueParam)
{
if (constrainedValueParam == null)
{
e.Result = null;
return;
}
int v = (int)constrainedValueParam;
if (obj.IsValid(constrainedObjectParam, constrainedValueParam))
{
e.Result = null;
}
else
{
StringBuilder result = new StringBuilder();
if (v < obj.Min)
result.AppendFormat("{0} should be equal or greater than {1}", obj.ConstrainedProperty.Name, obj.Min);
if (v > obj.Max)
result.AppendFormat("{0} should be equal or less than {1}", obj.ConstrainedProperty.Name, obj.Max);
if (!String.IsNullOrEmpty(obj.Reason))
{
result.Append(": ");
result.Append(obj.Reason);
}
e.Result = result.ToString();
}
}
示例8: ToString
public static void ToString(ObjectReferenceProperty obj, MethodReturnEventArgs<string> e)
{
e.Result = "-> " + e.Result;
// already handled by base OnToString_Property()
// ToStringHelper.FixupFloatingObjects(obj, e);
}
示例9: GetErrorText
public static void GetErrorText(
StringRangeConstraint obj,
MethodReturnEventArgs<string> e,
object constrainedObjectParam,
object constrainedValueParam)
{
if (obj.IsValid(constrainedObjectParam, constrainedValueParam))
{
e.Result = null;
}
else
{
constrainedValueParam = (constrainedValueParam ?? String.Empty);
int length = constrainedValueParam.ToString().Length;
StringBuilder result = new StringBuilder();
if (length < obj.MinLength)
result.AppendFormat("{0} should be at least {1} characters long", obj.ConstrainedProperty.Name, obj.MinLength);
if (obj.MaxLength != null && length > obj.MaxLength)
result.AppendFormat("{0} should be at most {1} characters long", obj.ConstrainedProperty.Name, obj.MaxLength);
if (!String.IsNullOrEmpty(obj.Reason))
{
result.Append(": ");
result.Append(obj.Reason);
}
e.Result = result.ToString();
}
}
示例10: GetName
public static void GetName(ViewModelDescriptor obj, MethodReturnEventArgs<string> e)
{
if (obj.ViewModelRef != null)
{
e.Result = string.Format("Gui.ViewModelDescriptors.{0}", Regex.Replace(obj.ViewModelRef.ToTypeName(), @"\W", "_"));
}
}
示例11: CreateFilterModel
public static void CreateFilterModel(Zetbox.App.GUI.SinglePropertyFilterConfiguration obj, MethodReturnEventArgs<IFilterModel> e)
{
var mdl = new SingleValueFilterModel();
mdl.Label = obj.GetLabel();
mdl.Required = obj.Required;
mdl.ValueSource = FilterValueSource.FromProperty(obj.Property);
mdl.ViewModelType = obj.ViewModelDescriptor;
mdl.RequestedKind = obj.RequestedKind;
mdl.FilterArguments.Add(new FilterArgumentConfig(obj.Property.GetDetachedValueModel(true), /*cfg.ArgumentViewModel ?? */ obj.Property.ValueModelDescriptor));
if (obj.Property is StringProperty)
{
mdl.Operator = FilterOperators.Contains;
}
else if (obj.Property is EnumerationProperty)
{
mdl.RefreshOnFilterChanged = true;
}
else if (obj.Property is ObjectReferenceProperty)
{
mdl.RefreshOnFilterChanged = true;
}
e.Result = mdl;
}
示例12: AppliesTo
public static void AppliesTo(DayOfWeekWorkScheduleRule obj, MethodReturnEventArgs<System.Boolean> e, System.DateTime date)
{
if (obj.CheckValidDate(date))
{
e.Result = (int)date.DayOfWeek == (int)obj.DayOfWeek;
}
}
示例13: GetName
public static void GetName(Sequence obj, MethodReturnEventArgs<string> e)
{
if (!string.IsNullOrEmpty(obj.Name) && obj.Module != null && !string.IsNullOrEmpty(obj.Module.Name))
{
e.Result = "Base.Sequences." + obj.Module.Name + "." + Regex.Replace(obj.Name, "\\W", "_");
}
}
示例14: CreateFilterModel
public static void CreateFilterModel(Zetbox.App.GUI.MonthFilterConfiguration obj, MethodReturnEventArgs<IFilterModel> e, Zetbox.API.IZetboxContext ctx)
{
var mdl = MonthValueFilterModel.Create(FrozenContext, obj.GetLabel(), FilterValueSource.FromProperty(obj.Property), obj.IsCurrentMonthDefault ?? false);
mdl.Required = obj.Required;
mdl.RefreshOnFilterChanged = obj.RefreshOnFilterChanged;
e.Result = mdl;
}
示例15: ToString
public static void ToString(Event obj, MethodReturnEventArgs<System.String> e)
{
e.Result = string.Format("{0} - {1}: {2} ({3})",
obj.IsAllDay ? obj.StartDate.ToShortDateString() : obj.StartDate.ToShortDateString() + " " + obj.StartDate.ToShortTimeString(),
obj.IsAllDay ? obj.EndDate.ToShortDateString() : obj.EndDate.ToShortDateString() + " " + obj.EndDate.ToShortTimeString(),
obj.Summary,
obj.Location);
}