public InterlocutorChatViewModel(IFrameViewModel frame, Interlocutor interlocutor)
        {
            _frame = frame;
            _interlocutor = interlocutor;

            var chatDocument = new FlowDocument();
            ChatTextBox = new RichTextBox(chatDocument);
            ChatTextBox.IsDocumentEnabled = true;
            ChatTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            ChatTextBox.Background = Brushes.Transparent;
            ChatTextBox.IsReadOnly = true;
            _conversationThread = CreateThread(chatDocument);

            MessageTextBox = new RichTextBox(new FlowDocument());
            MessageTextBox.IsDocumentEnabled = true;
            MessageTextBox.Background = Brushes.Transparent;
            MessageTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            ParseCurrentHistory();
            SetTheme(ThemeManager.ActiveTheme);
            SetCommands();
            _historyLoader = CreateHistoryLoader();
        }
Example #2
0
        public RoomChatViewModel(IFrameViewModel frame, Room room)
        {
            _frame = frame;
            _room = room;

            var chatDocument = new FlowDocument();
            ChatTextBox = new RichTextBox(chatDocument);
            ChatTextBox.IsDocumentEnabled = true;
            ChatTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            ChatTextBox.Background = System.Windows.Media.Brushes.Transparent;
            ChatTextBox.IsReadOnly = true;
            _conversationThread = CreateThread(chatDocument);

            MessageTextBox = new RichTextBox(new FlowDocument());
            MessageTextBox.IsDocumentEnabled = true;
            MessageTextBox.Background = System.Windows.Media.Brushes.Transparent;
            MessageTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            ParseCurrentHistory();
            SetTheme(ThemeManager.ActiveTheme);

            _historyLoader = CreateHistoryLoader();
        }
 private HistoryLoaderViewModel CreateHistoryLoader()
 {
     var client = ModelContext.GetClientByContact(_interlocutor);
     var loader = new HistoryLoaderViewModel(client.Id, XmppIdConverter.Jid(_interlocutor), _conversationThread);
     loader.Init();
     return loader;
 }