本文整理汇总了C#中ObjectClass.GetDescribedInterfaceType方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectClass.GetDescribedInterfaceType方法的具体用法?C# ObjectClass.GetDescribedInterfaceType怎么用?C# ObjectClass.GetDescribedInterfaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectClass
的用法示例。
在下文中一共展示了ObjectClass.GetDescribedInterfaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowCreatePropertyDialog
private static Property ShowCreatePropertyDialog(IZetboxContext ctx, ObjectClass propCls, Module targetModule, out bool show)
{
var ifType = propCls.GetDescribedInterfaceType();
var dlg = _vmf.CreateDialog(ctx, string.Format(Zetbox.App.Projekte.Client.ZetboxBase.Strings.CreatePropertyDlg_Title, ifType.Type.Name))
.AddString("name", NamedObjects.Base.Classes.Zetbox.App.Base.Property_Properties.Name.Find(_frozenCtx).GetLabel())
.AddString("label", NamedObjects.Base.Classes.Zetbox.App.Base.Property_Properties.Label.Find(_frozenCtx).GetLabel(), allowNullInput: true)
.AddString("description", NamedObjects.Base.Classes.Zetbox.App.Base.Property_Properties.Description.Find(_frozenCtx).GetLabel(), allowNullInput: true)
.AddString("categorytags", NamedObjects.Base.Classes.Zetbox.App.Base.Property_Properties.CategoryTags.Find(_frozenCtx).GetLabel(), allowNullInput: true, vmdesc: NamedObjects.Gui.ViewModelDescriptors.Zetbox_Client_Presentables_ZetboxBase_TagPropertyEditorViewModel.Find(_frozenCtx))
.AddObjectReference("module", NamedObjects.Base.Classes.Zetbox.App.Base.Property_Properties.Module.Find(_frozenCtx).GetLabel(), typeof(Module).GetObjectClass(_frozenCtx), value: targetModule)
.AddBool("isNullable", Zetbox.App.Projekte.Client.ZetboxBase.Strings.IsNullable, value: true);
if (typeof(StringProperty).IsAssignableFrom(ifType.Type))
{
var p = NamedObjects.Base.Classes.Zetbox.App.Base.StringRangeConstraint_Properties.MaxLength.Find(_frozenCtx);
dlg.AddInt("str_maxlengt", p.GetLabel(), allowNullInput: true, description: p.GetDescription());
}
if (typeof(DateTimeProperty).IsAssignableFrom(ifType.Type))
{
var p = NamedObjects.Base.Classes.Zetbox.App.Base.DateTimeProperty_Properties.DateTimeStyle.Find(_frozenCtx);
dlg.AddEnumeration("dt_style", p.GetLabel(), _frozenCtx.FindPersistenceObject<Enumeration>(new Guid("1385e46d-3e5b-4d91-bf9a-94a740f08ba1")), description: p.GetDescription(), value: (int)DateTimeStyles.Date);
}
if (typeof(DecimalProperty).IsAssignableFrom(ifType.Type))
{
var p = NamedObjects.Base.Classes.Zetbox.App.Base.DecimalProperty_Properties.Precision.Find(_frozenCtx);
var s = NamedObjects.Base.Classes.Zetbox.App.Base.DecimalProperty_Properties.Scale.Find(_frozenCtx);
dlg.AddInt("decimal_precision", p.GetLabel(), description: p.GetDescription(), value: 10);
dlg.AddInt("decimal_scale", s.GetLabel(), description: s.GetDescription(), value: 2);
}
if (typeof(EnumerationProperty).IsAssignableFrom(ifType.Type))
{
var p = NamedObjects.Base.Classes.Zetbox.App.Base.EnumerationProperty_Properties.Enumeration.Find(_frozenCtx);
dlg.AddObjectReference("enum", p.GetLabel(), typeof(Enumeration).GetObjectClass(_frozenCtx), description: p.GetDescription());
}
if (typeof(CompoundObjectProperty).IsAssignableFrom(ifType.Type))
{
var p = NamedObjects.Base.Classes.Zetbox.App.Base.CompoundObjectProperty_Properties.CompoundObjectDefinition.Find(_frozenCtx);
dlg.AddObjectReference("cp_def", p.GetLabel(), typeof(CompoundObject).GetObjectClass(_frozenCtx), description: p.GetDescription());
}
if (typeof(IntProperty).IsAssignableFrom(ifType.Type))
{
var min = NamedObjects.Base.Classes.Zetbox.App.Base.IntegerRangeConstraint_Properties.Min.Find(_frozenCtx);
var max = NamedObjects.Base.Classes.Zetbox.App.Base.IntegerRangeConstraint_Properties.Max.Find(_frozenCtx);
dlg.AddInt("int_min", min.GetLabel(), description: min.GetDescription(), allowNullInput: true);
dlg.AddInt("int_max", max.GetLabel(), description: max.GetDescription(), allowNullInput: true);
}
dlg.AddBool("show", Zetbox.App.Projekte.Client.ZetboxBase.Strings.ShowPropertyWhenFinished, value: false, description: Zetbox.App.Projekte.Client.ZetboxBase.Strings.ShowPropertyWhenFinishedDescription);
Property newProp = null;
bool localShow = false;
dlg.Show(((values) =>
{
newProp = (Property)ctx.Create(ifType);
newProp.Name = (string)values["name"];
newProp.Label = (string)values["label"];
newProp.Description = (string)values["description"];
newProp.CategoryTags = (string)values["categorytags"];
newProp.Module = (Module)values["module"];
if (!(bool)values["isNullable"])
{
newProp.Constraints.Add(ctx.Create<NotNullableConstraint>());
}
if (values.ContainsKey("str_maxlengt"))
{
var c = ctx.Create<StringRangeConstraint>();
c.MinLength = 0;
c.MaxLength = (int?)values["str_maxlengt"];
newProp.Constraints.Add(c);
}
if (values.ContainsKey("int_min") && values.ContainsKey("int_max") && values["int_min"] != null && values["int_max"] != null)
{
var c = ctx.Create<IntegerRangeConstraint>();
c.Min = (int)values["int_min"];
c.Max = (int)values["int_max"];
newProp.Constraints.Add(c);
}
if (values.ContainsKey("dt_style"))
{
((DateTimeProperty)newProp).DateTimeStyle = (DateTimeStyles)values["dt_style"];
}
if (values.ContainsKey("decimal_precision"))
{
((DecimalProperty)newProp).Precision = (int)values["decimal_precision"];
}
if (values.ContainsKey("decimal_scale"))
{
((DecimalProperty)newProp).Scale = (int)values["decimal_scale"];
}
if (values.ContainsKey("enum"))
{
((EnumerationProperty)newProp).Enumeration = (Enumeration)values["enum"];
}
if (values.ContainsKey("cp_def"))
{
((CompoundObjectProperty)newProp).CompoundObjectDefinition = (CompoundObject)values["cp_def"];
}
if (newProp is CompoundObjectProperty)
//.........这里部分代码省略.........