private void cancelBtn_Click(object sender, RoutedEventArgs e) { type.IsEnabled = false; changeGame.IsEnabled = false; message.IsEnabled = false; price.IsEnabled = false; editBtn.IsEnabled = true; confirmBtn.IsEnabled = false; cancelBtn.IsEnabled = false; string storageType = AccessHelper.GetGameStorageType(storageID); if (storageType == "出售") { type.SelectedIndex = 0; } else if (storageType == "出租") { type.SelectedIndex = 1; } else if (storageType == "交换") { type.SelectedIndex = 2; } price.Text = AccessHelper.GetGameStoragePrice(storageID); changeGame.SelectedItem = AccessHelper.GetGameStorageChangeGame(storageID); message.Text = AccessHelper.GetGameStorageMessage(storageID); }
private void ViewStorageMessage(string storageID) { MessageWindow messageWindow = new MessageWindow(); messageWindow.Show(); string gameid = AccessHelper.GetGameStorageGameID(storageID); string userid = AccessHelper.GetGameStorageUserID(storageID); messageWindow.nickname.Content = AccessHelper.GetUserNickName(userid); messageWindow.phone.Content = AccessHelper.GetUserPhone(userid); messageWindow.qq.Content = AccessHelper.GetUserQQ(userid); messageWindow.email.Content = AccessHelper.GetUserEmail(userid); messageWindow.address.Text = AccessHelper.GetUserAddress(userid); if (AccessHelper.GetGameStorageType(storageID) == "交换") { messageWindow.storageInfo.Text = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要用《" + AccessHelper.GetGameZhName(gameid) + "》交换《" + AccessHelper.GetGameStorageChangeGame(storageID) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出售") { messageWindow.storageInfo.Text = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元 出售《" + AccessHelper.GetGameZhName(gameid) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出租") { messageWindow.storageInfo.Text = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元/日 出租《" + AccessHelper.GetGameZhName(gameid) + "》"; } messageWindow.Pic.Source = AccessHelper.GetGameImage(gameid); messageWindow.message.Text = AccessHelper.GetGameStorageMessage(storageID); }
private void EditUserRelease(string storageid) { ReleaseEditWindow releaseEditWindow = new ReleaseEditWindow(); releaseEditWindow.Show(); releaseEditWindow.userID = userID; releaseEditWindow.storageID = storageid; string gameid = AccessHelper.GetGameStorageGameID(storageid); releaseEditWindow.gameID = gameid; releaseEditWindow.Pic.Source = AccessHelper.GetGameImage(gameid); releaseEditWindow.ZhName.Content = AccessHelper.GetGameZhName(gameid); releaseEditWindow.EnName.Content = AccessHelper.GetGameEnName(gameid); string storageType = AccessHelper.GetGameStorageType(storageid); if (storageType == "出售") { releaseEditWindow.type.SelectedIndex = 0; releaseEditWindow.changeGame.Visibility = Visibility.Hidden; releaseEditWindow.price.Visibility = Visibility.Visible; releaseEditWindow.unit.Visibility = Visibility.Visible; releaseEditWindow.price.Text = AccessHelper.GetGameStoragePrice(storageid); releaseEditWindow.unit.Content = "元"; } else if (storageType == "出租") { releaseEditWindow.type.SelectedIndex = 1; releaseEditWindow.changeGame.Visibility = Visibility.Hidden; releaseEditWindow.price.Visibility = Visibility.Visible; releaseEditWindow.unit.Visibility = Visibility.Visible; releaseEditWindow.price.Text = AccessHelper.GetGameStoragePrice(storageid); releaseEditWindow.unit.Content = "元/日"; } else if (storageType == "交换") { releaseEditWindow.type.SelectedIndex = 2; releaseEditWindow.changeGame.Visibility = Visibility.Visible; releaseEditWindow.price.Visibility = Visibility.Hidden; releaseEditWindow.unit.Visibility = Visibility.Hidden; releaseEditWindow.changeGame.SelectedItem = AccessHelper.GetGameStorageChangeGame(storageid); } releaseEditWindow.message.Text = AccessHelper.GetGameStorageMessage(storageid); }
/// <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; }
private void UpdateReleaseList(string storageID) { //Console.WriteLine(list.Children.Count); //Canvas canvas = UIFindHelper.GetChildObject<Canvas>(list, "canvas" + storageID); Label info = UIFindHelper.GetChildObject <Label>(list, "info" + storageID); //label.Content = AccessHelper.GetGameStorage(gameid) + "条交易信息"; string userid = AccessHelper.GetGameStorageUserID(storageID); string gameid = AccessHelper.GetGameStorageGameID(storageID); if (AccessHelper.GetGameStorageType(storageID) == "交换") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要用《" + AccessHelper.GetGameZhName(gameid) + "》交换《" + AccessHelper.GetGameStorageChangeGame(storageID) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出售") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元 出售《" + AccessHelper.GetGameZhName(gameid) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出租") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元/日 出租《" + AccessHelper.GetGameZhName(gameid) + "》"; } }
/// <summary> /// 创建“已发布”下对应用户交易信息 /// </summary> /// <param name="grid"></param> /// <param name="index"></param> /// <param name="userid"></param> public static void CreateUserReleaseInfo(Grid grid, int index, string userid) { 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 = 500; info.Height = 50; info.FontSize = 16; string storageID = AccessHelper.GetGameStorageIDFromUserID(userid, index); string gameid = AccessHelper.GetGameStorageGameIDFromUserID(userid, index); info.Name = "info" + storageID; if (AccessHelper.GetGameStorageType(storageID) == "交换") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要用《" + AccessHelper.GetGameZhName(gameid) + "》交换《" + AccessHelper.GetGameStorageChangeGame(storageID) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出售") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元 出售《" + AccessHelper.GetGameZhName(gameid) + "》"; } else if (AccessHelper.GetGameStorageType(storageID) == "出租") { info.Content = "用户 " + AccessHelper.GetUserNickName(userid) + " 想要以" + AccessHelper.GetGameStoragePrice(storageID) + "元/日 出租《" + AccessHelper.GetGameZhName(gameid) + "》"; } canvas.Children.Add(info); Button edit = new Button(); Canvas.SetTop(edit, index * 50 + 5); Canvas.SetLeft(edit, 500); edit.Width = 100; edit.Height = 30; edit.FontSize = 16; edit.Content = "修改信息"; edit.Background = Brushes.White; edit.Click += EditRelease_Click; edit.Name = "edit" + storageID; canvas.Children.Add(edit); Button delete = new Button(); Canvas.SetTop(delete, index * 50 + 5); Canvas.SetLeft(delete, 600 + 5); delete.Width = 100; delete.Height = 30; delete.FontSize = 16; delete.Content = "删除此项"; //delete.Foreground = Brushes.White; delete.Click += DeleteRelease_Click; delete.Name = "delete" + storageID; canvas.Children.Add(delete); canvas.Name = "canvas" + storageID; grid.Children.Add(canvas); grid.Height += 50; }