Ejemplo n.º 1
0
    /// <summary>
    /// This method can be used to elegently display a message in the UI to the user,
    /// for example a exception or success message.
    /// </summary>
    /// <param name="message">The message.</param>
    /// <param name="type">The type.</param>
    public static void DisplayMessage(string message, DiscoveryMessageType type, Control container)
    {
        // Find the message popup control
        IDiscoveryMessage messagePopup = container.FindControl("MessagePopup") as IDiscoveryMessage;

        // Make sure we have the message interface
        Debug.Assert(null != messagePopup);
        // Display the message
        messagePopup.DisplayMessage(message, type);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// This method can be used to elegently display a message in the UI to the user,
 /// for example a exception or success message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="type">The type.</param>
 public void DisplayMessage(string message, DiscoveryMessageType type)
 {
     // See if we have a master page
     if (null == Page.Master)
     {
         // Display the message using the "message control" from this page
         DisplayMessage(message, type, Page);
     }
     else
     {
         // Display the message using the "message control" from the master page
         DisplayMessage(message, type, Page.Master);
     }
 }
        public void DisplayMessage(string message, DiscoveryMessageType type)
        {
            // Generate the table and cells for the message
            HtmlTableRow  messageRow  = new HtmlTableRow();
            HtmlTableCell iconCell    = new HtmlTableCell();
            HtmlTableCell messageCell = new HtmlTableCell();

            // Display properties
            iconCell.VAlign    = "middle";
            messageCell.VAlign = "middle";
            messageCell.Width  = "100%";

            // Generate the icon
            Image imageIcon = new Image();

            imageIcon.SkinID = string.Concat("Message", type.ToString());

            // Generate the message
            Label labelMessage = new Label();

            labelMessage.SkinID = "MessageLabel";
            labelMessage.Text   = message;

            // Add the icon to the cell
            iconCell.Controls.Add(imageIcon);

            // Add the message to the cell
            messageCell.Controls.Add(labelMessage);

            // Add the cells to the row
            messageRow.Cells.Add(iconCell);
            messageRow.Cells.Add(messageCell);

            // Add the row to the table
            tableMessages.Rows.Add(messageRow);

            // Make sure that the message is visible
            DisplayPopup(true);
        }