Пример #1
0
        //----điều hướng
        static void DieuHuong(int select, ref ArrayList ArrayHH, ref ArrayList ArrayLH)
        {
            switch (select)
            {
            case 0:
                Add.ThemHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 1:
                Console.CursorVisible = false;
                Edit.SuaHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 2:
                Console.CursorVisible = false;
                Delete.XoaHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 3:
                Find.TimKiemHangHoa(ArrayHH, ArrayLH);
                return;

            case 4:
                AddLH.ThemLoaiHang(ref ArrayLH, ref ArrayHH);
                return;

            case 5:
                Console.CursorVisible = false;
                EditLH.SuaLoaiHang(ref ArrayLH, ref ArrayHH, 0);
                return;

            case 6:
                Console.CursorVisible = false;
                DeleteLH.XoaLoaiHang(ref ArrayLH, ref ArrayHH, 0);
                return;

            case 7:
                FindLH.TimKiemLoaiHang(ArrayLH, ArrayHH);
                return;

            case 8:
                Console.CursorVisible = false;
                //Caculator.PageMainCacu();
                FappyBird.FontGameFB();

                return;

            case 9:
                Console.CursorVisible = false;
                MiniGame.SelectLevelGame();
                return;

            case 10:
                Console.CursorVisible = false;
                About.Information();
                return;

            case 11:
                Console.CursorVisible = false;
                Console.Clear();
                return;
            }
        }
Пример #2
0
        //function second- hien thi item sua
        public static void SuaHH(ref ArrayList ArrayHH, ref ArrayList ArrayLH, string ChucNang, int index, int selected)
        {
            Struct.HOANGHOA item = (Struct.HOANGHOA)ArrayHH[index];
            Form.FormHangHoa("SỬA HÀNG HÓA");
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.DarkYellow;
            Console.CursorTop       = 0;
            Console.CursorLeft      = 18;
            Console.WriteLine(" Lựa chọn [UP/DOWN] ");
            Console.CursorTop  = 0;
            Console.CursorLeft = 40;
            Console.WriteLine(" Select [ENTER] ");
            Console.CursorTop  = 0;
            Console.CursorLeft = 58;
            Console.WriteLine(" Home [ESC] ");
            Console.CursorTop       = 27;
            Console.CursorLeft      = 0;
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.WriteLine(" Crt + S để lưu lại.");
            FormEditItem(selected, item);
            bool loop = true;

            while (loop)
            {
                ConsoleKeyInfo input;
                input = Console.ReadKey(true);
                if ((input.Modifiers & ConsoleModifiers.Control) != 0 && input.Key == ConsoleKey.S)
                {
                    bool flagSave;
                    flagSave = Form.FormXacNhan(10, 40, 5, 40, ChucNang);
                    if (flagSave)
                    {
                        loop = false;
                        ArrayHH.RemoveAt(index);
                        ArrayHH.Insert(index, item);
                        Console.Clear();
                        Edit.SuaHangHoa(ref ArrayHH, ref ArrayLH);
                        return;
                    }
                    else
                    {
                        loop = false;
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.BackgroundColor = ConsoleColor.Gray;
                        Console.Clear();
                        SuaHH(ref ArrayHH, ref ArrayLH, ChucNang, index, selected);
                    }
                }
                switch (input.Key)
                {
                case ConsoleKey.UpArrow:
                    if (selected == 1)
                    {
                        selected = 8;
                    }
                    else
                    {
                        selected--;
                    }
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.DownArrow:
                    if (selected == 8)
                    {
                        selected = 1;
                    }
                    else
                    {
                        selected++;
                    }
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.Enter:
                    Console.CursorVisible = true;
                    item = EditItem(selected, ref item);
                    selected++;
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.Escape:
                    loop = false;
                    Console.CursorVisible = false;
                    Tittle.TieuDe();
                    Select.LuaChonChinh(ref ArrayHH, ref ArrayLH, 0);
                    break;

                default:
                    break;
                }
            }
        }