using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace HouseHeatingTerminal
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        
        
        public static T GetWindow<T>() where T : Form
        {
            var name = typeof(T).Name;
            return System.Windows.Forms.Application.OpenForms[name] as T;
        }

        public static void ControlInvoke(Control control, Action methodeName)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action(methodeName));
                return;
            }
        }
        public static void FormInvoke(Form form, Action methodeName)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new Action(methodeName));
                return;
            }
        }
        public static void ControlInvoke<T>(Control control, Action<T> methodeName, T data)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action<T>(methodeName), data);
                return;
            }
        }
        public static void FormInvoke<T>(Form form, Action<T> methodeName, T data)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new Action<T>(methodeName), data);
                return;
            }
        }
        public static void ControlInvoke<T1, T2>(Control control, Action<T1, T2> methodeName, T1 data1, T2 data2)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action<T1, T2>(methodeName), data1, data2);
                return;
            }
        }
        public static void FormInvoke<T1, T2>(Form form, Action<T1, T2> methodeName, T1 data1, T2 data2)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new Action<T1, T2>(methodeName), data1, data2);
                return;
            }
        }
        public static void ControlInvoke<T1, T2, T3>(Control control, Action<T1, T2, T3> methodeName, T1 data1, T2 data2, T3 data3)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action<T1, T2, T3>(methodeName), data1, data2, data3);
                return;
            }
        }
        public static void FormInvoke<T1, T2, T3>(Form form, Action<T1, T2, T3> methodeName, T1 data1, T2 data2, T3 data3)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new Action<T1, T2, T3>(methodeName), data1, data2, data3);
                return;
            }
        }
        public static void ControlInvoke<T1, T2, T3, T4>(Control control, Action<T1, T2, T3, T4> methodeName, T1 data1, T2 data2, T3 data3, T4 data4)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action<T1, T2, T3, T4>(methodeName), data1, data2, data3, data4);
                return;
            }
        }
        public static void FormInvoke<T1, T2, T3, T4>(Form form, Action<T1, T2, T3, T4> methodeName, T1 data1, T2 data2, T3 data3, T4 data4)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new Action<T1, T2, T3, T4>(methodeName), data1, data2, data3, data4);
                return;
            }
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}
