Represents a single message that a controller is sending to the view.
Inheritance: IXmlConvertible
コード例 #1
0
ファイル: SageController.cs プロジェクト: igorfrance/sage
        /// <summary>
        /// Adds a message to this controller's message collection, using the specified <paramref name="phraseId"/> to get the message
        /// text.
        /// </summary>
        /// <param name="type">The type of the message to add.</param>
        /// <param name="phraseId">The id of the phrase that contains the text associated with this message.</param>
        /// <param name="formatValues">Optional format values to use for formatting the phrase text.</param>
        protected void AddMessagePhrase(MessageType type, string phraseId, params string[] formatValues)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(phraseId));

            var phrase = this.Context.Resources.GetPhrase(phraseId);
            var text = string.Format(phrase, formatValues);
            var message = new ControllerMessage { Type = type, Text = text };
            messages.Add(message);
        }
コード例 #2
0
ファイル: SageController.cs プロジェクト: igorfrance/sage
        /// <summary>
        /// Adds a message to this controller's message collection
        /// </summary>
        /// <param name="type">The type of the message to add.</param>
        /// <param name="messageText">The message to display.</param>
        /// <param name="formatValues">Optional format values to use for formatting the message text.</param>
        protected void AddMessage(MessageType type, string messageText, params string[] formatValues)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(messageText));

            var text = string.Format(messageText, formatValues);
            var message = new ControllerMessage { Type = type, Text = text };
            messages.Add(message);
        }