예제 #1
0
        /*
         * act when a message was selected in listbox xaml.
         */
        private void Messages_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox tList;

            if (sender is ListBox)
            {
                editMessage.Hide();
                tList = (ListBox)sender;
                if (tList != null)
                {
                    Message m = (Message)tList.SelectedItem;
                    if (m != null && m.Writer_gID == MainWindow._chatRoom.LoggedInUser.Group_ID && m.Writer_name == MainWindow._chatRoom.LoggedInUser.NickName)
                    {
                        _chat.IsEditable          = Visibility.Visible;
                        _chat.SelectedMessageBody = m.MessageBody;
                        _chat.SelectedMessage     = m;
                    }
                    else
                    {
                        _chat.IsEditable          = Visibility.Hidden;
                        _chat.SelectedMessageBody = "";
                        _chat.SelectedMessage     = null;
                    }
                }
            }
        }
예제 #2
0
 public ChatRoom_Window() //constructor
 {
     _chat            = new ObserChatRoomModel();
     this.DataContext = _chat;
     initiatePreferences();
     InitializeComponent();
     _chat.Messages = new ObservableCollection <Message>(MainWindow._chatRoom.Messages);
     editMessage    = new editMessageWindow();
     editMessage.Hide();
     MainWindow._chatRoom.CenterOperation = new SortTime(true);
     editMessage.DataContext = _chat;
     dispatcherTimer         = new DispatcherTimer();
     dispatcherTimer_Tick(null, null);
     playDispatcherTimer();
 }