ManiaHome.NET Code Samples

Here are two code samples (VB and C#). These code samples should help you understand how to use ManiaHome.NET. The library currently only supports ASP.NET 4.0.

C# Example

The following example is an example of how to use ManiaHome.NET in C#
using System;
using ManiaHome;

namespace SomeApplicationName
{
    public class HelloWorld
    {
        public static void Main(params string[] args)
        {
            // <your_manialink> is your Manialink name
            // <your_api_username> is your TM developer generated username
            // <your_api_password> is your TM developer API account password
            ManiaHomeClient client = new ManiaHomeClient("<your_manialink>", "<your_api_username>", "<your_api_password>")

	    // SendNotificationFromManialink
	    client.SendNotificationFromManialink("Hello World!")

	    // SendPublicNotification
	    // <to_player> - The TM login of the player you are sending to
	    client.SendPublicNotification("<to_player>", "Hello World!")

	    // SendPrivateNotification
	    // <to_player> - The TM login of the player you are sending to
	    client.SendPrivateNotifaction("<to_player>", "Hello World!")
        }
    }
}

VB.NET Example

The following is an example of how to use ManiaHome.NET in VB.NET
Imports ManiaHome

Module Module1

	Sub Main()

		' <your_manialink> is your Manialink name
		' <your_api_username> is your TM developer generated username
		' <your_api_password> is your TM developer API account password
		Dim client As ManiaHomeClient = New ManiaHomeClient("<your_manialink>", "<your_api_username>", "<your_api_password>")

		' SendNotificationFromManialink
		client.SendNotificationFromManialink("Hello World!")

		' SendPublicNotification
		' <to_player> - The TM login of the player you are sending to
		client.SendPublicNotification("<to_player>", "Hello World!")

		' SendPrivateNotification
		' <to_player> - The TM login of the player you are sending to
		client.SendPrivateNotifaction("<to_player>", "Hello World!")

	End Sub

End Module

And that is how simple the library is! Enjoy ManiaHome.NET!

Last edited May 10, 2011 at 11:00 AM by hungman, version 7

Comments

No comments yet.