Beispiel #1
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Application.Current.MainWindow.Width  = SystemParameters.MaximizedPrimaryScreenWidth;
            Application.Current.MainWindow.Height = SystemParameters.MaximizedPrimaryScreenHeight;

            // 영상 출력 이미지의 넓이, 높이 지정
            Image1.Width  = this.Width;
            Image1.Height = this.Height;

            // 브랜드 마크 이미지의 넓이 지정
            Image2.Width = this.Width;

            // 구매 버튼 위치 지정
            Thickness margin = Buy.Margin;

            margin.Left = 1100;
            Buy.Margin  = margin;

            // 카메라 버튼 위치 지정
            margin         = Capture.Margin;
            margin.Left    = 1200;
            Capture.Margin = margin;

            // 카테고리 선택 버튼들 초기화
            Category_Change();
            Clothes_Change();

            // 각 버튼들의 x,y좌표 값을 얻어온다. 반드시 마지막에 실행되야 한다.
            GeneralTransform generalTransform = Buy.TransformToAncestor(this);

            btnBuy           = generalTransform.Transform(new System.Windows.Point(0, 0)); // 구매 버튼 x,y 좌표 얻기
            generalTransform = Capture.TransformToAncestor(this);
            btnCapture       = generalTransform.Transform(new System.Windows.Point(0, 0)); // 캡처 버튼 x,y 좌표 얻기
            generalTransform = Category_down.TransformToAncestor(this);
            btnCategoryDown  = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리 다운 버튼 x,y 좌표 얻기
            generalTransform = Category_up.TransformToAncestor(this);
            btnCategoryUp    = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리 업 버튼 x,y 좌표 얻기
            generalTransform = Category1.TransformToAncestor(this);
            btnCategory1     = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리1 버튼 x,y 좌표 얻기
            generalTransform = Category2.TransformToAncestor(this);
            btnCategory2     = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리2 버튼 x,y 좌표 얻기
            generalTransform = Category3.TransformToAncestor(this);
            btnCategory3     = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리3 버튼 x,y 좌표 얻기
            generalTransform = Clothes_down.TransformToAncestor(this);
            btnClothesDown   = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes 다운 x,y 좌표 얻기
            generalTransform = Clothes_up.TransformToAncestor(this);
            btnClothesUp     = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes 업 x,y 좌표 얻기
            generalTransform = Clothes1.TransformToAncestor(this);
            btnClothes1      = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes1 버튼 x,y 좌표 얻기
            generalTransform = Clothes2.TransformToAncestor(this);
            btnClothes2      = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes2 버튼 x,y 좌표 얻기
            generalTransform = Clothes3.TransformToAncestor(this);
            btnClothes3      = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes3 버튼 x,y 좌표 얻기
            generalTransform = Clothes4.TransformToAncestor(this);
            btnClothes4      = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes4 버튼 x,y 좌표 얻기
        }
