예제 #1
0
        public ChatsControl(IEventsSource eventsSource, ChatsSettings chatsSettings) : this()
        {
            _eventsSource  = eventsSource ?? throw new ArgumentNullException(nameof(eventsSource));
            _chatsSettings = chatsSettings ?? throw new ArgumentNullException(nameof(chatsSettings));

            Loaded   += ChatsControl_Loaded;
            Unloaded += ChatsControl_Unloaded;

            ChatMessageConverter.ChatsSettings = chatsSettings;
        }
예제 #2
0
        public ChatControl(IEventsSource eventsSource, ChatsSettings chatsSettings) : this()
        {
            _eventsSource  = eventsSource ?? throw new ArgumentNullException(nameof(eventsSource));
            _chatsSettings = chatsSettings ?? throw new ArgumentNullException(nameof(chatsSettings));

            _itemsControl.ItemsSource = _messages;

            Loaded += delegate
            {
                _eventsSource.ChatMessage += OnChatMessage;
            };
            Unloaded += (sender, e) => _eventsSource.ChatMessage -= OnChatMessage;
            GotFocus += ChatControl_GotFocus;

            TuneControls();
        }