public void CleanUp()
        {
            currentApp = null;

            //Clear the screen
            PixelColor[,] clear = PixelColor
                                  .GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.BLACK);
            Program.tableRenderer.Render(clear);
        }
        public void LaunchApp(TableApp app)
        {
            if (app != null)
            {
                Program.Log(TAG, "Starting app: " + app.GetName());
            }

            currentApp = app;

            appThread = new Thread(delegate()
            {
                TableApp a = app;
                a.Init();

                if (a.userInterface == TableApp.ClientUserInterface.Custom)
                {
                    CustomInterface customInterface = a.GetCustomInterface();
                    string itemString = string.Empty;
                    for (int i = 0; i < customInterface.items.Count; i++)
                    {
                        itemString += customInterface.items[i];
                        if (i != customInterface.items.Count - 1)
                        {
                            itemString += ",";
                        }
                    }

                    ///Program.communicationServer.Send("create_custom_interface " + itemString);
                }

                int customSpeed = Program.GetParameterInt("appspeed", -1);
                while (a == currentApp)
                {
                    a.Draw();
                    a.RenderToTable();

                    Thread.Sleep(customSpeed >= 0 ? customSpeed : a.updateSpeed);
                }
            });
            if (currentApp != null)
            {
                appThread.Start();
            }
        }