private static void Reader_OnCardDetect(object sender, CardEventArgs e)
        {
            if (settings.isClosed == 0)
            {
                if (e.action == CardAction.Inserted)
                {
                    DebugPrint("Card ID: " + card.Id);

                    if (card.Id != String.Empty && card.Id != "NRT")
                    {
                        int[] display = PosStates(Screen.blank, false, true);
                        for (int i = 1; i <= settings.positions; i++)
                        {
                            if (display[i] == 0)
                            {
                                Buttons.Write(i, Cmd.Refresh);
                            }
                            else
                            {
                                Buttons.Write(i, Screen.blank);
                            }
                        }

                        Buttons.Write(ALL, Cmd.Print, 16, 17, 0, 1, "VERIFICATION");

                        Ethernet.Request("sn=" + settings.sn.ToString() + "&event=200&card=" + card.Id);

                        if (!CARD_OK)
                        {
                            CARD_OK = new CardList().Contains(card.Id);
                            if (CARD_OK)
                            {
                                card.Role = CardRole.OnOff;
                                card.Validity = 1;
                            }
                        }

                        if (CARD_OK && card.Validity == 1)
                        {
                            Ethernet.UniqueId();
                            ONLINE = true;

                            if (TagDetect.IsPresent())
                            {
                                switch (card.Role)
                                {
                                    case CardRole.None:
                                        break;
                                    case CardRole.Credit:
                                    case CardRole.Debet:
                                        Dispensing.Init();
                                        Buttons.Write(ALL, Screen.main);
                                        PosStates(Screen.credit);
                                        break;
                                    case CardRole.Staff:
                                    case CardRole.Master:
                                        CardList cardlist = new CardList();
                                        if (!cardlist.Contains(card.Id) && card.Validity == 1)
                                        {
                                            cardlist.Add(card.Id);
                                        }
                                        else if (card.Validity == 0)
                                        {
                                            cardlist.Remove(card.Id);
                                        }
                                        Buttons.Write(ALL, Screen.service);
                                        menu = new Menu();
                                        menu.ShowMenu();
                                        break;
                                    case CardRole.OnOff:
                                        Buttons.Write(ALL, Screen.service);
                                        break;
                                }
                            }
                        }
                        else
                        {
                            ONLINE = false;
                            display = PosStates(Screen.blank, false, true);
                            Thread.Sleep(200);
                            for (int i = 1; i <= settings.positions; i++)
                            {
                                if (display[i] == 0)
                                {
                                    Buttons.Write(i, Cmd.Refresh);
                                }
                                else
                                {
                                    Buttons.Write(i, Screen.blank);
                                }
                            }

                            if (!CARD_OK)
                            {
                                Buttons.Write(ALL, Cmd.Print, 16, 17, 0, 1, "VERIFICATION");
                                Buttons.Write(ALL, Cmd.Print, 40, 33, 0, 1, "FAILED");
                            }
                            else
                            {
                                Buttons.Write(ALL, Cmd.Print, 20, 17, 0, 1, "NOT VALID");
                                Buttons.Write(ALL, Cmd.Print, 40, 33, 0, 1, "CARD");
                            }
                        }
                    }
                    else
                    {
                        if (card.Id != String.Empty)
                        {
                            int[] display = PosStates(Screen.blank, false, true);
                            Thread.Sleep(200);
                            for (int i = 1; i <= settings.positions; i++)
                            {
                                if (display[i] == 0)
                                {
                                    Buttons.Write(i, Cmd.Refresh);
                                }
                                else
                                {
                                    Buttons.Write(i, Screen.blank);
                                }
                            }
                            Buttons.Write(settings.positions, Cmd.Print, 0, 1, 0, 1, "Not readeble type");
                            Buttons.Write(settings.positions, Cmd.Print, 0, 33, 0, 1, "remove card");
                        }
                    }
                }
                else
                {
                    ONLINE = true;
                    ONOFFMODE = 0;

                    // RESET READER AND CARD STRUCT
                    Reader.ShutDown();
                    Reader.Wake();
                    card.Clear();
                    httpData.Clear();
                    

                    //RESET MENU IF SHOWED
                    if (MENUSHOWED)
                    {
                        Buttons.VentilsOnOff(ALL, STATE.Off);
                        menu = null;
                        MENUSHOWED = false;
                    }

                    // BUTTONS HANDLE
                    int[] display = PosStates(Screen.blank, false, true);
                    for (int i = 1; i <= settings.positions; i++)
                    {
                        if (display[i] == 0)
                        {
                            Buttons.Write(i, Cmd.Refresh);
                        }
                    }
                    common.PosStates(Screen.prices);
                }
            }
        }
        private static void Reader_OnCardDetect(object sender, CardEventArgs e)
        {
            if (settings.isClosed == 0)
            {
                if (e.action == CardAction.Inserted)
                {
                    DebugPrint("Card ID: " + card.Id);

                    if (card.Id != String.Empty && card.Id != "NRT")
                    {
                        Buttons.Write(ALL, Screen.main);
                        Buttons.Write(ALL, Screen.blank);
                        Buttons.Write(ALL, Cmd.Print, 16, 17, 0, 1, "VERIFICATION");

                        Reader.ReadCardValue();

                        if (card.Company == settings.company)
                        {
                            if (TagDetect.IsPresent())
                            {
                                switch (card.Role)
                                {
                                    case CardRole.None:
                                        break;
                                    case CardRole.Credit:
                                    case CardRole.Debet:
                                        Dispensing.Init();
                                        Buttons.Write(ALL, Screen.main);
                                        PosStates(Screen.credit);
                                        break;
                                    case CardRole.Staff:
                                    case CardRole.Master:
                                        Buttons.Write(ALL, Screen.service);
                                        menu = new Menu();
                                        menu.ShowMenu();
                                        break;
                                }
                            }
                        }
                        else
                        {
                            Buttons.Write(ALL, Screen.main);
                            int[] display = PosStates(Screen.blank);
                            for (int i = 1; i <= settings.positions; i++)
                            {
                                if (display[i] == 0)
                                {
                                    Buttons.Write(i, Cmd.Refresh);
                                }
                            }
                            Buttons.Write(ALL, Cmd.Print, 20, 17, 0, 1, "NOT VALID");
                            Buttons.Write(ALL, Cmd.Print, 40, 33, 0, 1, "CARD");
                        }
                    }
                    else
                    {
                        if (card.Id != String.Empty)
                        {
                            Buttons.Write(settings.positions, Screen.main);
                            Buttons.Write(settings.positions, Screen.blank);
                            Buttons.Write(settings.positions, Cmd.Print, 0, 1, 0, 1, "Not readeble type");
                            Buttons.Write(settings.positions, Cmd.Print, 0, 33, 0, 1, "remove card");
                        }
                    }
                }
                else
                {
                    // RESET READER AND CARD STRUCT
                    Reader.ShutDown();
                    Reader.Wake();
                    card.Clear();

                    //RESET MENU IF SHOWED
                    if (MENUSHOWED)
                    {
                        menu = null;
                        MENUSHOWED = false;
                    }

                    // HERE NEED HANDLE WHAT SHOW ON SCREEN (EMPTY BOTTLE OR PRICES)                    
                    PosStates(Screen.prices, true);
                }
            }
        }