public string GetString (string msgid) { return localizer.GetString (msgid); }
private void BuildDialog(IAddinLocalizer localizer) { var members = EffectData.GetType().GetMembers(); foreach (var mi in members) { Type mType = GetTypeForMember(mi); if (mType == null) { continue; } string caption = null; string hint = null; bool skip = false; bool combo = false; object[] attrs = mi.GetCustomAttributes(false); foreach (var attr in attrs) { if (attr is SkipAttribute) { skip = true; } else if (attr is CaptionAttribute) { caption = ((CaptionAttribute)attr).Caption; } else if (attr is HintAttribute) { hint = ((HintAttribute)attr).Hint; } else if (attr is StaticListAttribute) { combo = true; } } if (skip || string.Compare(mi.Name, "IsDefault", true) == 0) { continue; } if (caption == null) { caption = MakeCaption(mi.Name); } if (mType == typeof(int) && (caption == "Seed")) { AddWidget(CreateSeed(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(int)) { AddWidget(CreateSlider(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(double) && (caption == "Angle" || caption == "Rotation")) { AddWidget(CreateAnglePicker(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(double)) { AddWidget(CreateDoubleSlider(localizer.GetString(caption), EffectData, mi, attrs)); } else if (combo && mType == typeof(string)) { AddWidget(CreateComboBox(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(bool)) { AddWidget(CreateCheckBox(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(Gdk.Point)) { AddWidget(CreatePointPicker(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType == typeof(Cairo.PointD)) { AddWidget(CreateOffsetPicker(localizer.GetString(caption), EffectData, mi, attrs)); } else if (mType.IsEnum) { AddWidget(CreateEnumComboBox(localizer.GetString(caption), EffectData, mi, attrs)); } if (hint != null) { AddWidget(CreateHintLabel(localizer.GetString(hint))); } } }
private void BuildDialog (IAddinLocalizer localizer) { var members = EffectData.GetType ().GetMembers (); foreach (var mi in members) { Type mType = GetTypeForMember (mi); if (mType == null) continue; string caption = null; string hint = null; bool skip = false; bool combo = false; object[] attrs = mi.GetCustomAttributes (false); foreach (var attr in attrs) { if (attr is SkipAttribute) skip = true; else if (attr is CaptionAttribute) caption = ((CaptionAttribute)attr).Caption; else if (attr is HintAttribute) hint = ((HintAttribute)attr).Hint; else if (attr is StaticListAttribute) combo = true; } if (skip || string.Compare (mi.Name, "IsDefault", true) == 0) continue; if (caption == null) caption = MakeCaption (mi.Name); if (mType == typeof (int) && (caption == "Seed")) AddWidget (CreateSeed (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (int)) AddWidget (CreateSlider (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (double) && (caption == "Angle" || caption == "Rotation")) AddWidget (CreateAnglePicker (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (double)) AddWidget (CreateDoubleSlider (localizer.GetString (caption), EffectData, mi, attrs)); else if (combo && mType == typeof (string)) AddWidget (CreateComboBox (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (bool)) AddWidget (CreateCheckBox (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (Gdk.Point)) AddWidget (CreatePointPicker (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType == typeof (Cairo.PointD)) AddWidget (CreateOffsetPicker (localizer.GetString (caption), EffectData, mi, attrs)); else if (mType.IsEnum) AddWidget (CreateEnumComboBox (localizer.GetString (caption), EffectData, mi, attrs)); if (hint != null) AddWidget (CreateHintLabel (localizer.GetString (hint))); } }