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; }
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(); }