static Dictionary <IntPtr, ScanButton> scanButtonList; // keeps track of all attached ScanButtons

        /// <summary>
        /// Initialize all of the above components
        /// </summary>
        public SessionHandler()
        {
            launchOCREngine();
            emuHandler   = new EmulatorHandler(GlobalSettings.General.EmulatorRegex); // Only retrieve pointers from windows which match regular expression
            emulatorList = emuHandler.getEmulatorList();
            tableHandler = new TableHandler(engine);
            NoteHandler.refreshNotesFromFile(); // Load Notes from JSON-Notefile
            alerterWorker  = new AlertWorker();
            scanButtonList = new Dictionary <IntPtr, ScanButton>();
        }
        /// <summary>
        /// Check for action buttons on the table with the help of preset Color in hardcoded place
        /// </summary>
        private void playerHasOptions()
        {
            // Get open tables
            emu = new EmulatorHandler(GlobalSettings.General.EmulatorRegex);
            List <IntPtr> openTables = emu.getEmulatorList();
            Color         options    = GlobalSettings.General.AlerterButtonColor;

            // Check for each open table...
            foreach (IntPtr pointer in openTables)
            {
                if (TableHandler.alerter.ContainsKey(pointer))
                {
                    // ...if CheckBox on top was ticked
                    bool tick = TableHandler.alerter[pointer];
                    if (!tick)
                    {
                        continue;
                    }

                    // Get Area of the table with buttons
                    WinAPI.RECT r = new WinAPI.RECT();
                    r.Width  = 848;
                    r.Height = 1318;

                    // Get table screenshot and crop image roughly to the area where buttons will appear
                    Bitmap bmp  = Screenshot.CaptureApplication(pointer);
                    Bitmap crop = Screenshot.CropImage(bmp, 0, Math.Abs((bmp.Height / 100) * 85), bmp.Width, 30);

                    // Check if actions are available
                    bool itsonme = checkColor(crop, options);
                    if (itsonme) // Play sound on available options
                    {
                        simpleSound.Play();
                        System.Threading.Thread.Sleep(1500);
                    }
                }
            }
        }
        /// <summary>
        /// Only one notewindow per player should be opened, set to foreground if double open
        /// !!! Bug: Seems like western nicknames work fine but chinese dont !!!+
        ///
        /// Will get called from PlayerButton.Click
        ///
        /// </summary>
        /// <param name="playername"></param>
        /// <param name="tablename"></param>
        public FormNoteWindow(string playername, string tablename)
        {
            // Retrieve List of instances with the regex set to the playername
            EmulatorHandler doubleCheck = new EmulatorHandler(playername);
            List <IntPtr>   doubleList  = doubleCheck.getEmulatorList();

            if (doubleList.Count == 0) // No window for the same player found
            {
                // Create new NoteWindow
                initComponents();
                //Console.WriteLine("FormNoteWindow from PlayerButton.Click");  // Debug

                // Set Note from Loaded Notes
                this.note = NoteHandler.getNote(playername);

                table = tablename;

                // Check if note exists, if not: construct new from tabledata
                if (note.Name == null)
                {
                    constructNewNote(playername, tablename);
                }
                else
                {
                    loadValuesFromNote();
                }

                // Set Location of the Form within table boundaries and not somewhere else on the screen
                setAppearanceLocation(tablename);
                this.Show();
            }
            else   // Already one open => Set to foreground!
            {
                WinAPI.SetForegroundWindow(doubleList[0]);
            }
        }
 /// <summary>
 /// Check for new Emulator instances
 /// </summary>
 public void updateSession()
 {
     emulatorList = emuHandler.getEmulatorList();
 }