Beispiel #2
0
        public static void Buy()
        {
            int num = 0;
            int i   = 3;

            while (true)
            {
                Console.WriteLine("请输入用户名");
                string a = Console.ReadLine();
                Console.WriteLine("请输入密码");
                string b = Console.ReadLine();
                if (num < 2)
                {
                    if (a == "pzw" && b == "1234")
                    {
zhuyao:
                        Console.WriteLine("输入正确");
                        Console.Clear();
                        Console.WriteLine("                     -----------------请选择------------------");

                        Console.WriteLine("                                1:浏览商品        ");
                        Console.WriteLine("                                2:查找商品并加入购物车        ");
                        Console.WriteLine("                     -----------------------------------------");
                        int no;
                        no = Convert.ToInt16(Console.ReadLine());
                        if (no == 1)
                        {
                            Console.Clear();
                            xiaozu.男装();
                            xiaozu.女装();
                            xiaozu.童装();
                            Console.WriteLine("                     ----------------温馨提示------------------");
                            Console.WriteLine("                                  1.返回主页面                          ");

                            Console.WriteLine("                                   2.退出程序                       ");
                            Console.WriteLine("                     -----------------------------------------");

                            int n1;
                            n1 = Convert.ToInt16(Console.ReadLine());
                            if (n1 == 1)
                            {
                                Console.Clear();
                                goto zhuyao;
                            }
                            else if (n1 == 2)
                            {
                                break;
                            }
                        }
                        else if (no == 2)
                        {
                            Console.Clear();
                            List <Program> jiesuan = new List <Program>();
                            Clothes1       c1      = new Clothes1();
                            c1.buyclothes1();
                            Clothes2 c2 = new Clothes2();
                            c2.buyclothes2();
                            Clothes3 c3 = new Clothes3();
                            c3.buyclothes3();
                            Clothes4 c4 = new Clothes4();
                            c4.buyclothes4();
                            Clothes5 c5 = new Clothes5();
                            c5.buyclothes5();
                            Clothes6 c6 = new Clothes6();
                            c6.buyclothes6();
                            Clothes7 c7 = new Clothes7();
                            c7.buyclothes7();
                            Clothes8 c8 = new Clothes8();
                            c8.buyclothes8();
                            Clothes9 c9 = new Clothes9();
                            c9.buyclothes9();
                            Clothes10 c10 = new Clothes10();
                            c10.buyclothes10();
                            Clothes11 c11 = new Clothes11();
                            c11.buyclothes11();
                            Clothes12 c12 = new Clothes12();
                            c12.buyclothes12();
                            Clothes13 c13 = new Clothes13();
                            c13.buyclothes13();
                            Console.Clear();

                            xiaozu.男装();
                            xiaozu.女装();
                            xiaozu.童装();

                            Console.WriteLine("              -----------------请选择------------------");

                            Console.WriteLine("                         选择你所找到喜欢的商品       ");
                            Console.WriteLine("                         填写时要写商品前的编号       ");
                            Console.WriteLine("                         输入   0    结束购买       ");
                            Console.WriteLine("                         输入   14    进行结算       ");
                            Console.WriteLine("              -----------------------------------------");
                            while (true)//while循环
                            {
                                int jg = int.Parse(Console.ReadLine());
                                if (jg == 0)
                                {
                                    Console.WriteLine("按任意键退出!!!");
                                    Console.ReadKey();
                                    Environment.Exit(0);
                                }
                                else if (jg == 1)
                                {
                                    jiesuan.Add(c1);
                                }
                                else if (jg == 2)
                                {
                                    jiesuan.Add(c2);
                                }
                                else if (jg == 3)
                                {
                                    jiesuan.Add(c3);
                                }
                                else if (jg == 4)
                                {
                                    jiesuan.Add(c4);
                                }
                                else if (jg == 5)
                                {
                                    jiesuan.Add(c5);
                                }
                                else if (jg == 6)
                                {
                                    jiesuan.Add(c6);
                                }
                                else if (jg == 7)
                                {
                                    jiesuan.Add(c7);
                                }
                                else if (jg == 8)
                                {
                                    jiesuan.Add(c8);
                                }
                                else if (jg == 9)
                                {
                                    jiesuan.Add(c9);
                                }

                                else if (jg == 10)
                                {
                                    jiesuan.Add(c10);
                                }

                                else if (jg == 11)
                                {
                                    jiesuan.Add(c11);
                                }

                                else if (jg == 12)
                                {
                                    jiesuan.Add(c12);
                                }

                                else if (jg == 13)
                                {
                                    jiesuan.Add(c13);
                                }

                                else if (jg == 14)
                                {
                                    Console.Clear();
                                    Console.WriteLine("您购买的清单如下:");
                                    foreach (Program item in jiesuan)
                                    {
                                        item.speak();
                                    }
                                    double sumMoney = 0;
                                    for (int s = 0; s < jiesuan.Count; s++)
                                    {
                                        sumMoney += jiesuan[s].jiage;
                                    }



                                    Console.WriteLine("您总共需支付RMB:¥{0}", sumMoney);
                                    Console.WriteLine("                     ----------------温馨提示------------------");
                                    Console.WriteLine("                                  1.返回主页面                          ");

                                    Console.WriteLine("                                   2.退出程序                       ");
                                    Console.WriteLine("                     -----------------------------------------");
                                    int n2;
                                    n2 = Convert.ToInt16(Console.ReadLine());
                                    if (n2 == 1)
                                    {
                                        Console.Clear();
                                        goto zhuyao;
                                    }
                                    else if (n2 == 2)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("输入错误,请重新输入");
                        num = num + 1;
                        i   = i - 1;
                    }
                }
                else
                {
                    Console.Write("您已经尝试三次登录,验证失败,系统将关闭");
                    break;
                }
            }
        }