예제 #1
0
        public static Window GetGameWindow(string gamePartnerName)
        {
            if (GameWindowPerContact.ContainsKey(gamePartnerName))
            {
                GameWindowViewModel ExistchatWindow = GameWindowPerContact[gamePartnerName].Key;
                return(GameWindowPerContact[gamePartnerName].Value);
            }

            GameWindowViewModel gameWindowViewModel = new GameWindowViewModel(new UserDTO {
                UserName = gamePartnerName
            });
            Window gameWindow = WindowService.ShowGameWindow(gameWindowViewModel);

            gameWindow.Closing += OnWindowClosing;
            GameWindowPerContact.Add(gamePartnerName, new KeyValuePair <GameWindowViewModel, Window>(gameWindowViewModel, gameWindow));
            return(gameWindow);
        }
예제 #2
0
        public static Window GetChatWindow(string chatPartnerName, string message)
        {
            if (ChatWindowPerContact.ContainsKey(chatPartnerName))
            {
                ChatWindowViewModel ExistchatWindow = ChatWindowPerContact[chatPartnerName].Key;
                return(ChatWindowPerContact[chatPartnerName].Value);
            }

            ChatWindowViewModel chatWindowViewModel = new ChatWindowViewModel(new UserDTO {
                UserName = chatPartnerName
            });

            chatWindowViewModel.MessagesLog += (message != string.Empty) ? ChatMessageFormatter.Format(message, chatPartnerName) : "";
            Window chatWindow = WindowService.ShowWindow(chatWindowViewModel);

            chatWindow.Closing += OnWindowClosing;
            ChatWindowPerContact.Add(chatPartnerName, new KeyValuePair <ChatWindowViewModel, Window>(chatWindowViewModel, chatWindow));
            return(chatWindow);
        }