private static void Client_ChoicePopBox(PlayerInfo player, RoomConfig config, ChoiceBoxType type, string pass) { ChoicePopBox box = new ChoicePopBox(player, config, type, pass); box.Topmost = true; box.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => box.Activate())); }
public ChoicePopBox(PlayerInfo player, RoomConfig config, ChoiceBoxType type, string pass = "", string deckname = "") { InitializeComponent(); this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; string txt = string.Empty; _type = type; switch (_type) { case ChoiceBoxType.Duel: txt = string.Format("Vous avez été invité en duel par {0}. \r\nType : {1}", player.Username, config.Type); if (config.MasterRules > 0) { txt += Environment.NewLine + string.Format("MasterRules : {0}", config.MasterRules); } else { txt += Environment.NewLine + string.Format("Turbo duel", config.MasterRules); } txt += Environment.NewLine + string.Format("Banlist : {0}", FormExecution.GetBanlistValue(config.Banlist)); txt += Environment.NewLine + string.Format("Point de vie : {0}", config.StartDuelLP); txt += Environment.NewLine + string.Format("Carte dans la main au départ : {0}", config.CardByHand); txt += Environment.NewLine + string.Format("Pioche par tour : {0}", config.DrawCount); txt += Environment.NewLine + string.Format("Info : {0}", config.CaptionText); txt += Environment.NewLine + (config.NoShuffleDeck ? "Deck non mélangé" : "Deck mélangé"); if (pass != string.Empty) { txt += Environment.NewLine + "Partie privée"; } Title = "Requête de duel"; break; case ChoiceBoxType.Trade: Title = "Requête d'échange"; txt = string.Format("Vous avez été invité en échange par {0}.", player.Username); break; case ChoiceBoxType.Deck: txt = "Vous avez reçu le deck " + deckname + " de la part de " + player.Username + "."; break; case ChoiceBoxType.Replay: txt = "Vous avez reçu le replay " + deckname + " de la part de " + player.Username + "."; break; case ChoiceBoxType.DeckChoiceRanked: txt = "Vous vous apprêtez à rentrer dans la file classée avec le deck : " + deckname; break; } popText.Text = txt; Loaded += PopBox_Loaded; packet = new StandardClientDuelRequestAnswer { Player = player, Config = config, Roompass = pass }; }