Ejemplo n.º 1
0
        /// <summary>
        /// 产生对应游戏的所有交易信息
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="index"></param>
        /// <param name="gameid"></param>
        /// <param name="userid"></param>
        public static void CreateStorageInfo(Grid grid, int index, string gameid)
        {
            Canvas canvas = new Canvas();

            Canvas.SetTop(canvas, index * 50);

            Label info = new Label();

            Canvas.SetTop(info, index * 50);
            //Canvas.SetLeft(info, 2+64);
            info.Width    = 350;
            info.Height   = 50;
            info.FontSize = 16;
            string userid = AccessHelper.GetGameStorageUserID(gameid, index);

            if (AccessHelper.GetGameStorageType(gameid, index) == "交换")
            {
                info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要用此游戏交换《" + AccessHelper.GetGameStorageChangeGame(gameid, index) + "》";
            }
            else if (AccessHelper.GetGameStorageType(gameid, index) == "出售")
            {
                info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(gameid, index) + "元 出售此游戏";
            }
            else if (AccessHelper.GetGameStorageType(gameid, index) == "出租")
            {
                info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(gameid, index) + "元/日 出租此游戏";
            }

            canvas.Children.Add(info);

            Button detail = new Button();

            Canvas.SetTop(detail, index * 50 + 5);
            Canvas.SetLeft(detail, 350);
            detail.Width      = 100;
            detail.Height     = 30;
            detail.FontSize   = 16;
            detail.Content    = "查看详情";
            detail.Background = Brushes.White;
            detail.Click     += MessageDetail_Click;
            string storageid = AccessHelper.GetGameStorageID(gameid, index);

            detail.Name = "detail" + storageid;
            canvas.Children.Add(detail);



            grid.Children.Add(canvas);
            grid.Height += 50;
        }