﻿using System;
using Noesis;
using UnityEngine.Networking;

namespace Assets.BAndCCore.Extensions
{
	public static class EventExtensions
	{
		public static void Raise(this ButtonBase.ClickHandler @this, object sender, Noesis.RoutedEventArgs args)
		{
			if (@this != null)
			{
				@this(sender, args);
			}
		}

		public static void Raise(this TextBoxBase.TextChangedHandler @this, object sender, Noesis.RoutedEventArgs args)
		{
			if (@this != null)
			{
				@this(sender, args);
			}
		}

		public static void Raise(this PasswordBox.PasswordChangedHandler @this, object sender, Noesis.RoutedEventArgs args)
		{
			if (@this != null)
			{
				@this(sender, args);
			}
		}

		public static void Raise(this ToggleButton.CheckedHandler @this, object sender, Noesis.RoutedEventArgs args)
		{
			if (@this != null)
			{
				@this(sender, args);
			}
		}

		public static void Raise(this NetworkMessageDelegate @this, NetworkMessage netMessage)
		{
			if (@this != null)
			{
				@this(netMessage);
			}
		}

		public static void Raise(this EventHandler @this, object sender, System.EventArgs args)
		{
			if (@this != null)
			{
				@this(sender, args);
			}
		}
	}
}