Exemplo n.º 1
0
        public ChatView(MatchModel match, string dir)
        {
            InitializeComponent();
            _match = match;
            _dir   = dir;
            var viewModel = DataContext as ChatViewModel;

            viewModel.Match      = match;
            viewModel.MyChatView = this;

            int scrollTo = Chat_ListView.Items.Count - 1;

            if (scrollTo > 0)
            {
                Chat_ListView.ScrollIntoView(Chat_ListView.Items[scrollTo]);
            }


            viewModel.NewChatMessageReceived += FlashWindow;
            Loaded += (sender, e) => SendMessage_TextBox.Focus();


            // Close window with ESC
            PreviewKeyDown += (object sender, KeyEventArgs e) =>
            {
                if (e.Key == Key.Escape)
                {
                    Close();
                }
            };
        }
Exemplo n.º 2
0
        /// <summary>
        /// Scrolls to bottom and updates items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Update()
        {
            Chat_ListView.Items.Refresh();

            int scrollTo = Chat_ListView.Items.Count - 1;

            if (scrollTo > 0)
            {
                Chat_ListView.ScrollIntoView(Chat_ListView.Items[scrollTo]);
            }
        }