コード例 #1
0
ファイル: BaseManager.cs プロジェクト: amitaypb/Contributions
        /// <summary>
        /// Gets the System Text with the specified Label for the specified Object Name.
        /// </summary>
        /// <param name="label">Label of the System Text.</param>
        /// <param name="defaultValue">Default Value if no Text is Found.</param>
        /// <param name="objectName">Name of the object that the Text belongs to.</param>
        /// <param name="formatString">String to format the text.</param>
        /// <returns>System Text with the specified Label for the specified Object Name.</returns>
        public virtual async Task <string> GetText(string label, string defaultValue = "",
                                                   string objectName = "", object formatString = null, object formatString2 = null)
        {
            if (string.IsNullOrEmpty(objectName))
            {
                objectName = GetType().FullName;
            }

            var text = await ManagerUtil.GetText(label, defaultValue, objectName, formatString, formatString2);

            //If no Text was found for the current object, try searching the Base Object.
            if (string.IsNullOrEmpty(text))
            {
                objectName = GetType().BaseType.FullName;

                text = await ManagerUtil.GetText(label, defaultValue, objectName, formatString, formatString2);
            }

            return(text);
        }