private void AddMacro_Click(object sender, EventArgs e)
        {
            MacroConfiguration macro = new MacroConfiguration(this);

            panel_macro.Controls.Add(macro);
            macro.BringToFront();
            macro.Dock = DockStyle.Top;
            macroConfigurations.Add(macro);
        }
        public Configurations()
        {
            macros = new List <Macro>();
            macroConfigurations = new List <MacroConfiguration>();
            //Configuration of the server

            //ip = Dns.GetHostEntry(serverIP).AddressList[0];
            //server = new TcpListener(ip, port);
            //client = default(TcpClient);

            //try
            //{
            //    server.Start();
            //    Debug.WriteLine("Server started...");
            //}
            //catch (Exception e)
            //{
            //    Debug.WriteLine(e.ToString());
            //}

            //backgroundWorker1.RunWorkerAsync();

            if (File.Exists(savePath))
            {
                macro_json = File.ReadAllText(savePath);
                macros     = JsonConvert.DeserializeObject <List <Macro> >(macro_json);
            }

            InitializeComponent();

            if (macros != null)
            {
                foreach (Macro macro in macros)
                {
                    MacroConfiguration macroconfig = new MacroConfiguration(this);
                    macroconfig.MacroName.Text            = macro.Name;
                    macroconfig.MacroExecutable.Text      = macro.Excecutable;
                    macroconfig.MacroTrigger.SelectedItem = macro.Trigger;
                    macroConfigurations.Add(macroconfig);
                    panel_macro.Controls.Add(macroconfig);
                    macroconfig.BringToFront();
                    macroconfig.Dock = DockStyle.Top;
                }
            }
        }