コード例 #1
0
        void InvokeAddTab(ChatUser friend, string message)
        {
            if (FindMatchingChatControl(friend.Summary.SteamId) != null) return;

            if (!chatTabs.Dispatcher.CheckAccess())
                chatTabs.Dispatcher.Invoke(() =>
                {
                    var tabItem = new TabItem { Header = friend.Summary.PersonaName };
                    var chatControl = new ChatControl(this, tabItem, ChatHandler, friend);
                    tabItem.Content = chatControl;
                    chatTabs.Items.Add(tabItem);
                    if (!string.IsNullOrEmpty(message))
                        InvokeHandleMessage(chatControl, message);
                    chatTabs.SelectedIndex = chatTabs.Items.Count - 1;
                });
            else
            {
                var tabItem = new TabItem { Header = friend.Summary.PersonaName };
                var chatControl = new ChatControl(this, tabItem, ChatHandler, friend);
                tabItem.Content = chatControl;
                chatTabs.Items.Add(tabItem);
                if (!string.IsNullOrEmpty(message))
                    InvokeHandleMessage(chatControl, message);
                chatTabs.SelectedIndex = chatTabs.Items.Count - 1;
            }
        }
コード例 #2
0
        public ChatControl(ChatWindow window, TabItem containingTab, SteamChatHandler chatHandler, ChatUser friend)
        {
            ContainingTab = containingTab;
            Friend = friend;
            ChatterId = friend.Summary.SteamId;

            _window = window;
            _chatHandler = chatHandler;

            Loaded += ChatControl_Loaded;

            InitializeComponent();
        }
コード例 #3
0
        public void SetFromFriendObject(ChatUser friend)
        {
            Friend = friend;

            SolidColorBrush stateBrush = StateToBrush(friend.State.PersonaState, friend.State.InGame);

            personaName.Text = friend.Summary.PersonaName;
            personaName.Foreground = stateBrush;

            personaState.Text = StateToText(friend.State.PersonaState) + (friend.State.InGame ? " and in-game" : "");
            personaState.Foreground = stateBrush;

            avatarImage.Source = new BitmapImage(new Uri(friend.Summary.AvatarMedium));

            avatarBorder.BorderBrush = stateBrush;

            inGameName.Text = friend.State.InGameName;
            inGameName.Foreground = stateBrush;
        }
コード例 #4
0
 public void AddChatWindow(ChatUser friend, string message)
 {
     InvokeAddTab(friend, message);
 }
コード例 #5
0
        public FriendControl(ChatUser friend)
        {
            InitializeComponent();

            SetFromFriendObject(friend);
        }