|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Activities; |
| 6 | +using System.ComponentModel; |
| 7 | +using System.Threading; |
| 8 | +using Utils.Properties; |
| 9 | +using Utils.Common; |
| 10 | +using System.Activities.Presentation.Metadata; |
| 11 | +using Utils.PathUtils; |
| 12 | +using Utils.StringUtils; |
| 13 | + |
| 14 | +namespace Utils |
| 15 | +{ |
| 16 | + public class DesignerMetadata : IRegisterMetadata |
| 17 | + { |
| 18 | + public void Register() |
| 19 | + { |
| 20 | + AttributeTableBuilder builder = new AttributeTableBuilder(); |
| 21 | + |
| 22 | + addCustomAttributes_PathUtils_categories(builder); |
| 23 | + addCustomAttributes_StringUtils_categoriess(builder); |
| 24 | + |
| 25 | + MetadataStore.AddAttributeTable(builder.CreateTable()); |
| 26 | + |
| 27 | + //ShowPropertyInOutlineViewAttribute hideFromOutlineAttribute = new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false, DuplicatedChildNodesVisible = false }; |
| 28 | + //builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Body), hideFromOutlineAttribute); |
| 29 | + |
| 30 | + } |
| 31 | + |
| 32 | + private void addCustomAttributes_PathUtils_categories(AttributeTableBuilder builder) |
| 33 | + { |
| 34 | + // 1.Activitiesペイン上のツリー構造を構築する。 |
| 35 | + // ドットで階層を表現する |
| 36 | + { |
| 37 | + string PathUtils_categories = "Utils.Path Utilities"; |
| 38 | + builder.AddCustomAttributes(typeof(Combine), new CategoryAttribute(PathUtils_categories)); |
| 39 | + builder.AddCustomAttributes(typeof(CurrentDir), new CategoryAttribute(PathUtils_categories)); |
| 40 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), new CategoryAttribute(PathUtils_categories)); |
| 41 | + } |
| 42 | + |
| 43 | + // 2.Activitiesペイン上のアクティビティ名 |
| 44 | + { |
| 45 | + builder.AddCustomAttributes(typeof(Combine), new DisplayNameAttribute(Resources.DisplayName2_Combine)); |
| 46 | + builder.AddCustomAttributes(typeof(CurrentDir), new DisplayNameAttribute(Resources.DisplayName2_CurrentDir)); |
| 47 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), new DisplayNameAttribute(Resources.DisplayName2_PathUtils)); |
| 48 | + } |
| 49 | + |
| 50 | + // 3.Activitiesペイン上のアクティビティをポイントしたときに表示されるツールチップ文言 |
| 51 | + { |
| 52 | + builder.AddCustomAttributes(typeof(Combine), new DescriptionAttribute(Resources.Description3_Combine)); |
| 53 | + builder.AddCustomAttributes(typeof(CurrentDir), new DescriptionAttribute(Resources.Description3_CurrentDir)); |
| 54 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), new DescriptionAttribute(Resources.Description3_PathUtils)); |
| 55 | + } |
| 56 | + |
| 57 | + // 4.プロパティペイン内のプロパティの説明文言 |
| 58 | + { |
| 59 | + builder.AddCustomAttributes(typeof(Combine), nameof(Combine.PathArray), new DescriptionAttribute(Resources.Description4_Combine_PathArray)); |
| 60 | + builder.AddCustomAttributes(typeof(CurrentDir), nameof(CurrentDir.FullPath), new DescriptionAttribute(Resources.Description4_CurrentDir_FullPath)); |
| 61 | + { |
| 62 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), nameof(Utils.PathUtils.PathUtils.Path), new DescriptionAttribute(Resources.Description4_PathUtils_Path)); |
| 63 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), nameof(Utils.PathUtils.PathUtils.FullPath), new DescriptionAttribute(Resources.Description4_PathUtils_FullPath)); |
| 64 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), nameof(Utils.PathUtils.PathUtils.DirectoryName), new DescriptionAttribute(Resources.Description4_PathUtils_DirectoryName)); |
| 65 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), nameof(Utils.PathUtils.PathUtils.DirExists), new DescriptionAttribute(Resources.Description4_PathUtils_DirExists)); |
| 66 | + builder.AddCustomAttributes(typeof(Utils.PathUtils.PathUtils), nameof(Utils.PathUtils.PathUtils.FileExists), new DescriptionAttribute(Resources.Description4_PathUtils_FileExists)); |
| 67 | + } |
| 68 | + |
| 69 | + } |
| 70 | + |
| 71 | + // 5.プロパティペインの、カテゴリ名 |
| 72 | + //{ |
| 73 | + //builder.AddCustomAttributes(typeof(ConvertCRLF), nameof(ConvertCRLF.CR), new CategoryAttribute(nameof(Resources.ConvertCRLF_Category))); |
| 74 | + //builder.AddCustomAttributes(typeof(ConvertCRLF), nameof(ConvertCRLF.LF), new CategoryAttribute(nameof(Resources.ConvertCRLF_Category))); |
| 75 | + //} |
| 76 | + |
| 77 | + // 6.プロパティペイン内のプロパティの変数名 |
| 78 | + //builder.AddCustomAttributes(typeof(Combine), nameof(Combine.PathArray), new DisplayNameAttribute("test display1")); //クラスのプロパティに直接 DisplayNameを書いたのと意味おなじ。 |
| 79 | + } |
| 80 | + |
| 81 | + private void addCustomAttributes_StringUtils_categoriess(AttributeTableBuilder builder) |
| 82 | + { |
| 83 | + |
| 84 | + // 1.Activitiesペイン上のツリー構造を構築する。 |
| 85 | + // ドットで階層を表現する |
| 86 | + { |
| 87 | + string StringUtils_categories = "Utils.String Utilities"; |
| 88 | + builder.AddCustomAttributes(typeof(Base64Encode), new CategoryAttribute(StringUtils_categories)); |
| 89 | + builder.AddCustomAttributes(typeof(Base64Decode), new CategoryAttribute(StringUtils_categories)); |
| 90 | + builder.AddCustomAttributes(typeof(Base64EncodeFromFile), new CategoryAttribute(StringUtils_categories)); |
| 91 | + builder.AddCustomAttributes(typeof(ConvertCRLF), new CategoryAttribute(StringUtils_categories)); |
| 92 | + builder.AddCustomAttributes(typeof(ToJSONString), new CategoryAttribute(StringUtils_categories)); |
| 93 | + } |
| 94 | + |
| 95 | + // 2.Activitiesペイン上のアクティビティ名 |
| 96 | + { |
| 97 | + builder.AddCustomAttributes(typeof(Base64Encode), new DisplayNameAttribute(Resources.DisplayName2_Base64Encode)); |
| 98 | + builder.AddCustomAttributes(typeof(Base64Decode), new DisplayNameAttribute(Resources.DisplayName2_Base64Decode)); |
| 99 | + builder.AddCustomAttributes(typeof(Base64EncodeFromFile), new DisplayNameAttribute(Resources.DisplayName2_Base64EncodeFromFile)); |
| 100 | + builder.AddCustomAttributes(typeof(ConvertCRLF), new DisplayNameAttribute(Resources.DisplayName2_ConvertCRLF)); |
| 101 | + builder.AddCustomAttributes(typeof(ToJSONString), new DisplayNameAttribute(Resources.DisplayName2_ToJSONString)); |
| 102 | + } |
| 103 | + |
| 104 | + // 3.Activitiesペイン上のアクティビティをポイントしたときに表示されるツールチップ文言 |
| 105 | + { |
| 106 | + builder.AddCustomAttributes(typeof(Base64Encode), new DescriptionAttribute(Resources.Description3_Base64Encode)); |
| 107 | + builder.AddCustomAttributes(typeof(Base64Decode), new DescriptionAttribute(Resources.Description3_Base64Decode)); |
| 108 | + builder.AddCustomAttributes(typeof(Base64EncodeFromFile), new DescriptionAttribute(Resources.Description3_Base64EncodeFromFile)); |
| 109 | + builder.AddCustomAttributes(typeof(ConvertCRLF), new DescriptionAttribute(Resources.Description3_ConvertCRLF)); |
| 110 | + builder.AddCustomAttributes(typeof(ToJSONString), new DescriptionAttribute(Resources.Description3_ToJSONString)); |
| 111 | + |
| 112 | + } |
| 113 | + |
| 114 | + // 4.プロパティペイン内のプロパティの説明文言 |
| 115 | + { |
| 116 | + builder.AddCustomAttributes(typeof(Base64Encode), nameof(Base64Encode.Target), new DescriptionAttribute(Resources.Description4_Base64Encode_Target)); |
| 117 | + builder.AddCustomAttributes(typeof(Base64Decode), nameof(Base64Decode.Target), new DescriptionAttribute(Resources.Description4_Base64Decode_Target)); |
| 118 | + builder.AddCustomAttributes(typeof(Base64EncodeFromFile), nameof(Base64EncodeFromFile.Path), new DescriptionAttribute(Resources.Description4_Base64EncodeFromFile_Path)); |
| 119 | + builder.AddCustomAttributes(typeof(ConvertCRLF), nameof(ConvertCRLF.Target), new DescriptionAttribute(Resources.Description4_ConvertCRLF_Target)); |
| 120 | + } |
| 121 | + |
| 122 | + // 5.プロパティペインの、カテゴリ名 |
| 123 | + { |
| 124 | + builder.AddCustomAttributes(typeof(ConvertCRLF), nameof(ConvertCRLF.CR), new CategoryAttribute(Resources.Category5_ConvertCRLF_CRLF)); |
| 125 | + builder.AddCustomAttributes(typeof(ConvertCRLF), nameof(ConvertCRLF.LF), new CategoryAttribute(Resources.Category5_ConvertCRLF_CRLF)); |
| 126 | + } |
| 127 | + |
| 128 | + // 6.プロパティペイン内のプロパティの変数名 |
| 129 | + { } |
| 130 | + |
| 131 | + |
| 132 | + } |
| 133 | + } |
| 134 | +} |
0 commit comments