Ease of Integration

The code was designed to be simple and easy to integrate. While developing Line of Business applications, the internal workings of a message box should be the last concern for the developer. For input and confirmation message boxes, the user should attach a handler to the CustomMessage objects. But otherwise, for simple messages such as Info and Error, the user can use the methods in the Message class.

Example Code:

See below examples code for using the provided messages. Please don't forget to put a using SilverlightMessageBoxLibrary;  statement, if you have followed the instructions on how to install the .DLL file

 

Info Message

//Info Message.
Message.InfoMessage("Hello! I am here to help you!");

 

Error Message

//Error Message.
Message.ErrorMessage("Darn! Something went wrong.");

 

Confirmation

//Confirmation with handlers.
CustomMessage confirmMessage = new CustomMessage("Do you like me?", CustomMessage.MessageType.Confirm);

confirmMessage.OKButton.Click += (obj, args) =>
{
    Message.InfoMessage("Thanks. You make me blush.");
};

confirmMessage.Show();

 

Text Input

//Text input message with handler.
CustomMessage inputMessage = new CustomMessage("Please enter the name of your favorite singer?", CustomMessage.MessageType.TextInput);

inputMessage.OKButton.Click += (obj, args) =>
{
    Message.InfoMessage("Thanks for your input: " + inputMessage.Input);
};

inputMessage.Show();

 

Combo Input

 

String[] comboOptions = new String[] {"Boston Celtics", "L.A. Lakers", "Chicago Bulls", "Philadelphia 76ers"};

CustomMessage customMessage 
    = new CustomMessage("Please choose your favorite basketball team.", 
                                                             CustomMessage.MessageType.ComboInput, 
                                                             comboOptions);
customMessage.OKButton.Click += (obj, args) =>
{
     //Check to see that an option was selected.
     if(customMessage.Input  != null)
        
        //Display the selected message.
        Message.InfoMessage("Go " + customMessage.Input + "!");

     else
         Message.InfoMessage("No input was received.");
};


customMessage.Show();

 


Last edited Jan 27, 2011 at 3:20 PM by zkhalapyan, version 14

Comments

bizzel74 Jan 15, 2014 at 8:36 AM 
When hitting the Message code I get the problem: ...
Could not load file or assembly 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

khashimoto Aug 2, 2013 at 8:17 AM 
Thanks!
I had a good experience.

sozturk88 Jan 2, 2013 at 10:11 AM 
thank you
it is cool :)

klken Mar 30, 2012 at 5:22 AM 
For VB:

Dim inputMessage As New SilverlightMessageBoxLibrary.CustomMessage("Please reconfirm your password.", SilverlightMessageBoxLibrary.CustomMessage.MessageType.TextInput)

Private Sub cmdUpdatePassword_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
AddHandler inputMessage.OKButton.Click, AddressOf SilverlightMessageBoxLibrary_OKClick
inputMessage.Show()

End Sub

Private Sub SilverlightMessageBoxLibrary_OKClick(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show(inputMessage.Input)
End Sub

sathishsingam Aug 23, 2011 at 6:11 AM 
Can you give an example of text input using vb? I'm having trouble with the event handler. Please help me

humbird May 14, 2011 at 7:56 PM 
Can you give an example of text input using vb? I'm having trouble with the event handler.